Disk Management
Show all disks, usage, and format type
sudo df -T -h
Filesystem Type Size Used Avail Use% Mounted on
udev devtmpfs 930M 4.0K 930M 1% /dev
tmpfs tmpfs 191M 1.5M 190M 1% /run
/dev/sda1 fuseblk 29G 25G 4.5G 85% /isodevice
/dev/loop0 iso9660 1.6G 1.6G 0 100% /cdrom
/dev/loop1 squashfs 1.5G 1.5G 0 100% /rofs
/cow overlay 22G 17G 4.1G 81% /
tmpfs tmpfs 954M 5.2M 949M 1% /dev/shm
tmpfs tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs tmpfs 954M 0 954M 0% /sys/fs/cgroup
tmpfs tmpfs 954M 56K 954M 1% /tmp
tmpfs tmpfs 191M 8.0K 191M 1% /run/user/999
tmpfs tmpfs 191M 20K 191M 1% /run/user/70000
google-drive-ocamlfuse fuse.google-drive-ocamlfuse 15G 9.1G 6.0G 61% /home/kapper/gdrive
Check /var directories for disk usage, sort and limit results to 10
sudo du -ah /var | sort -nr | head -n 10
924K /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_disco-updates_universe_i18n_Translation-en
924K /var/cache/apparmor/26b63962.0/usr.lib.libreoffice.program.soffice.bin
912K /var/lib/texmf/web2c/pdftex/pdflatex.fmt
912K /var/lib/texmf/web2c/pdftex/latex.fmt
888K /var/cache/apt/archives/libgtkmm-3.0-1v5_3.24.0-2_amd64.deb
852K /var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_disco-security_main_i18n_Translation-en
828K /var/lib/app-info/icons/ubuntu-disco-multiverse
824K /var/lib/dpkg/info/linux-headers-5.0.0-38-generic.md5sums
817K /var/lib/dpkg/info/linux-headers-5.0.0-13-generic.md5sums
804K /var/log/syslog.3.gz
Scan this disk for usage, sort the results by directories > 1.0GB, show largest 5 results
sudo du -xh / | grep '^\S*[0-9\.]\+G' | sort -rn | head -n 5
19G /
9.8G /home/kapper
9.8G /home
6.7G /usr
5.7G /home/kapper/.cache
Show the largest 5 files on the system (greater-than 100MB), using block size of 1MB.
sudo find / -xdev -type f -size +100M -exec ls -l --block-size=M {} \; | sort -nk 5 -r | head -n 5
-rw-r--r-- 1 kapper kapper 174M Nov 30 06:13 /home/kapper/.local/share/JetBrains/Toolbox/apps/CLion/ch-0/213.5744.254/lib/platform-impl.jar
-rw-r--r-- 1 kapper kapper 174M Nov 30 03:14 /home/kapper/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/213.5744.248/lib/platform-impl.jar
-rw-r--r-- 1 kapper kapper 174M Nov 27 05:41 /home/kapper/.local/share/JetBrains/Toolbox/apps/WebStorm/ch-0/213.5744.224/lib/platform-impl.jar
-rw-r--r-- 1 kapper kapper 174M Nov 23 11:21 /home/kapper/.local/share/JetBrains/Toolbox/apps/datagrip/ch-0/213.5744.178/lib/platform-impl.jar
-rw-r--r-- 1 kapper kapper 174M Dec 1 08:26 /home/kapper/.local/share/JetBrains/Toolbox/apps/Goland/ch-0/213.5744.269/lib/platform-impl.jar
Show the 10 files consuming the most data on this system
sudo find / -printf '%s %p\n'| sort -nr | head -10
140737477885952 /proc/kcore
24244125696 /isodevice/casper-rw
3296907264 /media/lubuntu/37aba99c-8b85-4ddc-92eb-6f50251041e8/encrypted.block
1890263040 /media/lubuntu/37aba99c-8b85-4ddc-92eb-6f50251041e8/home/.shadow/362074638d2508061facd43743c9f08ff66866b8/mount/ASTjdxE5eNzc0F3lkW870B/4HICtmqSNBNCh4oi+U7116prbiG
1657700352 /isodevice/lubuntu-19.04-desktop-amd64.iso
1589342208 /cdrom/casper/filesystem.squashfs
471728128 /media/lubuntu/37aba99c-8b85-4ddc-92eb-6f50251041e8/home/.shadow/362074638d2508061facd43743c9f08ff66866b8/mount/ASTjdxE5eNzc0F3lkW870B/MK3nlrbwT+ZzY8n1fczEqB/Yqt2q,akFt0uJ7WDNJaHdNA0GbkTnhX7kza2zeVnGMI/E1hEyvd6NZ1+JT6hgxI2zA/JekSpYOtLWQPV0kgorVJuFbCcIG/LRriMSOWaunntY7RsNUiUC/x+gYqqpRFtEjXG+JzztvwlQ4LDeq82QY
268435456 /sys/devices/pci0000:00/0000:00:02.0/resource2_wc
268435456 /sys/devices/pci0000:00/0000:00:02.0/resource2
137797651 /home/kapper/.local/share/Steam/ubuntu12_64/libcef.so
Print information on all connected block devices
sudo lsblk
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 128M 0 part
├─sda2 8:2 0 925.5G 0 part
└─sda3 8:3 0 5.9G 0 part
Print the UUIDs of all connected block devices, along with some other hardware information
sudo blkid
/dev/sdb2: UUID="436b3ae3-4301-4b8a-80d3-fdf52c7d7059" TYPE="swap" PARTUUID="590670f6-3b89-41b5-b474-fcd6c048628d"
Print information on partitions one all connected block devices
sudo parted -l
Model: HDD A12345678-B3210 (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 1000MB 999MB fat32 boot, esp
2 1000MB 17.0GB 16.0GB linux-swap(v1)
3 17.0GB 117GB 100GB ext4
4 117GB 217GB 100GB ext4
5 217GB 427GB 210GB ext4
Print information given a specific block device (partitions)
sudo tune2fs -l /dev/sdb3
tune2fs 1.45.4 (23-Sep-2019)
Filesystem volume name: <none>
Last mounted on: /
Filesystem UUID: fagbraetd325t9-6gafdee7-4d2344agdd-93d2-6f4safsafsa5d6
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags: signed_directory_hash
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Filesystem created: Mon Oct 14 12:34:48 2019
Last mount time: Thu Oct 24 12:27:30 2019
Last write time: Thu Oct 24 12:27:30 2019
Mount count: 50
Maximum mount count: -1
Lifetime writes: 50 GB
Default directory hash: half_md4
Directory Hash Seed: 4e7gds499c3-8532e0-452356c-432890c-d0fds43e2be81ee
Journal backup: inode blocks
Checksum type: crc32c
Checksum: 0xb054235dk
No Comments