If I use "df /dev/sda1 -h", it only shows the whole usage info like used and avail. But I want to see the usage of each directory. However, if I do "du -h --max-depth=1", it shows all the directories under "/" but some of them are not related to "/dev/sda1". Is there a way to combine the two, as titled? Thanks.

To clarify from the answers provided,

$ cd /
$ sudo du --max-depth=1 -x -h
3.6G    ./tmp
4.0K    ./private
310M    ./opt
4.0K    ./crl
3.4M    ./lib32
2.6G    ./usr
0   ./dev
8.0K    ./db
8.0K    ./mnt
11M ./root
0   ./sys
16K ./lost+found
4.0K    ./certs
8.7M    ./bin
0   ./run
4.0K    ./selinux
4.0K    ./srv
7.7M    ./etc
0   ./proc
385M    ./lib
718M    ./home
4.0K    ./ctel
4.0K    ./lib64
8.1M    ./sbin
1.2G    ./var
4.0K    ./boot
8.0K    ./media

Among them, "/ctel" and "/boot" are mounted on another partition, which I don't want to see. Thanks.


du --max-depth=1 -x should do the trick. Option -x means not to follow other file-systems.

|improve this answer|||||

from du(1) (man page):

  -P, --no-dereference
          don't follow any symbolic links (this is the default)
  -x, --one-file-system
          skip directories on different file systems
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.