四剑客和正则表达式常见故障及困惑集合(待更新)

一. find命令:

warning警告

-maxdepth 这个参数要放在其他参数之前。

[root@oldboyedu59 ~]# find / -type d -maxdepth 1
find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments.

/
/boot
/dev
/proc
/run
/sys
/etc
/root
/var
/tmp
/usr
/home
/media
/mnt
/opt
/srv
/old
/oldboy
/lidao
/oldwang
/newwang
/data
/tmp01
[root@oldboyedu59 ~]# 
[root@oldboyedu59 ~]# find /  -maxdepth 1 -type d 
/
/boot
/dev
/proc
/run
/sys
/etc
/root
/var
/tmp
/usr
/home
/media
/mnt
/opt
/srv
/old
/oldboy
/lidao
/oldwang
/newwang
/data
/tmp01

参数书写错误

Expected a positive decimal integer argument to -maxdepth, but got ‘-type’
发现了一个-maxdepth这个参数后面应该加上数字,但是却找到了-type

[root@oldboyedu59 ~]# find /etc/ -maxdepth   -type f  -iname "*.conf"
find: Expected a positive decimal integer argument to -maxdepth, but got ‘-type’

参数书写错误

Arguments to -type should contain only one letter
-type的参数 应该只是一个字母

[root@oldboyedu59 ~]# find /etc/ -maxdepth 1  -type   -iname "*.conf"

find: Arguments to -type should contain only one letter

Invalid argument 无效的参数

不支持小数,使用整数

[root@oldboy001 ~]# find /tmp/ -size -0.5k
find: Invalid argument `-0.5k' to -size
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值