标准输入、标准输出、标准错误

File descriptors are integers associated with an opened file or data stream. File descriptors 0,
1, and 2 are reserved as follows:
 0 –  stdin (standard input)
1 –  stdout (standard output)
2 –  stderr (standard error)

重定向(默认只重定向标准输出)  > 覆盖重写 >> 添加

重定向标准错误和标准输出到不同文件  cmd 2>stderr.txt 1>stdout.txt

重定向到同一个文件 cmd 2>&1 out.txt

不输出标准错误 cmd 2>/dev/null

管道命令(|)

find 命令

find ../ test.txt

find -name "*.txt"

find . -iname "example*" -print  忽略大小写查找

find . \( -name "*.txt" -o -name "*.pdf" \) -print  多条件查找

find /home/users -path "*slynux*" -print  查找目录

find . -regex ".*\(\.py\|\.sh\)$"       正则表达式查找

find . ! -name "*.txt" -print    查找不是以.txt结尾的文件

find . -type d -print 查找目录

根据时间做查找

find . -type f -atime -7 -print    查找7天内访问过的文件

find . -type f -mtime -7 -print    查找7天内修改过的文件

find . -type f -ctime -7 -print    查找7天内修改过权限或者拥有者的文件

以下三个选项对应的是分钟

-amin (access time)
f -mmin (modification time)
f -cmin (change time)

find . -type f -newer file.txt -print   查找修改时间比file.txt早的文件

根据文件大小做查找

b – 512 byte blocks
c – bytes
 w – two byte words
 k – Kilobyte
 M – Megabyte
G – Gigabyte

find . -type f -size +2k  查找大于2k的文件

find . -type f -size -2k  查找小于2k的文件

find . -type f -size 2k  查找等于2k的文件

File type       Type argument
Regular file       f
Symbolic link    l
Directory          d
Character special device c
Block device    b
Socket             s
Fifo                  p

find . -type f -name "*.swp" -delete  找到文件的同时删除

find . -type f -atime -7  | xargs  ls -lt 2>>/dev/null | head -n 1  查找七天内访问过的最近一条文件记录
ls -lrt  时间升序排列

ls -lt   时间降序排列

删除某个进程

ps -aux | grep 'python' | awk '{print $2}' | xargx kill

linux shell 命令笔记的更多相关文章

  1. 73条日常Linux shell命令汇总,总有一条你需要!

    转载: 73条日常Linux shell命令汇总,总有一条你需要! 1.检查远程端口是否对bash开放: echo >/dev/tcp/8.8.8.8/53 && echo &q ...

  2. Linux常用命令 笔记

     Linux常用命令  笔记 一.文件处理命令 1. ls命令:显示目录文件                          -a 显示所有文件,包括隐藏文件.(all)               ...

  3. Linux 常用命令笔记

    Linux 常用命令笔记 1. locate locate:用来定位文件的位置,如:locate a.txt 但是这个命令有延迟,也就是新建的文件不一定能搜索到,如果非要找到新建的文件可以使用 upd ...

  4. Linux shell命令中expr

    在Linux shell命令中expr虽然不是很起眼,但是它的作用是非常大的!到目前为止,我个人看来最大的作用就是两个——四则运算和字符串的操作. 先说四则运算,在Shell中四则运算不能简简单单的加 ...

  5. Linux/shell命令的实际应用——查看Port占用 netstat

    启动1024端口一下,是需要root权限的 该Linux/shell命令主要用于解决: 1.查看某端口是否被占用: 2.查看某端口被哪个进程占用: 3.查看某个进程占用了哪些端口: 比如我tomcat ...

  6. [Python2.x] 利用commands模块执行Linux shell命令

    用Python写运维脚本时,经常需要执行linux shell的命令,Python中的commands模块专门用于调用Linux shell命令,并返回状态和结果,下面是commands模块的3个主要 ...

  7. java使用Runtime.exec()运行windwos dos或linux shell命令

    使用Runtime.exec()运行windwos dos或linux shell命令,按实际情况具体测试     实例代码: package com.bookoo.test.command; imp ...

  8. 15个有趣好玩的linux shell 命令

    今天介绍一些有趣的linux shell命令,所有的命令都可以使用man + 命令名称 来查看完整的使用方法. 1,figlet 字符画 figlet 可以将英文字符串以字符画的形式输出: >& ...

  9. 常用Linux Shell命令,了解一下!

    目录 1 前言 2 正文 2.1 关机/重启 2.2 echo 2.3 vim文本编辑器 2.3.1 最基本用法 2.3.2 常用快捷键 2.3.3 查找/替换 2.4 拷贝/删除/移动/重命名 2. ...

随机推荐

  1. ES6数组内对象去重

    这个数组去重转自https://www.cnblogs.com/caideyipi/p/7679681.html, 就当笔记记录: 去重Set const arr = ['张三','张三','三张三' ...

  2. python 3 爬虫

    import urllib.request url = "http://www.oschina.net/" data = urllib.request.urlopen(url).r ...

  3. web开发中会话跟踪的方法有哪些

    会话跟踪就是浏览器和服务器通信 1.cookie 2.session 3.隐藏input 4.url重写 5.ip地址

  4. centOS7杀死进程命令

    查看当前所有正在运行的进程,可以看到80端口被httpd占用了(80端口希望分配给nginx使用,而不是httpd) netstat -tpnul 这里以杀死httpd进程为例: 先查看 httpd ...

  5. redis管道pipeline

    Jedis jedis = new Jedis("127.0.0.1",6379); Pipeline pipeline = jedis.pipelined(); for(int ...

  6. 【HANA系列】SAP HANA SQL获取当前日期

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[HANA系列]SAP HANA SQL获取当前 ...

  7. spark 怎么去连接 ElasticSearch

    https://stackoverflow.com/questions/52659109/cannot-read-from-elasticsearch-using-pyspark https://st ...

  8. 应用安全 - harbaor - 漏洞汇总

    CVE-2019-19026(SQL注入,高危):https://github.com/goharbor/harbor/security/advisories/GHSA-rh89-vvrg-fg64( ...

  9. 【Linux开发】如何查看Linux kernel的内置模块驱动列表和进程ID

    [Linux开发]如何查看Linux kernel的内置模块驱动列表和进程ID 标签:[Linux开发] 命令: cat /lib/modules/$(uname -r)/modules.builti ...

  10. Canvas入门01-基础知识

    定义一个canvas,直接在Html中使用canvas便签即可. <!DOCTYPE html> <html lang="en"> <head> ...