Black Friday Deals Not Found Anywhere Else! Save up to 55% OFF Hosting, Domains, Pro Services, and more.
Vodien Black Friday Sale applies to new purchase on select products and plans until 4 December 2024. Cannot be used in conjunction with other discounts, offers, or promotions.
Essential Linux Commands Cheat Sheet for Beginners

Essential Linux Commands Cheat Sheet for Beginners

Linux command is a textual instruction entered into the command line interface of a Linux operating system to perform a specific operation. Any task in Linux can be accomplished through commands. 

The command line interface is one of the defining features of the Linux operating system. It allows you to interact with the system by entering commands. You can type commands for all operations, simple to complex. In other words, commands enable you to control the development environment in Linux.

To ensure smooth workflow in this operating system, you must have the Linux commands at your fingertips. This is where a cheat sheet can help you.  

In this blog, we share a Linux commands cheat sheet to simplify development for you.

Linux Commands Cheat Sheet: Essential Commands and Descriptions

When working with Linux servers, using commands is not an option but a necessity. However, there are hundreds of Linux commands, and memorising them is no small feat for developers. A Linux commands cheat sheet can save you time and keep frustrations at bay.

This cheat sheet covers essential Linux commands. The commands are organised into key categories for easy navigation. Whether you are a beginner or an experienced professional, this cheat sheet can help you operate Linux more efficiently.

File and Directory Operations Commands

File and directory management is an essential aspect of working in Linux. Use these commands to operate files and directories from the terminal.

Command Description
ls List files and directories
ls -a List all files and directories in the current directory
ls -l List files and directories in long format
Is -t Sort the files/folders according to the last modified time/date
cd Change directory
cd .. Move up one directory level
cd – Change to the previous directory
dirs Show current directory stack
pwd Print current working directory
mkdir Create a new directory
cp Copy files and directories
mv Move or rename files and directories
rm Remove directories and files
find Search for files and directories
touch Create an empty file or update file timestamps
ln Create links between files
cat View the contents of a file
head Display the first few lines of a file
tail Display the last few lines of a file
cmp A B Compare two files A and B for sameness
diff A B Compare two files A and B for differences
Also Read: A Comprehensive Guide on How to Remove a Directory in Linux

Process Management Commands

In Linux, a process starts every time a program or application is executed. Use process management commands to control and monitor processes in progress.

Command Description
top Monitor system processes in real-time
pgrep List processes based on their name
ps Display active processes
kill Terminate a process
pkill Terminate processes based on their name
grep Search for specific patterns or regular expressions in text files or streams and display matching lines
pmap Display a memory usage map of processes
bg List and resume stopped jobs in the background
fg Bring the most recently suspended job to the foreground
jobs Lists background processes
Also ReadMastering the Grep Command in Linux: Tips and Tricks

File Permission Commands

File permissions control access to files and directories. Apply these commands to change and manage the file’s owner, group members, and user permissions.

Command Description
umask Set default file permissions
chmod Change the permissions of a file
chown Change the ownership of a file
chgrp Change group ownership

Network Commands

Network commands are necessary for monitoring and troubleshooting network connections and configurations in Linux. Use them to diagnose issues, view network information, and manage connections. 

Command Description
netstat Display network connections and statistics
ifconfig Display IP addresses of all network interfaces
ss Display network socket information
ping Send ICMP echo requests to a host
ssh Securely connect to a remote server
wget Download files from the web
curl Transfer data to or from a server
scp Securely copy files between hosts

File Compression and Archiving Commands

File compression helps to reduce file size while an archive file enables storage of multiple files or directories in a compressed format. Use file compression and archiving commands to reduce file size and make them easier for storage and transfer.

Command Description
tar Create or extract archive files
zip Create compressed zip archives
gzip Compress files

System Management and Information Commands

System management and information commands gather information about a Linux system. Use the Linux commands cheat sheetto view information, restart the system, or change options. 

Command Description
whoami Show current username
w List logged-in users
uname Print system information
hostname View system hostname
hostname -I Display IP address of host
free Display memory usage information
lscpu Display CPU information
uptime Show system uptime
lsusb List USB devices
lspci List PCI devices
reboot Restart the system
last reboot List system reboot history
dmesg Show bootup messages
cal Display current calendar
date Display current time and date
timedatectl Query and change the system clock
shutdown Shut down the system
shutdown now Shut down the system immediately
shutdown [hh:mm] Schedule a system shutdown

Disk Usage Commands

Disk usage provides information about filesystem usage and storage details. Apply these commands to monitor and manage disk space on your Linux machine.

Command Description
df Display disk space usage
du Display file/folder sizes on disk
fdisk -l Show disk partitions, sizes, and types
du -sh Show disk usage of the current directory
du -ah Show disk usage for all files and directories
mount Show currently mounted file systems
findmnt Display target mount point for all file systems
free -h Display free and used memory in human readable units

Environment Variable Commands

Environment variables define various aspects related to the functioning of a Linux system, such as system information, configuration settings, etc. Use these commands to create, view, and remove variables.

Command Description
echo $VARIABLE_NAME Display the value of a variable
export VARIABLE_NAME=value Set the value of an environment variable
env Display all environment variables currently set in the system
unset VARIABLE_NAME Remove an environment variable
env VAR1=value COMMAND Set the value of an environment variable for a specific command
export -p Shows a list of all currently exported environment variables
printenv Displays the values of all environment variables

Conclusion

Linux is a powerful operating system that you can use for your development work. Knowing the basic Linux commands will enable you to get used to the system and strengthen your foundation. This Linux commands cheat sheet can help you in this task.

Are you ready to harness the power of a Linux server for your applications and websites? Vodien’s dedicated Linux servers offer lightning-fast performance and scalable resources. Contact our sales and support team today to learn how we can help you.