7 Linux Commands You Should Know For Smooth Working Operations

top basic linux commands

Linux is the distant cousin of Windows and macOS, using Linux is not everyone’s cup of tea. There are some Linux commands that you should know to make sure your use of Linux goes easy and hassle-free. You need to think of this as an essential reference for operating a Linux terminal. Here are our picks for the best Linux commands everyone should know. 

Essential Commands for Linux

Linux includes a large number of commands that users can master, but we’ve decided to show you the top 7 Linux commands that everyone should know. Keep these commands in mind and you’ll be much fluent with the Linux command prompt. 

1. Alias

The alias command allows the users to give their own names to a command or a sequence of commands. You can then type your shot name, and the system 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, whenever you type in “cls”, it will clear the screen just as though you have typed “clear”. If you frequently switch between Windows and Linux command lines then you may end up typing the Windows cls command on a Linux machine, if your machine didn’t understand the command earlier, using the Alias command will change that.

2. Cat

The “cat” command which is short for concatenate, lists the contents of files to the terminal window. Using this command is much faster than opening a file in the file editor, and there’s no chance you can accidentally alter the file. To read the contents of your “.bash_log_out” file, type the following command while the home directory is your current directory, as it is by default:

cat .bash_logout

Here are the other ways to use the cat command:

  • Cat>filename creates a new file. 
  • cat filename 1 filename 2>filename3 joins two files (1 & 2) and stores the output of them in a new file.
  • To convert a file to upper or lower case use, cat filename | tr a-z A-Z >output.txt

3. Pwd Command

Use the Pwd command to find out the path of the current working folder that you are in. The command will return a full path, which is basically a path of all the directories that start with a forward slash (/). An example of an absolute path is /home/username.

4. Cd Command

To navigate through the Linux files and directories, use the cd command. It requires either the full path or the name of a directory, depending on the current working directory that you’re in. 

Let’s say you are in /home/username/documents and you want to jump straight to “photos” in “documents”. To do so, simply type the command: cd Photos. 

Another situation is if you want to switch to a completely new directory, for example: /home/username/Movies. 

5. Is Command

The Is command can be used to view the content of a directory. By default, this command will display the contents of your current directory. If you want to jump to the content of other directories then type “Is” and then enter the directory’s path. For example:

Is/home/username/Documents to view the content of Documents. 

There are variations you can use with the Is command:

  • Is –R will list all the files in the sub-directories as well.
  • Is –a will show all the hidden files.
  • Is –al will list all the files and directories with their detailed information like their permissions, size, owners, etc. 

6. Cp Command

Use the cp command to copy files from your current directory to a different directory. For instance, the command cp landscape.jpg/home/username/Pictures would create a copy of landscape.jpg (from your current directory) into the Pictures directory. 

7. MV Command

The main purpose of this command is to just move files, but it can also be used to rename files. The arguments in mv are similar to the cp command. All you have to do to use this command is just type mv, the file’s name, and the destination directory. For example: mv file.txt/home/username/Documents. 

To rename files using the same Linux command, type: m oldname.ext newname.ext

Conclusion: Top Linux Commands

Basic Linux commands help the users to operate the system hassle-free. It might take a while for users to remember the commands but with enough use, using commands becomes easy. All in all, knowing and mastering these basic Linux commands will help you work smoothly. 

Leave a Reply

Your email address will not be published. Required fields are marked *