System Commands

uname

Print system information (kernel, architecture, etc.).

uname Kernel name (same as uname -s).
uname -r Kernel release (version string).
uname -a All available info (kernel, node, release, build, arch).
uname -m Machine hardware name (e.g., x86_64, aarch64).

uptime

Show how long the system has been running and the load averages.

uptime Classic output with current time, up time, users, load.
uptime -p Pretty format (e.g., 'up 3 hours, 12 minutes').
uptime -s System boot time (timestamp).

hostname

Display or set the system’s host name.

hostname Print current host name.
hostname -I Show all assigned IP addresses (space-separated).
hostnamectl Show host metadata (Static/Pretty name, chassis, etc.).
sudo hostnamectl set-hostname myhost Set persistent host name (requires sudo).

last reboot

List reboot history using the wtmp log.

last reboot Show each reboot event and its time range.
last -x | grep reboot Include system runlevel changes, then filter reboots.
who -b Alternative: show last boot time only.

date

Print or set the system date and time.

date Current local date/time.
date -u Current time in UTC.
date +"%Y-%m-%d %H:%M:%S" Custom format (YYYY-MM-DD HH:MM:SS).
sudo date -s "2025-08-28 12:00:00" Set date/time (requires sudo; use with care).

timedatectl

Control and query system clock/timezone (systemd-based distros).

timedatectl status Show local time, UTC, RTC, NTP, timezone.
timedatectl list-timezones List valid timezones.
sudo timedatectl set-timezone Europe/Berlin Change timezone (requires sudo).
timedatectl timesync-status Show network time sync (if available).

cal

Display a calendar.

cal Current month calendar.
cal -y Whole year calendar.
cal 9 2025 Specific month and year (September 2025).
ncal -w Alternative layout; show ISO week numbers.

w

Show who is logged in and what they’re doing; includes load and uptime.

w Standard multi-line session summary.
w -h Hide header (useful for scripts).
w -s Shorter format without login/idle times.

whoami

Print the effective username of the current user.

whoami Just the username; handy in scripts/prompts.

finger

User information lookup (may need the 'finger' package installed).

finger List logged-in users with details.
finger username Show info for a specific user (gecos, shell, last login).

Hardware Commands

dmesg

Print or control the kernel ring buffer (boot and hardware messages).

dmesg | less View full kernel log with paging.
dmesg -T Show timestamps in human-readable form.
dmesg | grep usb Filter messages for USB devices.

cat

Concatenate and print files. Often used to read system info in /proc or /sys.

cat /proc/cpuinfo Detailed CPU information.
cat /proc/meminfo Detailed memory statistics.
cat /etc/os-release Distribution details.

lshw

List hardware information (requires root for full details).

sudo lshw Full hardware summary.
sudo lshw -short Compact summary of hardware.
sudo lshw -C disk Show only storage devices.

lsblk

List block devices (disks, partitions, mount points).

lsblk Tree view of devices and mounts.
lsblk -f Include filesystem info (UUID, type).
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT Custom output columns.

free

Display memory usage statistics.

free -h Human-readable output (MB/GB).
free -m Values in MB.
watch -n1 free -h Refresh memory usage every second.

lspci

List PCI devices (graphics, network, etc.).

lspci Basic list of PCI devices.
lspci -v Verbose details.
lspci -nnk | grep -A3 VGA Show GPU and kernel driver in use.

lsusb

List USB devices connected to the system.

lsusb Basic list of USB devices.
lsusb -v Verbose info (needs sudo for full details).
lsusb -t Tree view of USB hierarchy.

dmidecode

Dump hardware info from the system BIOS (requires root).

sudo dmidecode Full dump of BIOS and hardware tables.
sudo dmidecode -t memory Details about system RAM modules.
sudo dmidecode -t system System vendor, product name, serial number.

User Commands

id

Print user identity (UID, GID, groups).

id Show UID, primary GID, and groups for current user.
id username Show UID/GID/groups for another user.

who

Show who is currently logged in.

who List logged in users and their terminals.
who -b Show last system boot time.

last

Show login history (from /var/log/wtmp).

last Full login/logout history of users.
last username History for a specific user.
last -x Include system shutdown/reboot records.

groups

Show groups a user belongs to.

groups Show groups for current user.
groups username Show groups for another user.

getent passwd

Query the system user database (passwd file or NSS).

getent passwd List all users.
getent passwd username Show entry for a specific user.

getent group

Query the system group database.

getent group List all groups.
getent group admin Show entry for a specific group.

adduser / useradd

Create a new user account (implementation varies by distro).

sudo adduser newuser Debian/Ubuntu style (interactive, sets password).
sudo useradd -m newuser RedHat style (create with home directory).

usermod

Modify an existing user account.

sudo usermod -aG admin username Add user to group 'admin' (append mode).
sudo usermod -s /bin/zsh username Change user’s login shell.

userdel

Delete a user account.

sudo userdel username Remove user but keep home directory.
sudo userdel -r username Remove user and delete home directory.

groupadd / groupdel

Add or remove groups.

sudo groupadd admin Create a new group named 'admin'.
sudo groupdel admin Delete the group 'admin'.

gpasswd

Administer /etc/group (set or change group membership).

sudo gpasswd -a username group Add user to a group.
sudo gpasswd -d username group Remove user from a group.

File & Folder Commands

ls

List directory contents.

ls -l Long format (permissions, owner, size, date).
ls -a Show hidden files (dotfiles).
ls -lh Human-readable sizes.

pwd

Print current working directory.

pwd Show absolute path of current directory.

mkdir

Create directories.

mkdir mydir Create a single directory.
mkdir -p parent/child Create parent and child directories recursively.

rm

Remove files or directories.

rm file Delete a file.
rm -r dir Delete a directory and its contents.
rm -rf dir Force remove directory (dangerous!).

cp

Copy files or directories.

cp file1 file2 Copy file1 to file2.
cp -r dir1 dir2 Copy directory recursively.

mv

Move or rename files/directories.

mv old new Rename file or directory.
mv file dir/ Move file into directory.

touch

Create empty files or update timestamps.

touch newfile Create an empty file.
touch -m file Update modification time.

cat / more / less

View file contents.

cat file Dump file contents to terminal.
more file Page through file (space to scroll).
less file Like more, but with better navigation.

head / tail

View the beginning or end of a file.

head -n 20 file First 20 lines.
tail -n 50 file Last 50 lines.
tail -f logfile Follow live appending log file.

xargs

Build and execute command lines from input.

cat list.txt | xargs rm Remove files listed in list.txt.
find . -name '*.log' | xargs gzip Compress all .log files.

Search Commands

find

Search for files and directories.

find . -name 'file.txt' Find file in current directory (recursive).
find /path -type f -name '*.log' Find all .log files under /path.
find /var -size +100M Find files larger than 100 MB.
find /home -mtime -7 Find files modified in the last 7 days.
find . -name '*.txt' -exec grep -H 'pattern' {} \; Find .txt files containing 'pattern'.

locate

Find files using prebuilt database (faster than find).

locate filename Search for file by name.
updatedb Update database (requires sudo).

grep

Search inside files by text patterns.

grep 'pattern' file Search for text in file.
grep -r 'pattern' dir/ Search recursively in directory.
grep -i 'pattern' file Case-insensitive search.
grep -n 'pattern' file Show matching line numbers.

Process Commands

ps

Report processes.

ps aux Show all processes with user, CPU, mem, etc.
ps -u username Show processes for a specific user.
ps -ef | grep nginx Find a process by name.

top / htop

Monitor running processes.

top Dynamic view of processes.
htop Improved top (color, interactive).

kill

Send a signal to a process (default: TERM).

kill 1234 Terminate process with PID 1234.
kill -9 1234 Force kill process (SIGKILL).
pkill nginx Kill all processes named nginx.

uptime / load

Show system load and uptime.

uptime Load averages and uptime.

pgrep

List process IDs by name.

pgrep sshd Find PID of sshd.
pgrep -u user Processes owned by a user.

Disk Commands

df

Report filesystem disk space usage.

df -h Human-readable disk usage.
df -i Show inode usage.

du

Estimate file and directory space usage.

du -sh * Sizes of folders/files in current directory.
du -ch Summarize and show total.

fdisk

Partition table manipulator (requires root).

sudo fdisk -l List all partitions.
sudo fdisk /dev/sda Edit partitions on disk sda.

findmnt

Find mounted filesystems.

findmnt List all mount points in a tree.
findmnt /home Show what /home is mounted on.

mount / umount

Mount or unmount filesystems.

mount Show currently mounted filesystems.
sudo mount /dev/sdb1 /mnt Mount a device to a path.
sudo umount /mnt Unmount from path.

Archiving Commands

tar

Archive files.

tar -cvf archive.tar files/ Create archive from files/.
tar -xvf archive.tar Extract archive.
tar -tvf archive.tar List contents.
tar -czvf archive.tar.gz files/ Create gzip-compressed tar.
tar -xvzf archive.tar.gz Extract gzip-compressed tar.

gzip / gunzip

Compress/decompress files.

gzip file Compress file (produces file.gz).
gunzip file.gz Decompress .gz file.

zip / unzip

Create and extract .zip archives.

zip archive.zip file1 file2 Zip multiple files.
unzip archive.zip Extract zip archive.

xz / unxz

Compress with high ratio.

xz file Compress file to file.xz.
unxz file.xz Decompress file.

Notes: Some commands vary by distro; options shown are the most common on GNU/Linux. Commands that change system settings (e.g., hostnamectl set-hostname, timedatectl set-timezone, date -s) require appropriate privileges.