du: option requires an argument — ‘X’

  • 601 views
  • Read

Several days ago I encountered this little issue and I found it was very interesting. du: option requires an argument — ‘X’

I got a capacity issue and when I run 'du -sh *' I got error message similar with below:

root@debian:/tmp# du -sh *
du: option requires an argument -- 'X'
Try 'du --help' for more information.

I have run such commands many many times so I make sure it should be workable, but I still run 'du --help' to read the help manual. Of course I could not find my answer.

While the 'ls *' worked well and the command 'du' was the right one I wanted to use.

root@debian:/tmp# ls *
transmission_bromolow-5.2_2.94-17.spk
root@debian:/tmp# which du
/usr/bin/du
root@debian:/tmp# alias
root@debian:/tmp# du transmission*
3892    transmission_bromolow-5.2_2.94-17.spk

When I first got this issue, I got confused and had to ignore it to deal with other urgent issue, while this time I decided to find the reason.

I found it soon!

root@debian:/tmp# ls
transmission_bromolow-5.2_2.94-17.spk  -X
root@debian:/tmp# ls -l *
-rw-r--r-- 1 root root 3983360 Jun  2 21:19 transmission_bromolow-5.2_2.94-17.spk
root@debian:/tmp# ls -l
total 3892
-rw-r--r-- 1 root root 3983360 Jun  2 21:19 transmission_bromolow-5.2_2.94-17.spk
-rw-r--r-- 1 root root       0 Jun  3 18:07 -X
root@debian:/tmp# du -sh *
du: option requires an argument -- 'X'
Try 'du --help' for more information.
root@debian:/tmp# du -sh -- -X
0       -X
root@debian:/tmp# rm -- -X
root@debian:/tmp# du -sh *
3.9M    transmission_bromolow-5.2_2.94-17.spk

The root cause was simple and I believe you could find it easily from the above command output, right? du: option requires an argument — ‘X’

  • by Published on 03/06/2018 18:26:04
  • Repost please keep this link: https://www.dbcloudsvc.com/blogs/linux/du-option-requires-an-argument-x/
匿名

Comment

Anonymous Write

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

Decide