Disk Usage — Storage and filesystem information
du
Disk Usage
Estimate file and directory space usage
Syntax
du [OPTIONS] [PATH]
Examples
du -sh /var/log du -sh * du -h --max-depth=1 /home
Common Flags
-s summary total only
-h human-readable
--max-depth N limit depth
-a all files, not just directories
Notes
du -sh * in a directory gives you a quick size overview of each item.
lsof
Disk Usage
List open files and the processes using them
Syntax
lsof [OPTIONS]
Examples
lsof -i :80 lsof -u alice lsof /var/log/syslog
Common Flags
-i PORT files using a network port
-u USER files opened by user
-p PID files opened by process
Notes
Useful to find what process is using a port: lsof -i :8080
mount
Disk Usage
Mount a filesystem
Syntax
mount [OPTIONS] DEVICE MOUNTPOINT
Examples
mount /dev/sdb1 /mnt/usb mount -t ntfs /dev/sdb1 /mnt/usb mount | grep sdb
Common Flags
-t TYPE filesystem type (ext4, ntfs, vfat)
-o opts mount options (ro, rw)
umount
Disk Usage
Unmount a filesystem
Syntax
umount MOUNTPOINT|DEVICE
Examples
umount /mnt/usb umount /dev/sdb1
Common Flags
-f force unmount
-l lazy unmount (detach when not busy)