Linux, often associated with being a complex operating system primarily used by developers, may not necessarily fit that description entirely. While it can initially appear challenging for beginners, once you immerse yourself in the Linux world, you may find it difficult to return to your previous Windows systems. The power of Linux commands in controlling your PC, coupled with their clean user interface, can make it hard to switch back to older operating systems. If you’re a developer, you can likely relate to the advantages and appeal of Linux.
To support developers and beginners alike, we have created a comprehensive Linux/Unix command line cheat sheet . This cheat sheet covers all the basic and advanced commands, including file and directory commands, file permission commands, file compression and archiving, process management, system information, networking, and more with proper examples and descriptions. In addition to that we provide all the most used Linux Shortcut which includes Bash shortcuts, Nano shortcuts, VI & Vim Shortcuts Commands. It provides a solid foundation on Linux OS commands, as well as insights into practical applications.
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.
Linux Commands Cheat Sheet
What is Linux?
Linux is an open-source UNIX-like operating system (OS). An operating system is a software that directly manages a system’s hardware and resources, like CPU, memory, and storage. OS acts as a GUI through which user can communicate with the computer. The OS sits between applications and hardware and makes the connections between all of your software and the physical resources that do the work.
In this Linux cheat sheet, we will cover all the most important Linux commands, from the basics to the advanced. We will also provide some tips on how to practice and learn Linux commands. This cheat sheet is useful for Beginners and Experience professionals.
File and directory operations are fundamental in working with the Linux operating system. Here are some commonly used File and Directory Operations commands:
Command
Description
Options
Examples
File permissions on Linux and Unix systems control access to files and directories. There are three basic permissions: read, write, and execute. Each permission can be granted or denied to three different categories of users: the owner of the file, the members of the file’s group, and everyone else.
Here are some file permission commands:
Command
Description
Options
Examples
Here are some file compression and archiving commands in Linux:
Commands
Description
Options
Examples
In Linux, process management commands allow you to monitor and control running processes on the system. Here are some commonly used process management commands:
Commands
Description
Options
Examples
In Linux, there are several commands available to gather system information. Here are some commonly used system information commands:
sudCommand
Description
Options
Examples
In Linux, there are several networking commands available to manage and troubleshoot network connections. Here are some commonly used networking commands:
Command
Description
Examples
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:
Command
Description
In Linux, environment variables are used to store configuration settings, system information, and other variables that can be accessed by processes and shell scripts. Here are some commonly used environment variable commands:
Command
Description
In Linux, user management commands allow you to create, modify, and manage user accounts on the system. Here are some commonly used user management commands:
Command
Description
There are many shortcuts commands in Linux that can help you be more productive. Here are a few of the most common ones:
Navigation | Description | Editing | Description | History | Description |
---|---|---|---|---|---|
Ctrl + A | Move to the beginning of the line. | Ctrl + U | Cut/delete from the cursor position to the beginning of the line. | Ctrl + R | Search command history (reverse search). |
Ctrl + E | Move to the end of the line. | Ctrl + K | Cut/delete from the cursor position to the end of the line. | Ctrl + G | Escape from history search mode. |
Ctrl + B | Move back one character. | Ctrl + W | Cut/delete the word before the cursor. | Ctrl + P | Go to the previous command in history. |
Ctrl + F | Move forward one character. | Ctrl + Y | Paste the last cut text. | Ctrl + N | Go to the next command in history. |
Alt + B | Move back one word | Ctrl + L | Clear the screen. | Ctrl + C | Terminate the current command. |
Alt + F | Move forward one word. |
File Operations | Description | Navigation | Description | Editing | Description | Search and Replace | Description |
---|---|---|---|---|---|---|---|
Ctrl + O | Save the file. | Ctrl + Y | Scroll up one page. | Ctrl + K | Cut/delete from the cursor position to the end of the line. | Ctrl + W | Search for a string in the text. |
Ctrl + X | Exit Nano (prompt to save if modified). | Ctrl + V | Scroll down one page. | Ctrl + U | Uncut/restore the last cut text. | Alt + W | Search and replace a string in the text. |
Ctrl + R | Read a file into the current buffer. | Alt + \ | Go to a specific line number. | Ctrl + 6 | Mark a block of text for copying or cutting. | Alt + R | Repeat the last search. |
Ctrl + J | Justify the current paragraph. | Alt + , | Go to the beginning of the current line. | Ctrl + K | Cut/delete the marked block of text. | ||
Alt + . | Go to the end of the current line. | Alt + 6 | Copy the marked block of text. |
Command | Description |
---|---|
cw | Change the current word. Deletes from the cursor position to the end of the current word and switches to insert mode. |
dd | Delete the current line. |
x | Delete the character under the cursor. |
R | Enter replace mode. Overwrites characters starting from the cursor position until you press the Escape key. |
o | Insert a new line below the current line and switch to insert mode. |
u | Undo the last change. |
s | Substitute the character under the cursor and switch to insert mode. |
dw | Delete from the cursor position to the beginning of the next word. |
D | Delete from the cursor position to the end of the line. |
4dw | Delete the next four words from the cursor position. |
A | Switch to insert mode at the end of the current line. |
S | Delete the current line and switch to insert mode. |
r | Replace the character under the cursor with a new character entered from the keyboard. |
i | Switch to insert mode before the cursor. |
3dd | Delete the current line and the two lines below it. |
ESC | Exit from insert or command-line mode and return to command mode. |
U | Restore the current line to its original state before any changes were made. |
~ | Switch the case of the character under the cursor. |
a | Switch to insert mode after the cursor. |
C | Delete from the cursor position to the end of the line and switch to insert mode. |
:wq
:set nu
:set number
In conclusion, Linux is a widely used operating system for development, and as a developer, you should have knowledge of Linux and its basic commands. In this Cheat Sheet, we covered all commands like creating directories, file compression and archiving, process management, system information, networking and more. In addition to that, this Linux Cheat Sheet is organized and categorized, making it easy for developers to quickly find the commands they need for specific use cases. By utilizing this resource, developers can enhance their productivity and efficiency in working with Linux, leading to smoother and more successful development projects.
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.
You might have heard of chmod 777. This command will give read, write and execute permission to the owner, group and public .
Using the w Command, w command in Linux shows logged-in users and their activities.