I don't know what's going on with my centos 7 machine but seems like du -h /path only shows folders, not files, and it's annoying. I want to find all the files and folders at a specific depth and sort it by size. For example (Note that even if I remove --max-depth=2 result is still the same)
[root@data-node12 ~]# du -h --max-depth=2 /root/quang/ | sort -rn 352M /root/quang/ 339M /root/quang/test_folder While I have many files inside /root/quang
[root@data-node12 ~]# ls -lh /root/quang/ total 14M -rwxrwxrwx 1 root root 508 May 22 10:23 deleteClipLogByDate.sh -rw-r--r-- 1 root root 68K Dec 22 14:01 extract.csv -rwxr-xrwx 1 root root 4.7K Dec 21 17:38 goi_cuoc.sh -rwxr-xrwx 1 root root 8.7K Dec 22 15:50 log_tuong_tac_kh.sh -rw-r--r-- 1 root root 96 May 22 09:02 output_goi_cuoc.log -rw-r--r-- 1 root root 96 May 22 09:30 output_log_tuong_tac_kh.log drwxr-xr-x 2 root root 4.0K May 22 10:53 test_folder -rwxrwxrwx 1 root root 773 Dec 21 17:41 test.sh -rw-r--r-- 1 root root 14M May 22 10:54 trino-cli-435-executable.jar also there is a file in /root/quang/testfolder
[root@data-node12 ~]# ls -lh /root/quang/test_folder/ total 339M -rw-r--r-- 1 root root 339M May 22 10:53 fastmoney_vft.sql Also please note that ls -lh command won't show the right disk space for folders, also can't sort, so that won't work.
How can I du -h and show all files and folders that I can sort (recursively if possible)? Is this some kind of bug?
du -aman dudoesn't work for you, tryinfo du.