How to know list of directories under a filesystem

disk-usagefilesystemsls

If I run sudo df -h command, I got below output:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              12G  9.5G  1.1G  91% /
/dev/sda4             3.8G  1.5G  2.1G  41% /home
/dev/sda1              99M   75M   20M  80% /boot
tmpfs                 3.9G     0  3.9G   0% /dev/shm
/dev/sdc1              51G  2.6G   46G   6% /u000

But, how will I know the list of directories under /sda2?
For example, If I run ls / command, I got all the directories under root.

$ ls /
bin   cdunix     dev  etc   lib    lost+found  misc  mnt1  mtp     net  PatchInstall  root  selinux  sys       tmp   usr
boot  cron_4058  esm  home  lib64  media       mnt   mnt2  NB_DIR  opt  proc          sbin  srv      tftpboot  u000  var
  • But, is there any command or way through which I can also list down
    their filesystem too?
  • Since, there is very less amount of space
    remaining on /dev/sda2/. How can I vacant more space from this
    partition?

Best Answer

If I am reading this question correctly, there is a program called tree. This would list all directories in a tree like structure. With it installed, you can do something like:

tree -x Where -x Stay on the current file-system only. Ala find -xdev.

UPDATE: I have tried tree -P /dev/xvda and it seemed to have shown directories under that filesystem. The -P command stands for pattern. So to answer your question, you should be able to use it to list directories in filesystems.

To list the first levels in / directory, try command:

tree -LP 1 /dev/xvda

where L is level Max display depth of the directory tree.

Refer to the man pages here

Related Question