Linux Commands Cheat Sheet For 2021

Linux Commands Cheat Sheet For 2021
Linux Commands Cheat Sheet For 2021

Introduction

As a Linux user, you must have struggled with remembering all the important commands at some point in time.

Don’t fret! Most of us have. 

There are thousands of Linux commands. Though those Linux commands satisfy different use cases and improve user convenience, It is difficult to remember all those commands at the same time. 

The brighter side is that a majority of Linux users accomplish their work by just using a set of most commonly used Linux commands. Even so, having a Linux commands cheat sheet is an industry best practice you should adopt. 


Here’s a cheat sheet for you.

What is Linux?

LINUX is an operating system or kernel that is freely available under an open-source license. Its feature set is quite similar to that of UNIX. It was initially used for computers, but its use later on expanded to underpin systems for phones, cars, web servers, and even networking gear.

Following are some of the features of the Linux operating system:

  • Secure: Linux offers user security via authentication features such as password protection, restricted access to particular files, and data encryption.
  • Hierarchy in File System: Linux’s hierarchical file system offers a standard file structure for arranging system and user data.
  • Multiprogramming: Linux is a multiprogramming system, which implies that several programs may execute at the same time.
  • Supports Many Users: Linux is a multiuser system, which implies that many users may use system resources such as memory/ram/application applications at the same time.

Linux Commands

Linux-based operating systems have made their way into a variety of linked devices, from our homes and vehicles to our workplaces, due to their open-source nature and the possibility for minimal OS footprint. Evolution does not have to be a straight line, as Linux developers have shown over and over again.

Over the next several decades, Linux may evolve into something entirely new, becoming the operating system of choice for an array of products and services that we can’t even envision presently.

A. Linux Commands Cheat Sheet: Basic Linux Commands

lsList all the files and directories in the current working directory
ls -aList the hidden files as well
ls -RList files in the present working directory as well as the subdirectories thereof
ls -SList files sorted by file size
ls -alList all the files and directories along with their details
pwdDisplay the present working directory
mkdir ABCMake a directory ABC
rmdirDeletes a directory
rm [file_name]delete a file
mv [ file_1] [file_2]Rename a file from [file_1] to [file_2]
cp [file_1] [file_2]Copy contents of [file_1] to [file_2]
cd ABCGo to the directory ABC
Cd or cd ~Change the present working directory to the home directory
Cd /Move to the root directory
touch [file_1]Create a new file [File_1]
more [file_1]Show the contents of the file [File_1]
cat [file_1] >> [file_2]Append contents of one file to another
head [file_1]Show the first 10 lines of the file [file_1]
tail [file_1]Show the last 10 lines of the file [file_1]
pr -xTo Divide a file into x columns
pr -hTo assign a header to the file

B. Linux Commands Cheat Sheet: File Permission Commands

  • U- User
  • G- Group
  • W- World
ls -lShow file type and access permission
rDenotes read permission
wDenotes write permission
xDenotes execution permission
-=Denotes no permission
Chown userChanges ownership of a file/directory
Chown user: group filenameChanges the user as well as the group for a file or directory

C. Linux Commands Cheat Sheet: Networking Commands       

ping hostSend an ICMP echo request to the host
Whois [domain]Displays “who is” information for the requested domain
DirTo display files in the current directory of a remotely connected computer
put fileTo send a file from your computer to the remote computer
get fileTo get the file from a remote computer to your computer
SSH username@ip-address or hostnameLog in to a remote Linux machine using SSH
ip aDisplay all IP addresses and network interfaces

D.  Linux Commands Cheat Sheet: Process Commands

psDisplays running processes
ps -efDisplays all running processes on the system
bgSend a process to the background
fgRetrieve and run a process in the foreground
psProcess status – running or stopped
ps PIDProcess status of the process with the given ID
pidofDisplays process id of a process
reniceAssigns a new priority to an already running process
niceA new process with a given priority starts
kill PIDKills the process with the given ID
program &Start the given program in the background with no output display
killall process_nameKill all processes with name process_name

E. Linux Commands Cheat Sheet: VI Editing Commands

iTo Insert at the cursor
aTo write after the cursor
ATo write at the EOL
EscTo exit insert mode
uUndo
UUndo all the changes to the line
oOpen a new line to write
xTo delete a character at the cursor
rTo replace a character

Frequently Asked Questions  

What is a Linux cheat sheet?

A cheat sheet is a concise collection of notes to aid memory through a quick reference. A Linux cheat sheet contains a list of useful Linux commands that every Linux user can use and keep handy.

What are Linux commands?

Linux provides a text-based terminal interface for users to interact with it. Linux commands enable a user to accomplish several simple and advanced tasks through the Linux terminal by executing such commands.

How do I get a list of commands in Linux?

You can list all the commands using the compgen shell built-in.

compgen –c | more lists every command you can run.
-a lists all the aliases
-b lists built-ins
-k lists all the keywords
-A function lists all the functions you can run
-A function –back lists all of these

What are 10 Linux Commands you can use every day?

The most common commands one can use every day are as follows:

cd: It is used for navigating between the directories
ls: Lists all the files and directories in the current working directory
mkdir: Creates a new directory
pwd: Displays the present working directory
cp: Copies file from the present working directory to another directory
mv: Renames as well as moves files
rmdir: Deletes a directory
touch: Creates a blank new file
locate: Locates a file you are looking for
df: Information on system’s disk space

What are terminal commands?

A terminal is a text-based interface that users can utilise to work on a computer. It is also known as a command line or a console in different technical jargons. Any command that can be executed on such an interface is called a terminal command.

What is a symbol called in Linux?

Linux uses a lot of symbols to communicate different meanings. Here’s a list of special characters used in Linux along with their meaning.

F. Additional Linux Commends

~denotes Home directory.
.denotes Current Directory
..denotes Parent Directory
*denotes Character Sequence Wildcard
/denotes a slash or a Path Directory Separator
#denotes Trim Strings or Comments
?denotes a Single character wildcard
[]denotes Character set wildcard
<denotes input redirection
>denotes output redirection
|denotes a pipe
;denotes a shell command separator
&hides the output of a command

Key Takeaways

If you are keen to start working on the Linux commands for building projects and more, this Linux commands cheat sheet can be your guide.

Wish to build a bright future in Coding? Enrol in our Premium Courses!

Exit mobile version