Linux简单命令使用

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 (按行统计)

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值