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?

3 Answers 3


If you are looking for directories that are using up space, and are not on a different partition, then you want du -hx --max-depth=1 /. The -x tells it not to descend into directories that are on other filesystems ( partitions ). The --max-depth=1 asks to only print a line ( listing the total space for that directory and all subdirectories ) for each directory in / rather than every single subdirectory.

You can then start drilling down into the larger subdirectories to find what is taking up the space.


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

  • can I use tree command with filesystem to list all the directories?
    – ursitesion
    Commented Nov 17, 2014 at 16:35
  • 1
    I updated my answer. I believe you can.
    – ryekayo
    Commented Nov 17, 2014 at 16:38
  • I executed tree -P /dev/sda4/ and got this result: ` . 0 directories, 0 files`
    – ursitesion
    Commented Nov 17, 2014 at 16:42
  • Make sure your in the / directory when running this command
    – ryekayo
    Commented Nov 17, 2014 at 16:43
  • correct. How to list directories of only one level ?
    – ursitesion
    Commented Nov 17, 2014 at 16:56

But, how will I know the list of directories under /sda2?

There are no directories under /dev/sda2, /dev/sda2 is a partition on the disk (sda is the disk and 2 is the partitions number).

But, is there any command or way through which I can also list down their filesystem too?

Since you only have one filesystem mounted then they are all on the / fs.

A better way to see a list of mounted filesystems is to use mount:

$ sudo mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=2018106,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,relatime,size=3232436k,mode=755)
/dev/sda5 on / type ext4 (rw,noatime,errors=remount-ro,data=ordered)

To see the amount of storage used by a folder you can use the du command, eg.:

~/tmp$ du -sh
752K    .

du has lots of use full options. A really good one when tracking down large folders is --max-depth=1 which will limit the depth of the output:

du -h --max-depth=1 /
7,9M    /sbin
702M    /lib

You will get lots of error messages if you run this on / without being root.

du can help you figure out which files to delete to make more space. If you can't delete any files then you either need to resize the partition or move some data to a different partition.

  • I have added all the filesystem on my server.
    – ursitesion
    Commented Nov 17, 2014 at 16:30
  • @ursitesion OK, what is your actual question then?
    – Martin
    Commented Nov 17, 2014 at 16:32
  • I want to reduce the 'uses %` in my /dev/sda2
    – ursitesion
    Commented Nov 17, 2014 at 16:33
  • ah.. you should edit your question then. I will update my answer
    – Martin
    Commented Nov 17, 2014 at 16:34
  • Updated my question....
    – ursitesion
    Commented Nov 17, 2014 at 16:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .