0% found this document useful (0 votes)
468 views26 pages

Linux Commands Cheat Sheet - Linux Training Academy

This document provides a cheat sheet of commonly used Linux commands organized into categories like system information, hardware information, file and directory commands, and more. It includes over 100 commands and their brief descriptions. At the bottom, there is an option to download a printable PDF version of the cheat sheet.

Uploaded by

Dark Lord
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
468 views26 pages

Linux Commands Cheat Sheet - Linux Training Academy

This document provides a cheat sheet of commonly used Linux commands organized into categories like system information, hardware information, file and directory commands, and more. It includes over 100 commands and their brief descriptions. At the bottom, there is an option to download a printable PDF version of the cheat sheet.

Uploaded by

Dark Lord
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕

Linux Training Academy

About
Products
Books
Linux for Beginners
Resources
Video Training Courses

Linux Commands Cheat Sheet


Did you know that there are literally hundreds of Linux commands? Even on a bare-bones Linux
server install there are easily over 1,000 different commands.

The interesting thing is that most people only need to use a very small subset of those
commands. Below you’ll find a Linux “cheat sheet” that breaks down some of the most
commonly used commands by category.

To get your own PDF and printable copy, scroll to the bottom of the page.

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 1/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

Enjoy!

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕

Contents [hide]

1 – SYSTEM INFORMATION
2 – HARDWARE INFORMATION
3 – PERFORMANCE MONITORING AND STATISTICS
4 – USER INFORMATION AND MANAGEMENT
5 – FILE AND DIRECTORY COMMANDS
6 – PROCESS MANAGEMENT
7 – FILE PERMISSIONS
8 – NETWORKING
9 – ARCHIVES (TAR FILES)
10 – INSTALLING PACKAGES
11 – SEARCH
12 – SSH LOGINS
13 – FILE TRANSFERS
14 – DISK USAGE
15 – DIRECTORY NAVIGATION

1 – SYSTEM INFORMATION

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 2/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

# Display Linux system information

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕
uname -a

# Display kernel release information

uname -r

# Show which version of Red Hat installed

cat /etc/redhat-release

# Show how long the system has been running + load

uptime

# Show system host name

hostname

# Display all local IP addresses of the host.

hostname -I

# Show system reboot history

last reboot

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 3/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

# Show the current date and time

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕
date

# Show this month's calendar

cal

# Display who is online

# Who you are logged in as

whoami

2 – HARDWARE INFORMATION
# Display messages in kernel ring buffer

dmesg

# Display CPU information

cat /proc/cpuinfo

# Display memory information

cat /proc/meminfo

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 4/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕
# Display free and used memory ( -h for human readable, -m for MB, -g for
GB.)

free -h

# Display PCI devices

lspci -tv

# Display USB devices

lsusb -tv

# Display DMI/SMBIOS (hardware info) from the BIOS

dmidecode

# Show info about disk sda

hdparm -i /dev/sda

# Perform a read speed test on disk sda

hdparm -tT /dev/sda

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 5/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

# Test for unreadable blocks on disk sda

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕
badblocks -s /dev/sda

3 – PERFORMANCE MONITORING AND STATISTICS


# Display and manage the top processes

top

# Interactive process viewer (top alternative)

htop

# Display processor related statistics

mpstat 1

# Display virtual memory statistics

vmstat 1

# Display I/O statistics

iostat 1

# Display the last 100 syslog messages  (Use /var/log/syslog for Debian
based systems.)

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 6/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

tail -100 /var/log/messages

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕

# Capture and display all packets on interface eth0

tcpdump -i eth0

# Monitor all traffic on port 80 ( HTTP )

tcpdump -i eth0 'port 80'

# List all open files on the system

lsof

# List files opened by user

lsof -u user

# Display free and used memory ( -h for human readable, -m for MB, -g for
GB.)

free -h

# Execute "df -h", showing periodic updates

watch df -h

4 – USER INFORMATION AND MANAGEMENT

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 7/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

# Display the user and group ids of your current user.

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕
id

# Display the last users who have logged onto the system.

last

# Show who is logged into the system.

who

# Show who is logged in and what they are doing.

# Create a group named "test".

groupadd test

# Create an account named john, with a comment of "John Smith" and create
the user's home directory.

useradd -c "John Smith" -m john

# Delete the john account.

userdel john

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 8/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕
# Add the john account to the sales group

usermod -aG sales john

5 – FILE AND DIRECTORY COMMANDS


# List all files in a long listing (detailed) format

ls -al

# Display the present working directory

pwd

# Create a directory

mkdir directory

# Remove (delete) file

rm file

# Remove the directory and its contents recursively

rm -r directory

# Force removal of file without prompting for confirmation

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 9/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

rm -f file

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕

# Forcefully remove directory recursively

rm -rf directory

# Copy file1 to file2

cp file1 file2

# Copy source_directory recursively to destination. If destination exists,


copy source_directory into destination, otherwise create destination with
the contents of source_directory.

cp -r source_directory destination

# Rename or move file1 to file2. If file2 is an existing directory, move


file1 into directory file2

mv file1 file2

# Create symbolic link to linkname

ln -s /path/to/file linkname

# Create an empty file or update the access and modification times of file.

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 10/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

touch file

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕

# View the contents of file

cat file

# Browse through a text file

less file

# Display the first 10 lines of file

head file

# Display the last 10 lines of file

tail file

# Display the last 10 lines of file and "follow" the file as it grows.

tail -f file

6 – PROCESS MANAGEMENT
# Display your currently running processes

ps

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 11/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

# Display all the currently running processes on the system.

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕
ps -ef

# Display process information for processname

ps -ef | grep processname

# Display and manage the top processes

top

# Interactive process viewer (top alternative)

htop

# Kill process with process ID of pid

kill pid

# Kill all processes named processname

killall processname

# Start program in the background

program &

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 12/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

# Display stopped or background jobs

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕
bg

# Brings the most recent background job to foreground

fg

# Brings job n to the foreground

fg n

7 – FILE PERMISSIONS

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 13/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕
        PERMISSION      EXAMPLE

         U   G   W

        rwx rwx rwx     chmod 777 filename

        rwx rwx r-x     chmod 775 filename

        rwx r-x r-x     chmod 755 filename

        rw- rw- r--     chmod 664 filename

        rw- r-- r--     chmod 644 filename

# NOTE: Use 777 sparingly!

        LEGEND

        U = User

        G = Group

        W = World

        r = Read

        w = write

        x = execute

        - = no access

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 14/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

8 – Linux
Free NETWORKING
Command Line Cheat Sheet ->
Email
Download Now! ✕

# Display all network interfaces and IP address

ip a

# Display eth0 address and details

ip addr show dev eth0

# Query or control network driver and hardware settings

ethtool eth0

# Send ICMP echo request to host

ping host

# Display whois information for domain

whois domain

# Display DNS information for domain

dig domain

# Reverse lookup of IP_ADDRESS

dig -x IP_ADDRESS

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 15/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕
# Display DNS IP address for domain

host domain

# Display the network address of the host name.

hostname -i

# Display all local IP addresses of the host.

hostname -I

# Download http://domain.com/file

wget http://domain.com/file

# Display listening tcp and udp ports and corresponding programs

netstat -nutlp

9 – ARCHIVES (TAR FILES)


# Create tar named archive.tar containing directory.

tar cf archive.tar directory

# Extract the contents from archive.tar.

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 16/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

tar xf archive.tar

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕

# Create a gzip compressed tar file name archive.tar.gz.

tar czf archive.tar.gz directory

# Extract a gzip compressed tar file.

tar xzf archive.tar.gz

# Create a tar file with bzip2 compression

tar cjf archive.tar.bz2 directory

# Extract a bzip2 compressed tar file.

tar xjf archive.tar.bz2

10 – INSTALLING PACKAGES
# Search for a package by keyword.

yum search keyword

# Install package.

yum install package

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 17/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

# Display description and summary information about package.

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕
yum info package

# Install package from local file named package.rpm

rpm -i package.rpm

# Remove/uninstall package.

yum remove package

# Install software from source code.

tar zxvf sourcecode.tar.gz

cd sourcecode

./configure

make

make install

11 – SEARCH
# Search for pattern in file

grep pattern file

# Search recursively for pattern in directory

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 18/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

grep -r pattern directory

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕

# Find files and directories by name

locate name

# Find files in /home/john that start with "prefix".

find /home/john -name 'prefix*'

# Find files larger than 100MB in /home

find /home -size +100M

12 – SSH LOGINS
# Connect to host as your local username.

ssh host

# Connect to host as user

ssh user@host

# Connect to host using port

ssh -p port user@host

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 19/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

13 Linux
Free – FILE TRANSFERS
Command Line Cheat Sheet ->
Email
Download Now! ✕

# Secure copy file.txt to the /tmp folder on server

scp file.txt server:/tmp

# Copy *.html files from server to the local /tmp folder.

scp server:/var/www/*.html /tmp

# Copy all files and directories recursively from server to the current
system's /tmp folder.

scp -r server:/var/www /tmp

# Synchronize /home to /backups/home

rsync -a /home /backups/

# Synchronize files/directories between the local and remote system with


compression enabled

rsync -avz /home server:/backups/

14 – DISK USAGE

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 20/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

# Show free and used space on mounted filesystems

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕
df -h

# Show free and used inodes on mounted filesystems

df -i

# Display disks partitions sizes and types

fdisk -l

# Display disk usage for all files and directories in human readable format

du -ah

# Display total disk usage off the current directory

du -sh

15 – DIRECTORY NAVIGATION
# To go up one level of the directory tree.  (Change into the parent
directory.)

cd ..

# Go to the $HOME directory

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 21/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

cd

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕

# Change to the /etc directory

cd /etc

Download My Linux Cheat Sheet!


Enter your email address below to download this Linux command line cheat sheet in an easy-to-
read and ready-to-print format.

Your Best Email Address 

Send me my cheat sheet >

We respect your privacy.

Related Posts:
Linux ip Command Networking Cheat Sheet
Vim Cheat Sheet
Managing Linux Users and Groups
How to Find Any File or Command on a Linux System

Filed Under: blog — Tagged With: CentOS, cheat sheet, Command Line, Linux, RedHat, Server, Shell Scripting,
SSH, Ubuntu

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 22/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕

Most Popular

Linux Commands Cheat Sheet

Linux ip Command Networking Cheat


Sheet

Vim Cheat Sheet

Linux System Administrator Projects

1,500 Coding Project Ideas

Recent Linux Articles

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 23/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

CentOS is dead, long live CentOS!


Free Linux Command Line Cheat Sheet ->
Email
Download Now! ✕

Linux System Administrator and


DevOps Interview Questions

Q & A on Linux Career, Certification and


Online Courses

Linux Sed Command Tutorial

What It Takes to Become a Successful


Linux Administrator

Topics

Arch Linux
Careers
CentOS
cheat
sheet
Cloud
Command

Line
Debian
Desktop
DevOps

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 24/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

Fedora
File System
FTP
Gentoo ✕
Free Linux Command Line Cheat Sheet ->
Email Download Now!

Installation
Interviewing
Jobs

Linux
Linux Certifications
Linux Mint
Mageia
MySQL
Nginx
OpenSuse

Programming
Python
RedHat
SCP
Sed

Server
Shell Scripting
Slackware
SSH
Text Editors
Ubuntu
Vagrant
Video
vim
VirtualBox
Web
Hosting
Windows

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 25/26
8/6/2021 Linux Commands Cheat Sheet | Linux Training Academy

Free Linux Command Line Cheat Sheet ->


Email
Download Now! ✕

Linux Cheat Sheet


Download

Enter your email address below to


download this Linux command line
cheat sheet in an easy-to-read and
ready-to-print format.

 Your Best Email Address

Send me my cheat sheet >

© 2021 · Linux Training Academy


Privacy Policy

https://www.linuxtrainingacademy.com/linux-commands-cheat-sheet/ 26/26

You might also like