Look up common Linux commands and examples

Use your browser’s Find command or expand a section to locate an example. Review paths, privileges and destructive options before running commands on your own system.

Runs locally in your browser
Command Description
arch Machine hardware name reported by the kernel (the same value as uname -m)
uname -m Machine hardware name, for example x86_64
uname -r Release of the kernel that is running, for example 5.10.134-16.al8.x86_64
dmidecode -q DMI/SMBIOS hardware inventory (BIOS, mainboard, memory) without the unknown-entry notices (root only)
hdparm -i /dev/hda Identify an IDE or SATA disk: model, firmware, serial number and the modes it supports
hdparm -tT /dev/sda -T times reads served from cache and -t times reads from the device, which gives a raw throughput figure
cat /proc/cpuinfo CPU model, core count and feature flags exactly as the kernel exports them
cat /proc/interrupts Interrupt counters per CPU and per device, useful for spotting a busy controller
cat /proc/meminfo Kernel memory counters — the file that free reads
cat /proc/swaps Active swap areas with size, used space and priority
cat /proc/version Kernel version string, including the compiler used to build it
cat /proc/net/dev Byte, packet, error and drop counters for every network interface
cat /proc/mounts Every mounted file system together with its current mount options
lspci -tv PCI devices as a tree showing buses, bridges and the devices behind them
lsusb -tv USB devices as a tree with vendor and product IDs (package usbutils)
date Current date and time of the system clock
cal 2007 Calendar for a month or a whole year — here all of 2007
date 041217002007.00 Set the clock with MMDDhhmm[[CC]YY][.ss]: 17 December 2007, 00:20 (root only)
clock -w Write the system clock into the hardware clock so the time survives a power cut (hwclock -w, root only)

Command Description
shutdown -h now Power the machine off immediately (root only)
init 0 Switch to runlevel 0, which halts the system (root only)
telinit 0 Ask init for runlevel 0 over its control socket — the same halt (root only)
shutdown -h hours:minutes & Schedule the shutdown for a chosen time and return to the prompt
shutdown -c Cancel a shutdown that was scheduled earlier
shutdown -r now Restart the machine now (root only)
reboot Restart through init or systemd (root only)
logout Close the current login shell

Command Description
cd /home Change into an absolute directory
cd .. Move up one directory level
cd ../.. Move up two directory levels
cd Go to your home directory
cd ~user1 Go to another user's home directory
cd - Return to the directory you were in before
pwd Print the current working directory
ls List the entries of the current directory
ls -F List entries with a type marker: / directory, * executable, @ symbolic link
ls -l Long listing with permissions, owner, size and modification time
ls -a Include the entries that start with a dot, such as .bashrc
ls *[0-9]* List only the names that contain a digit; the shell expands the pattern
tree Directory tree of the current path; it ships in a separate package, so it is often missing
lstree Another name for the same tree listing; on most systems it is an alias
mkdir dir1 Create one directory
mkdir dir1 dir2 Create two directories in a single call
mkdir -p /tmp/dir1/dir2 Create the parent directories as needed and do not fail when the path already exists
rm -f file1 Delete a file and ignore a missing name instead of asking
rmdir dir1 Remove an empty directory
rm -rf dir1 Delete a directory with everything inside it, without any question
rm -rf dir1 dir2 Delete two whole trees in one call
mv dir1 new_dir Rename a directory, or move it when the target is another path
cp file1 file2 Copy one file
cp dir/* . Copy everything inside a directory into the current one
cp -a /tmp/dir1 . Archive copy that keeps permissions, ownership, links and timestamps
cp -a dir1 dir2 The same archival copy for a second tree
ln -s file1 lnk1 Create a symbolic link that stores a path
ln file1 lnk1 Create a hard link: a second name for the same inode
touch -t 0712250000 file1 Set the timestamp explicitly to 25 December 2007, 00:00, instead of now
iconv -l List every character encoding this iconv build knows
iconv -f fromEncoding -t toEncoding inputFile > outputFile Convert a file from one character encoding to another and write the result to a new file
find . -maxdepth 1 -name '*.jpg' -exec ls -l {} \; Show the JPEG files of this directory only and run a command on every hit

Command Description
find / -name file1 Search the whole file system for an exact file name
find / -user user1 Every file that belongs to one user
find /home/user1 -name \*.bin Name pattern with a wildcard, searched below one directory
find /usr/bin -type f -atime +100 Regular files last read more than 100 days ago
find /usr/bin -type f -mtime -10 Regular files changed within the last ten days
find / -name \*.rpm -exec chmod 755 '{}' \; Run a command on every match; {} stands for the matched path
find / -xdev -name \*.rpm Stay inside one file system so mounted media and network shares are skipped
locate \*.ps Look names up in the updatedb index: far faster than find, but only as fresh as the last database run
whereis halt Locate the binary, the source and the manual page of a command
which halt Show which executable the shell would run

Command Description
mount /dev/hda2 /mnt/hda2 Attach a partition to a directory of the file system tree (root only)
umount /dev/hda2 Detach the partition again; the mount point works as the argument too
fuser -km /mnt/hda2 Kill the processes still holding the mount point so it can be unmounted (root only)
umount -n /mnt/hda2 Unmount without writing the change to /etc/mtab
mount /dev/fd0 /mnt/floppy Mount the first floppy drive (legacy device name)
mount /dev/cdrom /mnt/cdrom Mount the optical drive behind the /dev/cdrom link
mount /dev/hdc /mnt/cdrecorder Mount the third device of the old hdX naming, typically a CD writer
mount /dev/hdb /mnt/cdrecorder The same for the second device on the first IDE channel
mount -o loop file.iso /mnt/cdrom Expose the contents of an ISO image as a directory
mount -t vfat /dev/hda5 /mnt/hda5 Mount a FAT partition with the vfat driver so Windows files stay readable
mount /dev/sda1 /mnt/usbdisk Mount the first partition of a USB disk
mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share Mount a Windows share; current kernels use -t cifs and a credentials file instead of smbfs

Command Description
df -h Free space of every file system in units a human can read
ls -lSr |more Files of this directory sorted by size, largest first, paged with more
du -sh dir1 Total disk space used by one directory
du -sk * | sort -rn Size of every entry in kilobytes, biggest first
rpm -q -a --qf '%10{SIZE}\t%{NAME}\n' | sort -k1,1n Installed RPM packages with their size in bytes, sorted by that column
dpkg-query -W -f='${Installed-Size;10}\t${Package}\n' | sort -k1,1n The same listing for Debian packages: installed size and package name

Command Description
groupadd group_name Create a group (root only)
groupdel group_name Delete a group (root only)
groupmod -n new_group_name old_group_name Rename a group (root only)
useradd -c "Name Surname " -g admin -d /home/user1 -s /bin/bash user1 Create an account with comment, primary group, home directory and login shell (root only)
useradd user1 Create an account with the defaults from /etc/default/useradd (root only)
userdel -r user1 Delete an account together with its home directory (root only)
usermod -c "User FTP" -g system -d /ftp/user1 -s /bin/nologin user1 Change comment, group, home and shell of an existing account (root only)
passwd Change your own password
passwd user1 Change the password of another account (root only)
chage -E 2030-12-31 user1 Give an account an expiry date, after which the login is refused (root only)
pwck Check /etc/passwd and /etc/shadow for inconsistent entries (root only)
grpck Check /etc/group and /etc/gshadow for the same kind of problems (root only)
newgrp group_name Start a new shell in which another group is the effective primary group

Command Description
ls -lh Long listing with file sizes in K, M and G
ls /tmp | pr -T5 -W$COLUMNS Print the listing in five columns fitted to the width of the terminal
chmod ugo+rwx directory1 Give owner, group and others read, write and execute rights on a directory
chmod go-rwx directory1 Take every right away from group and others
chown user1 file1 Change the owner of a file (root only)
chown -R user1 directory1 Change the owner of a directory and of everything below it (root only)
chgrp group1 file1 Change the group of a file
chown user1:group1 file1 Change owner and group in one call (root only)
find / -perm -u+s Find every setuid binary on the system
chmod u+s /bin/file1 Set the setuid bit so the file runs with the rights of its owner (root only)
chmod u-s /bin/file1 Remove the setuid bit again
chmod g+s /home/public Set the setgid bit: new entries below the directory inherit its group
chmod g-s /home/public Remove the setgid bit
chmod o+t /home/public Set the sticky bit so users may only delete their own files in a shared directory
chmod o-t /home/public Remove the sticky bit

Command Description
chattr +a file1 Append-only: the file may grow but cannot be rewritten or deleted (root only)
chattr +c file1 Store the file compressed on disk (ext4, root only)
chattr +d file1 Leave the file out of dump backups (root only)
chattr +i file1 Immutable: not even root can change or delete it until the flag is removed (root only)
chattr +s file1 Shred: overwrite the blocks with zeros when the file is deleted (root only)
chattr +S file1 Synchronous updates: every write goes to disk immediately (root only)
chattr +u file1 Undeletable: keep the contents so a deleted file can still be recovered (root only)
lsattr List the attribute flags of files; without an argument it walks the current directory

Command Description
bunzip2 file1.bz2 Decompress a bzip2 file and remove the compressed original
bzip2 file1 Compress a file with bzip2, replacing it with file1.bz2
gunzip file1.gz Decompress a gzip file
gzip file1 Compress a file, replacing it with file1.gz
gzip -9 file1 The same with maximum compression, at the cost of speed
rar a file1.rar test_file Add a file to a RAR archive (rar is shareware and absent from most distributions)
rar a file1.rar file1 file2 dir1 Add several files and a directory to the archive
rar x file1.rar Extract an archive and keep the stored directory structure
unrar x file1.rar The same extraction with the separate unrar tool
tar -cvf archive.tar file1 Create an uncompressed archive, printing each member as it is added
tar -cvf archive.tar file1 file2 dir1 The same archive with several members
tar -tf archive.tar List the members of an archive without extracting them
tar -xvf archive.tar Extract an archive into the current directory
tar -xvf archive.tar -C /tmp Extract into another directory; -C applies to everything that follows
tar -cvfj archive.tar.bz2 dir1 Create an archive compressed with bzip2 (-j)
tar -jxvf archive.tar.bz2 Extract a bzip2-compressed archive (-j)
tar -cvfz archive.tar.gz dir1 Create an archive compressed with gzip (-z)
tar -zxvf archive.tar.gz Extract a gzip-compressed archive
zip file1.zip file1 Put one file into a new ZIP archive
zip -r file1.zip file1 file2 dir1 Add two files and a directory, descending into it
unzip file1.zip Extract a ZIP archive into the current directory

Command Description
rpm -ivh package.rpm Install a package, showing a progress bar and the file names
rpm -ivh --nodeps package.rpm Install without resolving dependencies first, which is rarely what you want
rpm -U package.rpm Upgrade a package, or install it when no older version is present
rpm -F package.rpm Refresh: upgrade only when an older version is already installed
rpm -e package_name Erase an installed package; the argument is the package name, not the file
rpm -qa List every installed package with its name, version and release
rpm -qa | grep httpd Filter the installed RPM list for one package name
rpm -qi package_name Detailed information about an installed package
rpm -qg "System Environment/Daemons" Every package that belongs to one group
rpm -ql package_name Files owned by a package
rpm -qc package_name Only the configuration files of a package
rpm -q package_name --whatrequires Packages that depend on this capability
rpm -q package_name --whatprovides Capabilities this package provides
rpm -q package_name --scripts Install and uninstall scriptlets of the package
rpm -q package_name --changelog Change history recorded in the package metadata
rpm -qf /etc/httpd/conf/httpd.conf Which package owns a given file
rpm -qp package.rpm -l Files inside a package file that is not installed
rpm --import /media/cdrom/RPM-GPG-KEY Add a signing key to the RPM database so packages can be verified
rpm --checksig package.rpm Verify the signature and checksum of a package file
rpm -qa gpg-pubkey List the keys currently stored in the RPM database
rpm -V package_name Compare an installed package with its metadata: size, digest, permissions
rpm -Va Verify every installed package; slow, and it prints every difference it finds
rpm -Vp package.rpm Verify a package file instead of an installed package
rpm2cpio package.rpm | cpio --extract --make-directories \*bin\* Unpack an RPM without installing it, taking only the paths that match *bin*
rpm -ivh /usr/src/redhat/RPMS/`arch`/package.rpm Install from a build tree, with the architecture filled in by arch
rpmbuild --rebuild package_name.src.rpm Build a binary RPM from a source RPM

Command Description
yum install package_name Install a package from the repositories together with its dependencies
yum localinstall package_name.rpm Install a local RPM file and fetch its dependencies from the repositories
yum update package_name.rpm Update a package from a local file
yum update package_name Update one installed package to the newest version
yum remove package_name Remove a package and the packages that depend on it
yum list List installed and available packages
yum search package_name Search the repositories for a name or keyword
yum clean packages Delete the downloaded package files from the cache
yum clean headers Delete the cached repository metadata headers
yum clean all Empty the whole cache, metadata included

Command Description
dpkg -i package.deb Install a .deb file without consulting the repositories
dpkg -r package_name Remove an installed package but keep its configuration files in place
dpkg -l List installed packages with their versions
dpkg -l | grep httpd Filter the installed Debian package list for one package name
dpkg -s package_name Status and metadata of one installed package
dpkg -L package_name Files that a package installed
dpkg --contents package.deb Files inside a .deb file that is not installed
dpkg -S /bin/ping Which package installed a given path

Command Description
apt-get install package_name Install a package from the Debian repositories with its dependencies
apt-cdrom add Register a CD or DVD as a package source, then install from it
apt-get update Refresh the package index from every configured source
apt-get upgrade Install the available upgrades without removing anything
apt-get remove package_name Remove a package from the Debian repositories but leave its configuration files
apt-get check Verify that the package database is consistent
apt-get clean Delete the downloaded .deb files from /var/cache/apt
apt-cache search searched-package Search the package index by name or description

Command Description
cat file1 Print a whole file to standard output
tac file1 Print the file with the order of its lines reversed
more file1 Page through a file forwards only
less file1 Page through a file in both directions and search inside it
head -2 file1 First two lines of a file; the default is ten
tail -2 file1 Last two lines of a file
tail -f /var/log/messages Follow a growing log and print new lines as they are written

Command Description
cat file1 | sed 's/old/new/g' > result.txt Pipe a file through another program and write the result to a new file
cat file1 | sed 's/old/new/g' >> result.txt The same, appending the result instead of replacing the file
grep Aug /var/log/messages Lines that contain the text
grep ^Aug /var/log/messages Lines that start with the text, anchored at the beginning
grep [0-9] /var/log/messages Lines that contain at least one digit
grep Aug -R /var/log/* Search the text recursively below the given paths
sed 's/string1/string2/g' example.txt Replace every occurrence of one string with another
sed '/^$/d' example.txt Delete the empty lines
sed '/ *#/d; /^$/d' example.txt Delete comment lines and the empty lines left behind
echo 'example' | tr '[:lower:]' '[:upper:]' Convert text to upper case through the tr character classes
sed -e '1d' result.txt Delete the first line and print the rest
sed -n '/string1/p' example.txt Print only the matching lines; -n suppresses the default output
sed -e 's/ *$//' example.txt Strip the trailing spaces of every line
sed -e 's/string1//g' example.txt Delete every occurrence of a word and keep the rest of the line
sed -n '1,5p;5q' example.txt Print the first five lines and stop reading at line 5
sed -n '5p;5q' example.txt Print line 5 alone and quit
sed -e 's/00*/0/g' example.txt Collapse runs of zeros into a single zero
cat -n file1 Number every line while printing it
cat example.txt | awk 'NR%2==1' Print the odd-numbered lines
echo a b c | awk '{print $1}' Print the first whitespace-separated field
echo a b c | awk '{print $1,$3}' Print the first and the third field
paste file1 file2 Join two files line by line, separated by a tab
paste -d '+' file1 file2 The same with + as the separator
sort file1 file2 Sort the two files together in ascending order
sort file1 file2 | uniq Drop the duplicated adjacent lines; the input has to be sorted first
sort file1 file2 | uniq -u Print only the lines that occur exactly once
sort file1 file2 | uniq -d Print only the lines that occur more than once
comm -1 file1 file2 Hide the lines found only in file1 and keep the other two columns
comm -2 file1 file2 Hide the lines found only in file2
comm -3 file1 file2 Print only the lines that differ between the two files

Command Description
dos2unix filedos.txt fileunix.txt Convert CRLF line endings to LF and write a new file
unix2dos fileunix.txt filedos.txt Convert LF line endings to CRLF
recode ..HTML < page.txt > page.html Convert plain text into HTML entities with the recode charset pairs
recode -l | more List the charsets and conversions this recode build supports

Command Description
badblocks -v /dev/hda1 Read every block of the partition and report the ones that fail, with progress output
fsck /dev/hda1 Check the file system by type; the partition must not be mounted
fsck.ext2 /dev/hda1 Run the ext2 checker directly instead of going through fsck
e2fsck /dev/hda1 Check an ext2, ext3 or ext4 file system
e2fsck -p /dev/hda1 Repair automatically everything that can be fixed without a question (preen)
fsck.ext3 /dev/hda1 The ext3 variant of the same checker
fsck.vfat /dev/hda1 Check a FAT file system with the dosfstools checker
fsck.msdos /dev/hda1 Another name for the MS-DOS FAT checker
dosfsck /dev/hda1 Repair a FAT file system; -a answers yes to every question

Command Description
mkfs /dev/hda1 Create a file system on a partition, destroying what was there
mke2fs /dev/hda1 Create an ext2 file system
mke2fs -j /dev/hda1 Create an ext3 file system by adding a journal
mkfs -t vfat -F 32 /dev/hda1 Create a FAT32 file system with the dosfstools helper
fdformat -n /dev/fd0 Low-level format of a floppy disk, skipping the verification pass
mkswap /dev/hda3 Prepare a partition as a swap area

Command Description
mkswap /dev/hda3 Prepare a partition as a swap area
swapon /dev/hda3 Start using one swap partition
swapon /dev/hda2 /dev/hdb3 Enable two swap areas in one call

Command Description
dump -0aj -f /tmp/home0.bak /home Full (level 0) dump of /home into a compressed archive file
dump -1aj -f /tmp/home0.bak /home Incremental dump: only what changed since the level-0 run
restore -if /tmp/home0.bak Walk through a dump interactively and pick the files to restore
rsync -rogpav --delete /home /tmp Mirror a tree into /tmp keeping links, owners, groups, permissions and times; --delete removes files that disappeared
rsync -rogpav -e ssh --delete /home ip_address:/tmp The same mirror over an SSH connection
rsync -az -e ssh --delete ip_addr:/home/public /home/local Pull a remote tree, compressed while it travels
rsync -az -e ssh --delete /home/local ip_addr:/home/public Push a local tree to the remote host
dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr 'dd of=hda.gz' Copy a whole disk through gzip and SSH, one megabyte at a time
dd if=/dev/sda of=/tmp/file1 Copy a disk into a file on another file system
tar -Puf backup.tar /home/user Append to an existing archive and keep the leading slash of the path
( cd /tmp/local/ && tar c . ) | ssh -C user@ip_addr 'cd /home/share/ && tar x -p' Copy a tree to a remote host through a pipe; -p restores the permissions
( tar c /home ) | ssh -C user@ip_addr 'cd /home/backup-home && tar x -p' The same copy starting from an absolute path
tar cf - . | (cd /tmp/backup ; tar xf - ) Copy the current tree into another directory on the same machine
find /home/user1 -name '*.txt' | xargs cp -av --target-directory=/home/backup/ --parents Copy a list of files and rebuild their directory structure at the target
find /var/log -name '*.log' | tar cv --files-from=- | bzip2 > log.tar.bz2 Archive the files found by find and compress the stream on the fly
dd if=/dev/hda of=/dev/fd0 bs=512 count=1 Copy the master boot record, 512 bytes at a time
dd if=/dev/fd0 of=/dev/hda bs=512 count=1 Write that record back; with the wrong target a disk is destroyed

Command Description
cdrecord -v gracetime=2 dev=/dev/cdrom -eject blank=fast -force Erase a rewritable disc in the burner and eject it (cdrecord from cdrtools)
dd if=/dev/cdrom of=cd.iso Copy an optical disc into an ISO image file
dd if=/dev/cdrom | gzip > cd_iso.gz The same image, compressed while it is written
mkisofs -J -allow-leading-dots -R -V "Label CD" -iso-level 4 -o ./cd.iso data_cd Build an ISO image from a directory, with Joliet and Rock Ridge names
cdrecord -v dev=/dev/cdrom cd.iso Burn an ISO image onto the disc
gzip -dc cd_iso.gz | cdrecord dev=/dev/cdrom - Burn a compressed image straight from the pipe
mount -o loop cd.iso /mnt/iso Read the image back as a directory
cd-paranoia -B Rip the audio tracks of a CD into WAV files
cd-paranoia -- "-3" Rip track 3; the -- keeps the leading dash from being read as an option
cdrecord --scanbus List the SCSI/ATA addresses the burner can reach
dd if=/dev/hdc | md5sum Checksum the raw contents of an optical drive

Command Description
dhclient eth0 Ask a DHCP server for an address and a lease for the interface (root only)
ethtool eth0 Link speed, duplex mode and driver details of a network interface
host www.example.com Resolve a name to addresses with the BIND host utility
hostname Print the name of this machine
ifconfig eth0 Address, netmask and counters of one interface (net-tools, deprecated in favour of ip)
ifconfig eth0 192.168.1.1 netmask 255.255.255.0 Set a static address that lasts until the next reboot (root only)
ifconfig eth0 promisc Put the interface into promiscuous mode so it keeps every frame it sees (root only)
ifdown eth0 Take an interface down through the ifupdown scripts (root only)
ifup eth0 Bring it up again and apply the configuration from /etc/network/interfaces (root only)
ip link show State of every network device; the modern replacement for ifconfig
iwconfig eth1 Wireless settings of an interface: ESSID, mode and frequency (wireless-tools)
iwlist scan List the access points the wireless card can see (root only)
mii-tool eth0 Link status of a wired interface as the driver reports it
netstat -tup Active TCP and UDP connections with the process that owns each socket
netstat -tulp Only the sockets that wait for connections, with the owning process
netstat -rn Kernel routing table with numeric addresses and no name lookups
nslookup www.example.com Query a name server for a name or an address; dig is the modern replacement
route -n Routing table without name resolution (net-tools)
route add default gw 192.168.1.1 Set the default gateway until the next boot (root only)
route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1 Add a static route to a network (root only)
route del default gw 192.168.1.1 Remove that default route again (root only)
echo 1 > /proc/sys/net/ipv4/ip_forward Turn on IPv4 forwarding so the machine may route between interfaces (root only)
tcpdump tcp port 80 Capture HTTP traffic on the wire (root only)
whois www.example.com Registration data of a domain from the WHOIS database

Command Description
mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share Mount a Windows share; current kernels use -t cifs and a credentials file instead of smbfs
nbtscan 192.168.1.0/24 Scan a subnet for NetBIOS names and the machines behind them
nmblookup -A 192.168.1.10 Ask one host for its NetBIOS names; Samba's answer to nbtstat
smbclient -L 192.168.1.10 List the shares a Windows host offers
smbget -Rr smb://192.168.1.10/share Download a share recursively with Samba's wget-style client

Command Description
iptables -t filter -L List the rules of the filter table
iptables -t nat -L List the rules of the nat table, which handles address translation
iptables -t filter -F Delete every rule in the filter table
iptables -t nat -F Delete every rule in the nat table
iptables -t filter -X Delete the user-defined chains that are no longer referenced
iptables -t filter -A INPUT -p tcp --dport telnet -j ACCEPT Append a rule that accepts incoming Telnet on port 23
iptables -t filter -A OUTPUT -p tcp --dport telnet -j DROP Drop outgoing Telnet traffic
iptables -t filter -A FORWARD -p tcp --dport pop3 -j ACCEPT Let forwarded POP3 traffic through
iptables -t filter -A INPUT -j LOG --log-prefix "INPUT: " Log every incoming packet with a prefix you can grep for
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE Rewrite the source address of outgoing packets, which is how a simple NAT gateway works
iptables -t nat -A POSTROUTING -d 192.168.0.1 -p tcp -m tcp --dport 22 -j DNAT --to-destination 10.0.0.2:22 Send SSH to an internal host by rewriting the destination address

Command Description
free -m Memory and swap usage in mebibytes
kill -9 1234 SIGKILL: the process ends at once and cannot clean up (1234 stands for the PID)
kill -1 1234 SIGHUP: most daemons re-read their configuration (1234 stands for the PID)
last reboot Login history filtered to reboots, so it shows when the machine restarted
lsmod List the kernel modules that are currently loaded
lsof -p 1234 Every file, socket and device one process has open
lsof /home/user1 Which processes have files open below a path
ps -eafw Every process with its full command line in a wide listing
ps -e -o pid,args --forest Process tree showing only the PID and the command
pstress Stress-test utility for PostgreSQL; it is not part of a standard distribution
smartctl -A /dev/hda S.M.A.R.T. attributes of a disk, where reallocated sectors hint at a failing drive
smartctl -i /dev/hda Model, firmware, serial number and health status of a disk
strace -c ls >/dev/null Count the system calls a command makes and print a summary
strace -f -e open ls >/dev/null Trace the open() calls of a command and of the child processes it starts
tail /var/log/dmesg Last lines of the kernel ring buffer log
tail /var/log/messages Last lines of the general system log
top Live list of processes sorted by CPU use, refreshed as you watch
watch -n 1 'cat /proc/interrupts' Run a command every second and keep its output on the screen

Command Description
alias hh='history' Give a command a short name inside the current shell
apropos keyword Search the manual page names and descriptions for a keyword
chsh Change your login shell interactively
chsh --list-shells Print the shells listed in /etc/shells
gpg -c file1 Encrypt a file with a passphrase into file1.gpg, using a symmetric cipher
gpg file1.gpg Decrypt that file again and ask for the passphrase

How to use the command tables

This page gathers 347 command examples in 27 collapsible groups, from system information and files to networking, packages, backups and optical media. Press Ctrl / Cmd + F or click a group heading to fold the part you need; the command cell keeps the shell syntax you would actually type, and the note beside it says what that utility or that option does.

The notes were written from each utility's own manual page, so they describe the tool instead of repeating one generic sentence: uname -r prints the kernel release, e2fsck -p repairs what can be fixed without a question, and iptables -t nat -F empties the address-translation table. VoriTools never runs any of these commands — the page is a static document, so reading it cannot change your system.

  1. Find the group you need: system and hardware information, files and directories, file search, mounting, disk usage, users and groups, permissions, extended attributes, archives, RPM / YUM / Debian / APT packages, viewing file contents, text processing, character encodings, file-system checks, creating file systems, swap, backup and restore, optical media, Ethernet and Wi-Fi, SMB, iptables, monitoring and diagnostics, and other utilities.
  2. Click a group heading to collapse or expand it, or use Ctrl / Cmd + F to jump straight to a command such as tar -xvf or to a word inside a note.
  3. Read the note before you copy. It names the option the example relies on (-j for bzip2, -C to extract somewhere else, -perm to search for setuid files) and marks the rows that need root.
  4. Check the paths, device names and distribution assumptions of the example. /dev/hda and /dev/hdc come from the old IDE naming, so a modern system expects /dev/sda or /dev/sr0; yum is redirected to dnf on RHEL 8 and later, and ifconfig, route and netstat belong to net-tools, which ip, ss and ip route have replaced.
  5. Then run the command in your own shell, where you can watch what it does. Nothing here is executed for you, and no request leaves the browser while you read.

What the notes say, and what this page does not do

How each row is written

The command cell holds an example that works: mkdir -p /tmp/dir1/dir2 creates the parent directories and does not fail when the path already exists; tar -xvf archive.tar -C /tmp extracts into another directory because -C applies to everything after it; find / -xdev -name \*.rpm stays inside one file system. Where the original list had a typo or an option that cannot work — iptables -t nae, e2fsck -j, gpg -c filel, mkisofs /dev/cdrom, netstat -tup1, /proc/sys/net/ipv4/ip_foward — the example was corrected and the note describes the corrected form.

What was verified, and how

Every utility named on this page was checked on the Linux server that also runs VoriTools (Alibaba Cloud Linux 3): command -v for the binary, man -w for the manual page. 106 of the 141 utilities have a manual page there and the notes follow the wording of its NAME line and option list. 32 are not installed at all (apt-get, dpkg, rar, smartctl, tree, whois, rsync, smbclient and others), so their notes describe the upstream tool rather than a local run.

The options shown are examples, not the complete list. Add --help or open the manual page for the rest.

Rows that touch data

Rows such as rm -rf dir1, dd if=/dev/fd0 of=/dev/hda, mkfs /dev/hda1, iptables -F and shutdown -h now are documented, never executed here. The note marks the ones that need root, and the same care you would take at a terminal applies: confirm the device, the path and the target host first. A wrong device name in dd or mkfs destroys data with no undo.

Recent tools: