Essential Linux Command Line Cheatsheets for Beginners and Advanced Users

Harish Kumar · · 1540 Views

The Linux command line is a powerful tool for managing your system efficiently. Whether you're a beginner exploring the terminal or an advanced user handling complex tasks, cheatsheets can be an invaluable resource to quickly recall commands and syntax. This article outlines the most important Linux cheatsheets for users at various levels of experience.

Essential Linux Command Line Cheatsheets for Beginners and Advanced Users

1. Introduction to Linux Commands

Linux, unlike other operating systems, is heavily reliant on the command line interface (CLI). Mastery of the terminal can lead to faster system navigation, efficient file handling, and advanced system management. Cheatsheets condense these commands into easy-to-access references, so you don’t have to memorize every command.

2. Basic Commands Cheatsheet

Command

Description

Example

pwd

Prints the current working directory 

$ pwd

ls

Lists files and directories 

$ ls -l

cd

Changes directory 

$ cd /home/user

mkdir

Creates a new directory 

$ mkdir new_folder

rm

Removes files or directories 

$ rm file.txt

cp

Copies files or directories 

$ cp source dest

mv

Moves or renames files and directories 

$ mv oldname newname

cat

Displays content of a file 

$ cat file.txt

touch

Creates an empty file 

$ touch newfile.txt

Tips:

  1. Use ls -a to view hidden files.

  2. Use cd .. to move up one directory level.

3. File and Directory Management Cheatsheet

Managing files and directories is a routine task in Linux. The following commands allow users to navigate, manipulate, and organize files.

Command 

Description

Example

find

Searches for files and directories 

$ find /home -name "*.txt"

grep

Searches for a string inside files 

$ grep "text" file.txt

du

Shows disk usage of files and directories 

$ du -h /home

df

Shows disk space usage 

$ df -h

chmod

Changes file permissions 

$ chmod 755 file.txt

chown

Changes file owner 

$ chown user:group file.txt

Pro Tip: Use find / -name filename to search for a file anywhere on your system.

4. Permissions and Ownership Cheatsheet

Permissions are a key aspect of Linux security, controlling who can read, write, or execute files.

Command

Description

Example

chmod

Change file permissions 

$ chmod 755 script.sh

chown

Change file owner 

$ chown user:group file

umask

Set default file permissions 

$ umask 022

ls -l

List files with permissions 

$ ls -l

Permissions are divided into three categories:

  1. Owner (u)

  2. Group (g)

  3. Others (o)

Each category has three permissions:

  1. Read (r)

  2. Write (w)

  3. Execute (x)

For example, chmod 755 gives the owner full permissions (7), while group and others get read and execute permissions (5).

5. Networking Commands Cheatsheet

Networking in Linux involves interacting with networks, transferring data, and troubleshooting. Here are common commands used for networking.

Command 

Description

Example

ping

Sends network packets to a server 

$ ping google.com

ifconfig

Displays network interfaces 

$ ifconfig

netstat

Displays network connections 

$ netstat -tuln

curl

Transfers data from or to a server 

$ curl http://example.com

wget

Downloads files from the web 

$ wget http://example.com

Advanced Tip: Use netstat -anp | grep 80 to see all processes using port 80.

6. Process Management Cheatsheet

Linux provides robust tools to manage running processes. You can view, terminate, or control system processes using the following commands.

Command

Description

Example

ps

Displays currently running processes 

$ ps aux

top

Displays real-time system process info 

$ top

kill

Terminates a process by PID 

$ kill 1234

pkill

Terminates processes by name 

$ pkill firefox

htop

Interactive process viewer (more advanced) 

$ htop

Use ps aux | grep program to find a process by name. For example, $ ps aux | grep apache2 will show all processes related to Apache.

7. Package Management Cheatsheet

Depending on your Linux distribution, you'll use different tools for managing software packages.

For Debian-based Systems (e.g., Ubuntu):

Command

Description

 Example

apt update

Updates package list 

$ sudo apt update

apt upgrade

Installs updates for packages 

$ sudo apt upgrade

apt install package

Installs a package 

$ sudo apt install nginx

apt remove package

Removes a package 

$ sudo apt remove nginx

For Red Hat-based Systems (e.g., CentOS):

Command

Description

Example

yum update

Updates package list 

$ sudo yum update

yum install package

Installs a package 

$ sudo yum install nginx

yum remove package

Removes a package 

$ sudo yum remove nginx

8. Text Processing Commands Cheatsheet

Text manipulation is a frequent task when working in the Linux environment. The following commands help with processing and editing text files efficiently.

Command

Description

Example

cat

Displays content of a file 

$ cat file.txt

grep

Searches for patterns within files 

$ grep "pattern" file.txt

awk

Text processing language 

$ awk '{print $1}' file.txt

sed

Stream editor for text manipulation 

$ sed 's/old/new/g' file.txt

cut

Removes sections from each line of files 

$ cut -d',' -f1 file.csv

Pro Tip: Use grep -r "pattern" /path to search recursively within directories.

9. Advanced Linux Commands Cheatsheet

For users looking to delve deeper into system management, the following commands provide advanced control over your system.

Command

Description

Example

tar

Archiving tool 

$ tar -czvf archive.tar.gz /dir

crontab

Task scheduling 

$ crontab -e

ssh

Securely connect to a remote system 

$ ssh user@hostname

iptables

Firewall configuration 

$ sudo iptables -L

rsync

Syncs files between systems 

$ rsync -av /src /dest

Advanced users can also leverage tools like systemctl to manage services, and docker for container management.

Conclusion

Linux is a vast operating system with countless commands and utilities. Cheatsheets are a convenient way to stay efficient and productive, providing quick references to the most important commands. Whether you're managing files, handling processes, or configuring networking, these cheatsheets cover the essentials and help both beginners and advanced users.

🔥 Supercharge Your Development with Ctrl+Alt+Cheat

👉 Download Ctrl+Alt+Cheat today and start coding like a pro!

0

Please login or create new account to add your comment.

0 comments
You may also like:

Understanding Linux File Permissions and Ownership

Linux file permissions are a critical cornerstone in the architecture of Linux systems, serving as a fundamental aspect of their security model. They meticulously define who can (...)
Harish Kumar

How To Install NVM (Node Version Manager) on Ubuntu System?

This tutorial will assist you with installing NVM on the Ubuntu machine. Additionally, allow you to install different node versions and other useful examples.
Harish Kumar

Install Laravel Valet Linux+ development environment on Ubuntu System

The official Laravel Valet development environment is great if you are an Apple user. But there is no official Valet for Linux or Window system.
Harish Kumar

Install and Setup Oh-My-Zsh on Ubuntu System

In this post, I will show you how to install ZSH (Z-Shell). Then, we set up the oh-my-zsh framework for managing ZSH. We will likewise show you how to change the ZSH theme and (...)
Harish Kumar

10 Things to Do After Installing Ubuntu Operating System

In this article, I will show you 40 things you can do after installing Ubuntu on your system. This isn't restricted to a specific version of Ubuntu; you can follow these on any (...)
Harish Kumar

Ubuntu Installation step by step guide with disk partitioning

Ubuntu is the most loved OS for many desktop users, particularly for developers. Canonical releases new Ubuntu versions every six months with free support for nine months and every (...)
Harish Kumar