1.whereis命令:
[root@rhcsa ~]# whereis locate
locate: /usr/bin/locate /usr/share/man/man1/locate.1.gz
[root@rhcsa ~]# which whereis
usr/bin/whereis
[root@rhcsa ~]# locate rm
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
2.find命令:
[root@rhcsa ~]# find . -type f
[root@rhcsa ~]# find . file1.txt file2.txt file3.txt
[root@rhcsa ~]# find . -user root -type f
[root@rhcsa ~]# find . -mtime -1 -type f
3.cut命令:
[root@rhcsa ~]# vim cut_data.txt
[root@rhcsa ~]# cut -f1,3 cut_data.txt
[root@rhcsa ~]# cut -b 1-10 cut_data.txt(按字节切割)
[root@rhcsa ~]# cut -d "|" -f1,3 cut_data.txt
4.uniq命令:
[root@rhcsa ~]# vim uniq_data.txt
[root@rhcsa ~]# uniq uniq_data.txt
[root@rhcsa ~]# uniq -d uniq_data.txt(只输出重复的行)
[root@rhcsa ~]# uniq -u uniq_data.txt(输出不重复的行)
[root@rhcsa ~]# uniq -c uniq_data.txt(统计重复次数)
5.sort命令:
[root@rhcsa ~]# vim num.txt
[root@rhcsa ~]# sort num.txt > sort_num.txt
[root@rhcsa ~]# sort args.txt > sorted_args.txt
[root@rhcsa ~]# sort num.txt args.txt > sorted_merge.txt
[root@rhcsa ~]# sort -u args.txt
[root@rhcsa ~]# sort cut_data.txt -k2
6.tr命令:
[root@rhcsa ~]# vim tr.txt
[root@rhcsa ~]# cat tr.txt |tr 'n-z' 'N-Z'(小写换成大写)
[root@rhcsa ~]# cat tr_data.txt | tr '1-6' '\0'(数字换成空字符)
[root@rhcsa ~]# cat tr_data.txt | tr 'a-z' '\0'(把字母和空格换掉)
7.wc命令:
[root@rhcsa ~]#wc -c word_cound.txt (按字节统计)
[root@rhcsa ~]#wc -w word_cound.txt (按单词统计)
[root@rhcsa ~]#wc -l word_cound.txt (按行统计)