Command code Comment
arch Show the machine's processor architecture (1)
uname -m Show the machine's processor architecture (2)
uname -r Show the kernel version in use
dmidecode -q Show hardware system components - (SMBIOS / DMI)
hdparm -i /dev/hda List disk architecture features
hdparm -tT /dev/sda Perform a test read operation on the disk
cat /proc/cpuinfo Show CPU info
cat /proc/interrupts Display interrupt
cat /proc/meminfo Check memory usage
cat /proc/swaps Show which swap is in use
cat /proc/version Show the kernel version
cat /proc/net/dev Display network adapters and statistics
cat /proc/mounts Display loaded filesystems
lspci -tv List PCI devices
lsusb -tv Display USB devices
date Show system date
cal 2007 Show the 2007 calendar
date 041217002007.00 Set date and time - month day hour minute year.seconds
clock -w Save time changes to BIOS

Command code Comment
shutdown -h now Shut down the system
init 0 Shut down the system
telinit 0 Shut down the system
shutdown -h hours:minutes & Shut down the system at the scheduled time
shutdown -c Cancel scheduled system shutdown
shutdown -r now Restart
reboot Restart
logout Log out

Command code Comment
cd /home Enter the '/ home' directory
cd .. Go up one directory
cd ../.. Go up two directories
cd Go to the personal home directory
cd ~user1 Go to the personal home directory
cd - Return the last directory
pwd Show working directory
ls List the files in a directory
ls -F List the files in a directory
ls -l Show detailed information for files and directories
ls -a Show hidden files
ls *[0-9]* Show file and directory names containing digits
tree Display files and directories in a tree structure starting from the root directory
lstree Display files and directories in a tree structure starting from the root directory
mkdir dir1 Create a directory called 'dir1'
mkdir dir1 dir2 Create two directories at once
mkdir -p /tmp/dir1/dir2 Create a directory tree
rm -f file1 Delete a file called 'file1'
rmdir dir1 Delete a directory called 'dir1'
rm -rf dir1 Delete the directory named 'dir1' and its contents at the same time
rm -rf dir1 dir2 Delete two directories and their contents at once
mv dir1 new_dir Rename/move a directory
cp file1 file2 Copy a file
cp dir/* . Copy all files under a directory to the current working directory
cp -a /tmp/dir1 . Copy a directory to the current working directory
cp -a dir1 dir2 Copy a directory
ln -s file1 lnk1 Create a symbolic link to a file or directory
ln file1 lnk1 Create a physical link to a file or directory
touch -t 0712250000 file1 Change the timestamp of a file or directory - (YYMMDDhhmm)
iconv -l List known encodings
iconv -f fromEncoding -t toEncoding inputFile > outputFile Change character encoding
find . -maxdepth 1 -name *.jpg -print -exec convert Batch resize files in the current directory and send them to the thumbnail directory (requires conversion from ImageMagick)

Command code Comment
find / -name file1 Search files and directories starting from '/' into the root file system
find / -user user1 Search for files and directories owned by user 'user1'
find /home/user1 -name \*.bin Search for files ending with '.bin' in the directory '/ home/user1'
find /usr/bin -type f -atime +100 Search for executables not used in the past 100 days
find /usr/bin -type f -mtime -10 Search files created or modified within 10 days
find / -name \*.rpm -exec chmod 755 '{}' \; Search for files ending in '.rpm' and set their permissions
find / -xdev -name \*.rpm Search for files ending with '.rpm', ignoring removable devices such as optical and zip drives
locate \*.ps Find files ending with '.ps' - run the 'updatedb' command first
whereis halt Show the location of a binary, source code or man page
which halt Show the full path of a binary or executable file

Command code Comment
mount /dev/hda2 /mnt/hda2 Mount a disk called hda2 - make sure the directory '/ mnt/hda2' already exists
umount /dev/hda2 Unmount a disk called hda2 - exit the mount point '/ mnt/hda2' first
fuser -km /mnt/hda2 Force unmount when device is busy
umount -n /mnt/hda2 Perform the unmount without writing the /etc/mtab file - useful when the file is read-only or the disk is full
mount /dev/fd0 /mnt/floppy Mount a floppy disk
mount /dev/cdrom /mnt/cdrom Mount a cdrom or dvdrom
mount /dev/hdc /mnt/cdrecorder Mount a cdrw or dvdrom
mount /dev/hdb /mnt/cdrecorder Mount a cdrw or dvdrom
mount -o loop file.iso /mnt/cdrom Mount a file or ISO image file
mount -t vfat /dev/hda5 /mnt/hda5 Mount a Windows FAT32 file system
mount /dev/sda1 /mnt/usbdisk Mount a USB flash drive or memory device
mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share Mount a windows network share

Command code Comment
df -h List mounted partitions
ls -lSr |more Sort files and directories by size
du -sh dir1 Estimate the disk space used by the 'dir1' directory
du -sk * | sort -rn Show the size of files and directories in order of capacity
rpm -q -a --qf '%10{SIZE}t%{NAME}n' | sort -k1,1n List installed rpm packages by the space they use (fedora, redhat-like systems)
dpkg-query -W -f='${Installed-Size;10}t${Package}n' | sort -k1,1n List installed deb packages by the space they use (ubuntu, debian-like systems)

Command code Comment
groupadd group_name Create a new user group
groupdel group_name Delete a user group
groupmod -n new_group_name old_group_name Rename a user group
useradd -c "Name Surname " -g admin -d /home/user1 -s /bin/bash user1 Create a user belonging to the "admin" user group
useradd user1 Create a new user
userdel -r user1 Delete a user ('-r' to exclude the home directory)
usermod -c "User FTP" -g system -d /ftp/user1 -s /bin/nologin user1 Modify user properties
passwd Change password
passwd user1 Change a user's password (only root can run it)
chage -E 2020-12-31 user1 Set password expiration period
pwck Check the file format and syntax of '/etc/passwd' and fix errors in the existing users
grpck Check the file format and syntax of '/etc/passwd' and fix errors in the existing groups
newgrp group_name Log in to a new group to change the default group for newly created files

Command code Comment
ls -lh Display permissions
ls /tmp | pr -T5 -W$COLUMNS Split terminal into 5 columns
chmod ugo+rwx directory1 Set read (r), write (w) and execute (x) permissions for the directory's owner (u), group (g) and others (o)
chmod go-rwx directory1 Remove read, write and execute permissions for the group (g) and others (o) on a directory
chown user1 file1 Change a file's ownership attribute
chown -R user1 directory1 Change the owner of a directory and of all the files under it at the same time
chgrp group1 file1 Change file group
chown user1:group1 file1 Change a file's owner and group
find / -perm -u+s List all files on a system that use SUID
chmod u+s /bin/file1 Set the SUID bit on a binary file - users running the file are also granted the owner's permissions
chmod u-s /bin/file1 Disable the SUID bit of a binary file
chmod g+s /home/public Set the SGID bit on a directory - like SUID, but for directories
chmod g-s /home/public Disable the SGID bit of a directory
chmod o+t /home/public Set the STIKY bit on a file - only the rightful owner may delete it
chmod o-t /home/public Disable the STIKY bit of a directory

Command code Comment
chattr +a file1 Allow reading and writing files only in append mode
chattr +c file1 Allow this file to be compressed/uncompressed automatically by the kernel
chattr +d file1 During a file system backup, the dump program will ignore this file
chattr +i file1 Set a file as immutable: it cannot be deleted, modified, renamed or linked
chattr +s file1 Allow a file to be securely deleted
chattr +S file1 Makes the system write the modifications to disk immediately once an application writes to the file
chattr +u file1 If the file is deleted, the system will allow you to recover it later
lsattr Show special properties

Command code Comment
bunzip2 file1.bz2 Extract a file named 'file1.bz2'
bzip2 file1 Compress a file called 'file1'
gunzip file1.gz Extract a file named 'file1.gz'
gzip file1 Compress a file named 'file1'
gzip -9 file1 Maximum compression
rar a file1.rar test_file Create a package named 'file1.rar'
rar a file1.rar file1 file2 dir1 Compress 'file1', 'file2' and the directory 'dir1' at the same time
rar x file1.rar Extract a rar package
unrar x file1.rar Extract a rar package
tar -cvf archive.tar file1 Create an uncompressed tarball
tar -cvf archive.tar file1 file2 dir1 Create an archive file containing 'file1', 'file2' and 'dir1'
tar -tf archive.tar Display the contents of a package
tar -xvf archive.tar Release a packet
tar -xvf archive.tar -C /tmp Extract the archive to the /tmp directory
tar -cvfj archive.tar.bz2 dir1 Create a bzip2 archive
tar -jxvf archive.tar.bz2 Extract a bzip2 archive
tar -cvfz archive.tar.gz dir1 Create a gzip archive
tar -zxvf archive.tar.gz Extract a gzip archive
zip file1.zip file1 Create a zip archive
zip -r file1.zip file1 file2 dir1 Compress multiple files and directories into a single zip archive
unzip file1.zip Extract a zip archive

Command code Comment
rpm -ivh package.rpm Install an rpm package
rpm -ivh --nodeeps package.rpm Install an rpm package, ignoring dependency warnings
rpm -U package.rpm Update an rpm package without changing its config files
rpm -F package.rpm Update a definitely installed rpm package
rpm -e package_name.rpm Remove an rpm package
rpm -qa List all rpm packages installed on the system
rpm -qa | grep httpd Show all rpm packages whose names contain "httpd"
rpm -qi package_name Get special information about an installed package
rpm -qg "System Environment/Daemons" Show rpm packages of a component
rpm -ql package_name Show the list of files provided by an installed rpm package
rpm -qc package_name Show a list of configuration files provided by an installed rpm package
rpm -q package_name --whatrequires Show the dependency list of an rpm package
rpm -q package_name --whatprovides Show the size an rpm package occupies
rpm -q package_name --scripts Show the scripts executed during install/remove
rpm -q package_name --changelog Show the modification history of an rpm package
rpm -qf /etc/httpd/conf/httpd.conf Check which rpm package provides the given file
rpm -qp package.rpm -l Show the list of files provided by a not-yet-installed rpm package
rpm --import /media/cdrom/RPM-GPG-KEY Import public key certificate
rpm --checksig package.rpm Verify the integrity of an rpm package
rpm -qa gpg-pubkey Verify the integrity of all installed rpm packages
rpm -V package_name Check the file size, permissions, type, owner, group, MD5 check and last modified time
rpm -Va Check all installed rpm packages on the system - use with caution
rpm -Vp package.rpm Verify that an rpm package is not yet installed
rpm2cpio package.rpm | cpio --extract --make-directories *bin* Run an executable from an rpm package
rpm -ivh /usr/src/redhat/RPMS/`arch`/package.rpm Install a built package from an rpm source
rpmbuild --rebuild package_name.src.rpm Build an rpm package from an rpm source

Command code Comment
yum install package_name Download and install an rpm package
yum localinstall package_name.rpm Install an rpm package, using your own software repository to resolve all dependencies
yum update package_name.rpm Update all rpm packages installed on the system
yum update package_name Update an rpm package
yum remove package_name Remove an rpm package
yum list List all packages installed on the current system
yum search package_name Search for a package in the rpm repository
yum clean packages Clear the rpm cache and delete downloaded packages
yum clean headers Delete all headers
yum clean all Delete all cached packages and header files

Command code Comment
dpkg -i package.deb Install/update a deb package
dpkg -r package_name Remove a deb package from the system
dpkg -l Show all deb packages installed on the system
dpkg -l | grep httpd Show all deb packages whose names contain "httpd"
dpkg -s package_name Get information about a specific package installed on the system
dpkg -L package_name Show the list of files provided by an installed deb package
dpkg --contents package.deb Show the file list provided by a package not yet installed
dpkg -S /bin/ping Check which deb package provides the given file

Command code Comment
apt-get install package_name Install/update a deb package
apt-cdrom install package_name Install/upgrade a deb package from disc
apt-get update Upgrade packages in the list
apt-get upgrade Upgrade all installed software
apt-get remove package_name Remove a deb package from the system
apt-get check Verify dependent software repositories
apt-get clean Clear the cache from downloaded packages
apt-cache search searched-package Return the names of packages containing the search string

Command code Comment
cat file1 View file contents forward starting from the first byte
tac file1 View a file's contents in reverse starting from the last line
more file1 View the content of a long file
less file1 Like the 'more' command, but it allows reverse navigation through a file, just like forward navigation
head -2 file1 View the first two lines of a file
tail -2 file1 Show the last two lines of a file
tail -f /var/log/messages View content added to a file in real time

Command code Comment
cat file1 | command( sed, grep, awk, grep, etc...) > result.txt Merge the detailed documentation text of one file and write the synopsis into a new file
cat file1 | command( sed, grep, awk, grep, etc...) >> result.txt Merge the detailed documentation text of one file and write the synopsis into an existing file
grep Aug /var/log/messages Search for the keyword "Aug" in the file '/var/log/messages'
grep ^Aug /var/log/messages Search the file '/var/log/messages' for words starting with "Aug"
grep [0-9] /var/log/messages Select all lines containing digits from the file '/var/log/messages'
grep Aug -R /var/log/* Search for the string "Aug" in the directory '/var/log' and the directories that follow
sed 's/stringa1/stringa2/g' example.txt Replace "string1" with "string2" in the file example.txt
sed '/^$/d' example.txt Delete all blank lines from the example.txt file
sed '/ *#/d; /^$/d' example.txt from example.txt Delete all comments and blank lines in a file
echo 'esempio' | tr '[:lower:]' '[:upper:]' Merge cell contents up and down
sed -e '1d' result.txt Exclude the first line from the file example.txt
sed -n '/stringa1/p' View only the lines that contain the word "string1"
sed -e 's/ *$//' example.txt Delete trailing whitespace at the end of each line
sed -e 's/stringa1//g' example.txt Remove only the word "string1" from the document and keep all the rest
sed -n '1,5p;5q' example.txt View content from line 1 to line 5
sed -n '5p;5q' example.txt View line 5
sed -e 's/00*/0/g' example.txt Replace multiple zeros with a single zero
cat -n file1 Mark line numbers in a file
cat example.txt | awk 'NR%2==1' Delete all even-numbered lines from the example.txt file
echo a b c | awk '{print $1}' View the first field of a line
echo a b c | awk '{print $1,$3}' Show the first and third fields of a line
paste file1 file2 Merge the contents of two files or two columns
paste -d '+' file1 file2 Merge the contents of two files or two columns, separated by "+"
sort file1 file2 Sort the contents of two files
sort file1 file2 | uniq Get the union of two files (duplicate lines are kept once)
sort file1 file2 | uniq -u Delete intersections, keep other lines
sort file1 file2 | uniq -d Get the intersection of two files (keep only what exists in both files)
comm -1 file1 file2 Compare the contents of two files, deleting only what 'file1' contains
comm -2 file1 file2 Compare the contents of two files, deleting only what 'file2' contains
comm -3 file1 file2 Compare the contents of two files and delete only the lines common to both

Command code Comment
dos2unix filedos.txt fileunix.txt Convert a text file's format from MSDOS to UNIX
unix2dos fileunix.txt filedos.txt Convert a text file's format from UNIX to MSDOS
recode ..HTML < page.txt > page.html Convert a text file to HTML
recode -l | more Show all allowed conversion formats

Command code Comment
badblocks -v /dev/hda1 Check for bad blocks on disk hda1
fsck /dev/hda1 Repair/check the integrity of the linux filesystem on disk hda1
fsck.ext2 /dev/hda1 Check/repair the integrity of the ext2 file system on disk hda1
e2fsck /dev/hda1 Check/repair the integrity of the ext2 file system on disk hda1
e2fsck -j /dev/hda1 Check/repair the integrity of the ext3 file system on disk hda1
fsck.ext3 /dev/hda1 Check/repair the integrity of the ext3 file system on disk hda1
fsck.vfat /dev/hda1 Repair/check the integrity of the fat file system on disk hda1
fsck.msdos /dev/hda1 Check/repair the integrity of the dos file system on disk hda1
dosfsck /dev/hda1 Check/repair the integrity of the dos file system on disk hda1

Command code Comment
mkfs /dev/hda1 Create a file system on the hda1 partition
mke2fs /dev/hda1 Create a linux ext2 filesystem on the hda1 partition
mke2fs -j /dev/hda1 Create a linux ext3 (journaling) file system on the hda1 partition
mkfs -t vfat 32 -F /dev/hda1 Create a FAT32 file system
fdformat -n /dev/fd0 Format a floppy disk
mkswap /dev/hda3 Create a swap filesystem

Command code Comment
mkswap /dev/hda3 Create a swap filesystem
swapon /dev/hda3 Enable a new swap file system
swapon /dev/hda2 /dev/hdb3 Enable two swap partitions

Command code Comment
dump -0aj -f /tmp/home0.bak /home Make a full backup of the '/home' directory
dump -1aj -f /tmp/home0.bak /home Make an interactive backup of the '/home' directory
restore -if /tmp/home0.bak Restore an interactive backup
rsync -rogpav --delete /home /tmp Synchronize both directories
rsync -rogpav -e ssh --delete /home ip_address:/tmp rsync over SSH
rsync -az -e ssh --delete ip_addr:/home/public /home/local Sync a remote directory to a local directory over ssh with compression
rsync -az -e ssh --delete /home/local ip_addr:/home/public Sync a local directory to a remote directory over ssh with compression
dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr 'dd of=hda.gz' Back up a local disk on a remote host over ssh
dd if=/dev/sda of=/tmp/file1 Back up disk contents to a file
tar -Puf backup.tar /home/user Perform an interactive backup operation on the '/home/user' directory
( cd /tmp/local/ && tar c . ) | ssh -C user@ip_addr 'cd /home/share/ && tar x -p' Copy the contents of a directory to a remote directory over ssh
( tar c /home ) | ssh -C user@ip_addr 'cd /home/backup-home && tar x -p' Copy a local directory to a remote directory over ssh
tar cf - . | (cd /tmp/backup ; tar xf - ) Copy a directory to another location locally, keeping the original permissions and links
find /home/user1 -name '*.txt' | xargs cp -av --target-directory=/home/backup/ --parents Find and copy all files ending with '.txt' from one directory to another
find /var/log -name '*.log' | tar cv --files-from=- | bzip2 > log.tar.bz2 Find all files ending in '.log' and bundle them into a bzip package
dd if=/dev/hda of=/dev/fd0 bs=512 count=1 Perform an action that copies the MBR (Master Boot Record) content to a floppy disk
dd if=/dev/fd0 of=/dev/hda bs=512 count=1 Restore MBR content from a backup saved to a floppy disk

Command code Comment
cdrecord -v gracetime=2 dev=/dev/cdrom -eject blank=fast -force Clear the contents of a rewritable disc
mkisofs /dev/cdrom > cd.iso Create an iso image file of a CD on disk
mkisofs /dev/cdrom | gzip > cd_iso.gz Create a compressed CD iso image file on disk
mkisofs -J -allow-leading-dots -R -V "Label CD" -iso-level 4 -o ./cd.iso data_cd Create an iso image file of a directory
cdrecord -v dev=/dev/cdrom cd.iso Burn an ISO image file
gzip -dc cd_iso.gz | cdrecord dev=/dev/cdrom - Burn a compressed ISO image file
mount -o loop cd.iso /mnt/iso Mount an ISO image file
cd-paranoia -B Rip a track from a CD into a wav file
cd-paranoia -- "-3" Rip an audio track from a CD to a wav file (parameter -3)
cdrecord --scanbus Scan the bus to identify scsi channels
dd if=/dev/hdc | md5sum Verify the md5sum of a device, for example a CD

Command code Comment
dhclient eth0 Enable the 'eth0' network device in dhcp mode
ethtool eth0 Show traffic statistics for network interface 'eth0'
host www.example.com Look up host names to resolve names, IP addresses and mirrors
hostname Show hostname
ifconfig eth0 Show an ethernet card configuration
ifconfig eth0 192.168.1.1 netmask 255.255.255.0 Control IP address
ifconfig eth0 promisc Set 'eth0' to promiscuous mode to sniff packets (sniffing)
ifdown eth0 Disable an 'eth0' network device
ifup eth0 Enable an 'eth0' network device
ip link show Show the connection status of all network devices
iwconfig eth1 Show a wireless network card configuration
iwlist scan Show wireless networks
mii-tool eth0 Show the connection status of 'eth0'
netstat -tup Show all active network connections and their PIDs
netstat -tup1 Show all listening network services on the system and their PIDs
netstat -rn Show the routing table, similar to the "route -n" command
nslookup www.example.com Look up host names to resolve names, IP addresses and mirrors
route -n Show routing table
route add -net 0/0 gw IP Gateway Control preset gateway
route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1 Control the static route to network '192.168.0.0/16'
route del 0/0 gw IP gateway Delete static routes
echo “1”> /proc/sys/net/ipv4/ip_foward Enable IP forwarding
tcpdump tcp port 80 Display all HTTP loopbacks
whois www.example.com Search in the Whois database

Command code Comment
mount -t smbfs -o username=user,password=pass //WinClient/share/mnt/share Mount a windows network share
nbtscan ip addr netbios name resolution
nmblookup -A ip addr netbios name resolution
smbclient -L ip addr/hostname Show the remote shares of a windows host
smbget -Rr smb://ip addr/share Like wget, but it can download files from a windows host over smb

Command code Comment
iptables -t filter -L Display all links in the filter table
iptables -t nae -L Show all links in the nat table
iptables -t filter -F Clear all rules based on the filter table
iptables -t nat -F Clear all rules based on the nat table
iptables -t filter -X Delete all links created by the user
iptables -t filter -A INPUT -p tcp --dport telnet -j ACCEPT Allow telnet access
iptables -t filter -A OUTPUT -p tcp --dport telnet -j DROP Block telnet access
iptables -t filter -A FORWARD -p tcp --dport pop3 -j ACCEPT Allow POP3 connections on the forwarding path
iptables -t filter -A INPUT -j LOG --log-prefix Log dropped packets on all links
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE Set up a PAT (Port Address Translation) on eth0 to masquerade outgoing packets
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 Redirect packets destined for one host address to other hosts

Command code Comment
free -m List RAM status in megabytes
kill -9 process id Force close and kill the process
kill -1 process id Force a process to reload its configuration
last reboot Show reboot history
lsmod List kernel module status
lsof -p process id List the files opened by a process
lsof /home/user1 List the open files in the given system path
ps -eafw List linux jobs
ps -e -o pid,args --forest List Linux tasks in a tree structure
pstress Show programs as a tree
smartctl -A /dev/hda Monitor hard disk reliability by enabling SMART
smartctl -i /dev/hda Check whether SMART is enabled on a hard disk
strace -c ls >/dev/null List the system calls made and receive them with a process
strace -f -e open ls >/dev/null List library calls
tail /var/log/dmesg Show internal events during kernel boot
tail /val/log/messages Show system events
top List the linux tasks using the most CPU resources
watch -nl ‘cat /proc/interrupts’ List live interrupts

Command code Comment
alias hh='history' Set an alias for the history command (history)
apropos ...keyword List a command list containing a program keyword - useful when you know what a program does but cannot recall the command
chsh Change shell command
chsh --list-shells A handy command to find out whether you have to connect to another machine remotely
gpg -c filel Encrypt a file with GNU Privacy Guard
gpg filel.gpg Decrypt a file with GNU Privacy Guard
Recently used:

How to use

This tool belongs to the “Reference tables” category.

  1. 1Use the browser find (Ctrl/Cmd + F) on the reference page to jump to a keyword.
  2. 2Copy a whole row into a code comment or config file when you need an example.
  3. 3For status codes and request headers, cross-check against the Network panel in your developer tools.

Your input is processed locally in the browser whenever possible. We do not store it.

Frequently asked questions

Is there an API?

Some lookups expose a JSON endpoint; the full list is on the Network Tools → API reference page.

Could the tables be out of date?

Specifications evolve. These pages list the common entries and note the last update — report anything wrong.

Why not everything?

We keep the high-frequency entries to hold page weight and load time down.