Practical 5
Practical 5
: 11202667
Practical: 5
Aim: To study various disk and space usage commands.
1. df command - The df command stands for disk free, and it shows you the
amount of space taken up by different drives. By default, df displays values
in 1-kilobyte blocks.
Filesystem – This is the name of each particular drive. This includes physical hard
drives, logical (partitioned) drives, and virtual or temporary drives.
Size – The size of the filesystem.
Used –Amount of space used on each filesystem.
Avail – The amount of unused (free) space on the filesystem.
Use% – Shows the percent of the disk used.
Mounted on – This is the directory where the file system is located. This is also
sometimes called a mount point.
Name: Anmol Kumar Sec: 5th (D1) Roll no.: 11202667
The list of filesystems includes your physical hard drive, as well as virtual hard
drives:
/dev/sda2 – This is your physical hard drive. It may be listed as /sda1, /sda0, or
you may even have more than one. /dev stands for device.
udev – This is a virtual directory for the /dev directory. This is part of the Linux
operating system.
tmpfs – You may have several of these. These are used by /run and other Linux
processes as temporary filesystems for running the operating system. For
example, the tmpfs /run/lock is used to create lockfiles. These are the files that
prevent multiple users from changing the same file at the same time.
4. df -ht ext4 command - To list all file systems by type. This lists drives
with the ext4 type, in human-readable format.
Check Disk Space: The du command displays disk usage. Use it to display
the amount of space used by your current directory. Like the df command, you
can make du human-readable
Name: Anmol Kumar Sec: 5th (D1) Roll no.: 11202667
du -hs /etc/kernel-img.conf
du -hs /etc
With the second command, you may have noticed a permission denied error
message. This means the current user doesn’t have the privileges to access
certain directories. Use the sudo command to elevate your privileges: