Linux Commands Cheat Sheet - Beginner To Advanced
Linux Commands Cheat Sheet - Beginner To Advanced
By the end of this cheat sheet, you will have a basic understanding of
Linux/Unix Commands and how it makes development easy for developers.
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 1/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
What is Linux?
ls ls -l
displays files and
-l: Long format
directories with
listing.
detailed information.
-a: Include
ls -a
List files and hidden files
shows all files and
directories. hidden ones
directories, including
-h: Human-
ls -lh
readable file
displays file sizes in a
sizes.
human-readable
format.
cd cd /path/to/directory
Change changes the current
directory. directory to the
specified path.
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 3/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
rm rm file.txt
deletes the file named
-r: Remove “file.txt”.
directories rm -r my_directory
recursively. deletes the directory
Remove files
-f: Force “my_directory” and its
and directories.
removal contents.
without rm -f file.txt
confirmation. forcefully deletes the
file “file.txt” without
confirmation.
cp cp -r directory
destination
copies the directory
“directory” and its
-r: Copy
Copy files and contents to the
directories
directories. specified destination.
recursively.
cp file.txt destination
copies the file “file.txt”
to the specified
destination.
mv Move/rename mv file.txt
files and new_name.txt
directories. renames the file
“file.txt” to
“new_name.txt”.
mv file.txt directory
moves the file “file.txt”
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 4/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
to the specified
directory.
touch Create an
touch file.txt
empty file or
creates an empty file
update file
named “file.txt”.
timestamps.
ln ln -s source_file
link_name
-s: Create
Create links creates a symbolic link
symbolic (soft)
between files. named “link_name”
links.
pointing to
“source_file”.
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 5/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
chmod u: User/owner
permissions.
g: Group
permissions.
o: Other
chmod u+rwx file.txt
permissions.
Change file grants read, write, and
+: Add
permissions. execute permissions to
permissions.
the owner of the file.
–: Remove
permissions.
=: Set
permissions
explicitly.
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 6/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
Save the planet, one tech Most intelligent & secure Tech
product at a time. business laptops. work
ADVERTISING
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 7/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 8/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
ps ps aux
shows all running
Display running -aux: Show all processes with
processes. processes. detailed
information.
top top
displays a dynamic
Monitor system
view of system
processes in real-
processes and
time.
their resource
usage.
pkill pkill
Terminate process_name
processes based terminates all
on their name. processes with the
specified name.
pgrep pgrep
process_name
List processes
lists all processes
based on their
with the specified
name.
name.
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 9/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 10/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
patterns to
search for.
-A: Display
lines after the
matching line.
-B: Display
lines before
the matching
line.
-C: Display
lines both
before and
after the
matching line.
uname uname -a
Print system -a: All system
displays all system
information. information.
information.
whoami whoami
Display current
shows the current
username.
username.
df df -h
-h: Human-
Show disk space displays disk space
readable
usage. usage in a human-
sizes.
readable format.
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 11/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
free free -h
Display memory -h: Human-
displays memory
usage readable
usage in a human-
information. sizes.
readable format.
uptime uptime
Show system
shows the current
uptime.
system uptime.
lscpu lscpu
Display CPU provides detailed
information. CPU information.
lspci lspci
List PCI devices.
List PCI devices.
lsusb lsusb
List USB lists all connected
devices. USB devices.
6. Networking Commands
In Linux, there are several networking commands available to manage and
troubleshoot network connections. Here are some commonly used
networking commands:
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 12/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
ss ss -tuln
Display network
shows all listening TCP and UDP
socket
connections.
information.
7. IO Redirection Commands
In Linux, IO (Input/Output) redirection commands are used to redirect the
standard input, output, and error streams of commands and processes. Here
are some commonly used IO redirection commands:
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 13/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
Command Description
cmd1 <(cmd2) Output of cmd2 is used as the input file for cmd1.
cmd > /dev/null Discards the stdout of cmd by sending it to the null device.
Command Description
export
Sets the value of an environment variable.
VARIABLE_NAME=value
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 14/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
Command Description
Command Description
sudo adduser Create a new user account on the system with the
username specified username.
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 15/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
Command Description
Cut/delete
from the Search
Move to the cursor command
Ctrl + A beginning of Ctrl + U position to Ctrl + R history
the line. the (reverse
beginning of search).
the line.
Cut/delete
from the
Move to the Escape from
cursor
Ctrl + E end of the Ctrl + K Ctrl + G history
position to
line. search mode.
the end of
the line.
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 16/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
Cut/delete Go to the
Move back
Ctrl + the word previous
Ctrl + B one Ctrl + P
W before the command in
character.
cursor. history.
Go to the
Move
Paste the next
Ctrl + F forward one Ctrl + Y Ctrl + N
last cut text. command in
character.
history.
Terminate
Move back Clear the
Alt + B Ctrl + L Ctrl + C the current
one word screen.
command.
Move
Alt + F forward one
word.
Cut/del
from t
Save the Scroll up one curso
Ctrl + O Ctrl + Y Ctrl + K
file. page. position
the end
the lin
Exit Nano
Uncut/re
(prompt to Scroll down
Ctrl + X Ctrl + V Ctrl + U the last
save if one page.
text
modified).
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 17/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
Go to the
Justify the Cut/del
beginning of
Ctrl + J current Alt + , Ctrl + K the mar
the current
paragraph. block of
line.
Go to the Copy t
Alt + . end of the Alt + 6 marked b
current line. of tex
Command Description
Change the current word. Deletes from the cursor position to the
cw
end of the current word and switches to insert mode.
o Insert a new line below the current line and switch to insert mode.
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 18/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
Command Description
dw Delete from the cursor position to the beginning of the next word.
4dw Delete the next four words from the cursor position.
3dd Delete the current line and the two lines below it.
Restore the current line to its original state before any changes
U
were made.
Delete from the cursor position to the end of the line and switch to
C
insert mode.
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 19/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
Delete the
Copy the
character
x :q Quit Vim. y selected
under the
text.
cursor.
Quit Vim
Delete the
Delete the without
dd :q! d selected
current line. saving
text.
changes.
:wq
Paste the
Copy the or Save and
yy p copied or
current line. quit Vim.
:x deleted text.
:set nu
Undo the Display line
u or
last change. numbers.
:set number
Conclusion
In conclusion, Linux is a widely used operating system for development, and
as a developer, you should have knowledge of Linux and its basic
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 20/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
PS. Don’t miss our other Python cheat sheet for data science that
covers Scikit-Learn, Bokeh, Pandas and Python basics.
When your memory fails or you prefer not to rely on “linux –help?” in
the Terminal, this linux cheat sheet comes to the rescue. It is hard to
memorize all the important linux Commandsby heart, so print this out
or save it to your desktop to resort to when you get stuck.
Kernel. The base component of the OS. Without it, the OS doesn’t
work. …
System user space. The administrative layer for system-level tasks
like configuration and software install. …
Applications. A type of software that lets you perform a task.
You might have heard of chmod 777. This command will give read,
write and execute permission to the owner, group and public.
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 21/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
Unlock the power of Linux with our Online Linux Course with Certification!
Whether a beginner or an experienced professional, this course is designed
to help you master Linux, the backbone of modern computing. Dive into
comprehensive modules covering everything from basic commands to
advanced system administration. With hands-on projects and real-world
examples, you'll gain the skills to manage Linux environments efficiently
and confidently. Plus, earn a certification that showcases your expertise to
potential employers.
Ready to become a Linux pro? Enroll now and take your tech career to the
next level!
J jayes… 37
Similar Reads
Linux Network Commands Cheat Sheet
Linux is a very popular operating system. Many people use it. Developers and
network admins need to know Linux network commands well. This article wil…
9 min read
On Linux computers there are special commands to control the programs that
are running. These commands are called process management commands.…
6 min read
C Cheat Sheet
This C Cheat Sheet provides an overview of both basic and advanced concepts
of the C language. Whether you're a beginner or an experienced programmer…
15+ min read
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 23/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
15+ min read
Company Languages
About Us Python
Legal Java
In Media C++
Contact Us PHP
Advertise with us GoLang
GFG Corporate Solution SQL
Placement Training Program R Language
GeeksforGeeks Community Android Tutorial
Tutorials Archive
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 24/25
10/25/24, 2:52 AM Linux Commands Cheat Sheet: Beginner to Advanced
Algorithms Data Science For Beginner
DSA for Beginners Machine Learning
Basic DSA Problems ML Maths
DSA Roadmap Data Visualisation
Top 100 DSA Interview Problems Pandas
DSA Roadmap by Sandeep Jain NumPy
All Cheat Sheets NLP
Deep Learning
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/ 25/25