0% found this document useful (0 votes)
23 views3 pages

Practical 5

Uploaded by

6.6.6.non.entity
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views3 pages

Practical 5

Uploaded by

6.6.6.non.entity
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Name: Anmol Kumar Sec: 5th (D1) Roll no.

: 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.

2. df -h command - You can display disk usage in a more human-readable


format by adding the -h option. This displays the size in kilobytes (K),
megabytes (M), and gigabytes (G).

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.

3. The df command can be used to display a specific file system:


• df -h /dev/sda2 , df -h /
This displays the usage on your primary hard drive. Use the mount point (in the
Mounted on column) to specify the drive you want to check.

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

To specify the directory or file, check use the following options:

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:

sudo du -hs /etc

You might also like