Linux Commands for Devs who are acting Ops
find command
在当前文件夹及子文件夹中(递归)查找所有以lock结尾的Python文件
$ find . -type file -name "*lock.py"
在当前文件夹中查找所有Python文件(不查找子文件夹)
$ find . -type file -depth 1 -name "*.py"
在多个文件夹中查找所有shell文件
$ find ./folder1 ./folder2 -name "*.sh"
在当前文件夹下查找5分钟之内被修改的文件,并排序
$ find -s . -ctime -5m
在当前文件夹下找出空的log文件
$ find . -name "*.log" -empty
在当前文件夹下找出".test"为后缀的文件并打印文件内容到终端
$ find . -name "*.test" -depth 1 -exec cat {} ";"
uptime command
$ uptime --since
top command
$ top -p <pid>
$ top -p <pid> -H
ps commmand
$ ps aux
$ ps el
tail command
du command
# Show total file size of current directory
$ du -sh .
lsof command
# Show open files of a given process
$ lsof -p <pid>
e.g. $ lsof -p 28805
# Show open files of a list of processes
lsof -p '''28805,28806'''
Comments