#df
Free disk space
df [options]df -hSpace per disk in human-readable sizes
df -hT /One filesystem including its type
df -iInode usage (a disk can be "full" of tiny files)
A full disk is one of the most common ways a Linux server fails. In this video, you'll learn how to check free space, find out what is using it, and track down the biggest files. All live, on a real Ubuntu server, with SSH Command. We're connected to the server, with the Shell view open. I've put a few large demo files in a folder called disk-demo, so there is something to find. Start with df, which stands for disk free. It lists every filesystem and how full it is. The dash h option means human readable, so you see gigabytes instead of raw blocks. Ignore the temporary lines, and look for the filesystem mounted on slash. That's the main disk. Give df a path, and it shows only that one. This disk is ten gigabytes, with five point four used, and four free. That's fifty-eight percent. When Use percent passes ninety, it's time to act. A disk can also run out of inodes, which count files, not bytes. df dash i shows them. Here, only twenty-eight percent are used. df tells you the disk is filling up. du tells you what is filling it. du dash s h prints the total size of a folder: s for summary, h for human readable. Add a star to see each item inside the folder separately. Then pipe it into sort dash r h, which ranks the sizes from largest to smallest. Media is the biggest, then backups, then logs. To find individual big files, use find with dash size. Here we look for regular files over one hundred megabytes. Two files turn up. ls dash l h S sorts a folder by size, largest first. The holiday video is four hundred and fifty megabytes. lsblk shows the disks themselves. Dash e seven hides the loop devices that snap packages create. Our virtual disk, vda, is ten gigabytes, and the root partition takes nearly all of it. SSH Command shows the same information in the Files view. Sizes sit right in the listing, so the big files stand out, and you can select a file and remove it with one click. Once you have found the culprit, free the space. rm removes the file. There is no undo, so be sure. Run df again, and the free space has grown by about four hundred and fifty megabytes. That's how to check disk space on Linux: df for the big picture, du to see what is using it, and find to track down large files. The full guide is at ssh command dot com, under disk commands. SSH Command is free for personal use. The link is in the description. Thanks for watching.
dfFree disk space
df [options]df -hSpace per disk in human-readable sizes
df -hT /One filesystem including its type
df -iInode usage (a disk can be "full" of tiny files)
duSpace used by folders
du [options] pathsudo du -sh /var/logTotal size of a folder
sudo du -h --max-depth=1 /var 2>/dev/nullSize of each sub-folder (2>/dev/null hides the errors for folders you cannot open)
du -ah . | sort -rh | head -20The twenty biggest items under here
lsblkList disks and partitions
lsblklsblkTree of disks and where they are mounted
lsblk -fAdd file system type and labels
blkidShow disk IDs
sudo blkidsudo blkidUUID and type of every partition
mountAttach a disk
sudo mount device foldermountList what is mounted
sudo mount /dev/sdb1 /mnt/dataMount a partition
sudo mount -o ro /dev/sdb1 /mnt/dataMount it read-only
umountDetach a disk
sudo umount foldersudo umount /mnt/dataSafely unmount
fdiskPartition a disk
sudo fdisk [-l] devicesudo fdisk -lList all disks and partitions
mkfsFormat a partition
sudo mkfs.type devicesudo mkfs.ext4 /dev/sdb1Create an ext4 file system (erases the partition)
fsckCheck a file system
sudo fsck devicesudo fsck /dev/sdb1Check and repair (the disk must be unmounted)
freeMemory use
free [-h]free -hRAM and swap in human-readable sizes
SSH Command is a desktop app for Mac, Windows and Linux that puts a real terminal, SFTP file panes, a sudo switch and a searchable Linux command finder in one window. Type what you want to do, and send the command to your server with one click.
Download free Windows commands with examples SFTP & FTP client