This easy cheat sheet can allow you to get familiar with the Linux command line terminal very quickly.
The Linux command line also referred to as the terminal, may be an intimidating location. However, it may also be your best tool.
Text controls frequently get the job done no matter that Linux-based working system you use, and the outcomes tend to be quicker than what a graphic desktop computer interface may provide.
Nevertheless, even for long-time customers, you’ll find too many orders to commit to memory. That is why we’ve prepared this useful cheat sheet of Linux commands. And should you would like to run a few of these, check out the way to multitask about the Linux terminal together with Display.
The Linux Command Line Cheat Sheet
Terminal | |
---|---|
clear | Clear the terminal screen. |
history | Display recently used commands. You can also view these commands via the Up and Down keys. |
! | Repeat a recently used command. You can use !n to repeat the n-th command in history or !-n to repeat what happened n commands ago. |
man | Display the manual for a terminal program. |
whatis | Display a brief description of a terminal program. A simpler alternative to the man command. |
alias | Create a shortcut to a command or, when combined with the cd command, directory. |
exit | Exit or close the terminal. |
Navigation & File Management | |
cd | Change directory. Used to navigate between folders. |
pwd | Display current directory. |
cd | Change current directory. |
ls | Display a list of files in the current directory. |
cp | Makes a copy of a file. Defaults to the current directory unless you specify a specific one. |
mv | Move a file from one directory to another. |
rm | Remove a file or set of files. |
stat | Display when a file was last accessed, modified, or changed. |
touch | Change the date accessed or date modified time of a given file to right now. |
rmdir | Delete a file or files. |
mkdir | Create a directory. Defaults to the current directory, but you can also specify one. |
rmdir | Delete a directory. Defaults to the current directory, but you can also specify one. The target directory must be completely empty. |
rename | Change the name of a file or set of files. |
find | Search a specific directory (or your entire PC) to find files that match designated criteria. |
locate | Search for files or directories. Faster than the find command, but has fewer options. |
grep | Search a specific file or set of files to see if a string of text exists and where. |
mount | Attach a separate filesystem (such as an external hard drive or USB stick) to your system's main filesystem. |
umount | Detach a separate filesystem from your system's main filesystem. |
cat | Display the contents of a text file. Also works with multiple files. |
chmod | Modify the read, write, and execute permissions of a file. |
chown | Change the user or group that owns a file. |
Users | |
su | Switch user. Unless you desigate a specific user, this command will attempt to sign in as the root user (which you can think of as the system administrator). |
whoami | Displays the current user name. |
id | Display current user and group. |
passwd | Create or update a user's password. |
System Administration | |
uname | Displays core system information such as kernel version, hardware, and operating system. |
sudo | Enter before a command to perform the command as a system administrator. User must have administrator priveleges for this to work. |
apt/dnf/pacman | Programs for installing software and updates. Which one to use depends on your Linux-based operating system. Each requires administrator rights and additional instructions, such as sudo apt install program-name . |
jobs | Display the status of all current jobs. A job is a representation of a running process or group of processes. |
bg | Send a job to the background. |
fg | Send a job to the foreground. |
kill | End a process according to its process ID (which you can get using the ps command. |
killall | End all processes whose names match your query. |
ps | Display a list of running processes. Defaults to processes started by the current user. |
top | Displays a list of running processes, sorted by how much CPU each uses. Unlike ps, the command updates in real-time. |
uptime | Displays time since last boot. |
whereis | Finds the executable file for a program. |
df | Displays how much disk space is used and free on your system. |
free | Displays how much RAM is used and free on your system. |
Network Management | |
ip | Displays you IP address, network interfaces, bandwidth usage, and more. |
ping | Send or receive data from another computer on a network. Often used to test whether a network connection is established and the speed of that connection. |
dig | Look up a domain's DNS address |
wget | Download a file. |
ssh | Secure Shell. Connect and login to a remote network location. |
Miscellaneous | |
echo | Display a line of text. Often used in programs and scripts to relay information to users. |
factor | Displays possible factors of a decimal number. |
expr | Solve math equations. |
look | Look up a word in the dictionary. |
More Linux Terminal Commands
As comprehensive as this Linux commands cheat sheet could be, the listing is merely scratching the surface. There’s much more you can do at the terminal than we can ever aspire to match on a single page. Plus many controls change based on your Linux-based functioning system or need installing additional applications. The controls above are very likely to function out-of-the-box on many Linux machines.
All of the things in this cheat sheet are all helpful, but you will find other Linux commands which are just plain entertaining. If you are a newcomer, you ought to understand how to look at your Linux version also.