Linux command to check disk space

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp

Linux command to check disk space

Baffometo

Baffometo

Linux check disk space with df command

  1. Open the terminal and type the following command to check disk space.
  2. The basic syntax for df is:
    df [options] [devices]

Type

  1. df
  2. df -H

Check disk space with du command

The du command is very useful to track down disk space. It is useful to find out the names of directories and files that consume large amounts of space on a disk. The basic syntax is:

  1. du
  2. du /path/do/dir
  3. du [options] [directories and/or files]

Type

  • du
  • du -h

How do I summarize disk usage for given directory name?

Pass the -s option to the du command. In this example, ask du command to report only the total disk space occupied by a directory tree and to suppress subdirectories:

Check disk space usage with Ncdu

Ncdu is a command line tool to view and analyse disk space usage on linux. It can drill down into directories and report space used by individual directories. This way it is very easy to track down space consuming files/directories. It actually allows the user to do this much faster than even a GUI file manager.

Ncdu vs du/df

The interface of ncdu is built using ncurses and is interactive. Ncdu is different from df or du.

Ncdu just does the one task of reporting the space used by a directory and drill down. On the other hand the df command reports space used by different storage devices.

The du command is rawer in nature and reports space used by individual files and recursively into subdirectories. Due to this, the output is huge and very cumbersome. The du command needs to be passed few options and combined with other commands via pipes to produce something readable.

Sometimes it is not installed by default

Share Post

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp

Related Posts

smart-home

NZBGet Pi

NZBGet is the must have software if you are into the usenet databases, basically this will help you searching the files that you requested in

Read More »
cyber-security

Google Sheets and Python

Nowadays Google Docs has been integrating a whole bunch of features with its amazing API that you can use from triggering a Python script hosted

Read More »
cyber-security

Spytify

What is Spytify? Spytify is a Windows desktop application for recording music from Spotify. It’s a free open source Spotify recorder which records Spotify songs

Read More »