Linux命令列表
命令列表:http://codingstandards.iteye.com/blog/786653
?
—grep—
http://nemogu.iteye.com/blog/1534339
?
–mkdir–
当前目录下创建a/b目录
mkdir -p a/b
?
–find–
查看dir目录下的所有txt文件
find /dir -name
‘*.txt’
查看当前目录下txt和pdf文件
find . \(-name ‘*.txt’ -o -name ‘*.pdf’ \)
匹配路径中有import目录的文件
find /dir -path
‘*import*’
通过正则来匹配
find /dir -regex
“”
列出所有目录(文件,链接)
find . -type
d
find . -type f
find . -type l
删除匹配的文件
find . -type f -name “*.swp” -delete
利用find -exec执行命令
将10天前的.txt文件复制到OLD目录中:
find . -type f -mtime +10 -name “*.txt” -exec
cp {} OLD \;
//将多个命令写在shell脚本中
-exec ./commands.sh {} \;
?
–wc–
文件or目录的数目
ls |wc -l
?
?
–rm–
删除目录
rm -r dir
删除文件
rm file
http://codingstandards.iteye.com/blog/983531
?
–mv–
重命名(将file1重命名为file2,-i用于提示是否覆盖file2)
mv -i file1 file2
移动文件
mv file dir
–cp–
?
–cat–
http://nemogu.iteye.com/blog/1534314
?
–head / tail–
实时查看日志文件变换 tail -f log_file
查看文件最新的内容 tail file (默认查看最后10行)? tail -n 50 file(查看最后50行)
查看头50行 head -n 50 file
?
–管道–
?
查看java进程
ps -ef | grep java
?
–tee–
http://codingstandards.iteye.com/blog/833695
?
–seq–
seq 5 产生序列
1..5
?
–cut–
将文本按列划分
$ cat a_file
No??? Name??? Age
1?????? a?????????? 12
2?????? b??????????? 23
3?????? c?? ? ? ? ?? 34
TODO:输出第2,3列
$ cut -f2,3 a_file
?? (注:f表field)
Name??? Age
a??????????? 12
b??????????? 23
c??????????? 34
———–
$ cat b_file
1;a;23
2;b;34
3;c;45
4;d;56
TODO:指定“;”为定界符,获取第2列
$ cut -f2 -d”;” b
_file
a
b
c
d
———–
—-awk—-
对数据流的行和列进行操作。
?
–df–
查看磁盘空间占用情况
df -h
?
文件系统类型
df -T
?
根据磁盘使用进行报警
?
?
–du–
查看文件的磁盘空间占用情况
$
du -sh
96k
$
du -sh *
12K??? awk
24K??? cat
12K??? cron
12K??? cut
16K??? grep
0??? lnk
4.0K??? mv
12K??? so