37 Important Linux Commands You Should Know

Share

fatmawati achmad zaenuri/Shutterstock.com

Are you new to Linux or just a little rusty? Here are all the commands you’ll need to know. Think of this as an essential reference for the Linux terminal. This applies to the macOS command line, too.

The Essential Toolkit for the Terminal

Linux includes a large number of commands, but we’ve chosen 37 of the most important ones to present here. Learn these commands, and you’ll be much more at home at the Linux command prompt.

The below list is presented in alphabetical order. A command’s position in the list is not representative of its usefulness or simplicity. For the final word on a command’s usage, refer to its man pages. The man command is in our list, of course—it’s short for “manual.”

1. alias

The alias command lets you give your own name to a command or sequence of commands. You can then type your short name, and the shell will execute the command or sequence of commands for you.

alias cls=clear

This sets up an alias called cls . It will be another name for clear . When you type cls, it will clear the screen just as though you had typed clear . Your alias saves a few keystrokes, sure. But, if you frequently move between Windows and Linux command line, you can find yourself typing the Windows cls command on a Linux machine that doesn’t know what you mean. Now it will know.

Aliases can be much more intricate than that simple example. Here’s an alias called pf (for process find) that is just a little more complex. Note the use of quotation marks around the command sequence. This is required if the command sequence has spaces in it. This alias uses the ps command to list the running processes and then pipes them through the grep command. The grep command looks for entries in the output from ps that match the command line parameter $1 .

alias pf="ps -e | grep $1"

If you wanted to discover the process ID (PID) of the shutter process—or to find out if shutter was even running—you could use the alias like this. Type pf,  a space, and the name of the process you are interested in:

pf shutter

alias command in terminal window

Aliases defined on the command line will die with the terminal window. When you close it, they are gone. To make your aliases always be available to you, add them to the.bash_aliases file in your home directory.

2. cat

Read the remaining 186 paragraphs

Source : 37 Important Linux Commands You Should Know