Skip to content

Linux Quick Reference Commands


The "Command Example" are intended to be used within the a Linux terminal or console.

Archive Management

Action Command Example
Compress gzip gzip -c file > foo.gz
Compress tar (directory) tar -cvf archive.tar /home/username
Compress tar/gzip tar -cvzf archive.tar.gz /home/foo/myfiles /home/foo/readme.txt
Compress tar/bzip2 tar -cvfj archive.tar.bz2 /home/php
Compress tar (list of files/dirs) tar -cvf archive.tar -I list_of_files_or_directories.txt
Compress tar/xz tar -cvJf archive.tar.xz /directory/containing/files/*
Compress tar/zstd tar -caf archive.tar.zst /directory/containing/files/*
Decompress zstd zstd -d archive.tar.zst
Decompress tar/zstd tar -I zstd -xvf archive.tar.zst
Decompress tar/zstd unzstd files.zst
Decompress gzip gunzip archive.gz
Decompress tar/bzip2 tar -xvf videos-14-09-12.tar.bz2
Decompress tar/gz tar -zxvf archive.tar.gz
Decompress tar, specific files only tar -xvf archive.tar '*.sql'
List archive contents tar/bzip2 tar -jtvf archive.tar.bz2

File Management

Action Command Example
Determine File Type file filename
Display file status stat filename

File Systems

Action Command Example
BTRFS Add Device btrfs device add /dev/sdc /mnt
BTRFS Balance Devices btrfs filesystem balance /mnt
BTRFS Change RAID Level btrfs balance start -mconvert=RAIDLEVEL -dconvert=RAIDLEVEL /path/to/mount
BTRFS Change Label btrfs filesystem label
BTRFS Show Devices btrfs filesystem show
BTRFS Scan Devices btrfs device scan
BTRFS Scrub Filesystem Start btrfs scrub status /dev/sde
BTRFS Scrub Filesystem Status btrfs scrub start /dev/sde
BTRFS Used/Free Space btrfs filesystem df -h /mnt/backup-data/
Action Command Example
Disk free space df -h
Disk Usage t=$(df
Disk Information di
Disk Partitions, list fdisk -l
Disk Partitioning, fdisk fdisk -H 224 -S 56 /dev/sdb1
Disk Partitioning, gdisk gdisk
Disk Image - Create dd if=/dev/sdb of=~/image.img
Disk Image - Write dd bs=4M if=~/image.img of=/dev/devicename

Schedule Job

Action Command Example
Crontab as another user edit crontab -u username -e
Crontab as another user list crontab -u username -l
Crontab as current user edit crontab -e
Crontab as current user list crontab -l

Last update: May 27, 2021