Linux Lexicon: Basic Linux Commands | fossBytes
As the Linux Lexicon bandwagon gathers pace, after covering Linux Directory Structure and Linux Shell, we find ourselves pondering over the Basic Linux Commands which one must be aware of, as a beginner!
In the previous article, I talked about the Linux Shell and the Terminal. Consider the terminal to be your best buddy, once you are inside a Linux system. You can execute any Linux command by just simply typing it in the terminal.In this article, I am going to provide you a brief overview of some of the most commonly used and essential Linux Commands. Becoming familiar with these commands will help you get far in a fairly short amount of time.
Before we get started, remember the fact that Linux commands are case-sensitive. What it means is that the command ‘ls’ is treated differently as compared to ‘Ls’,’LS’ or perhaps ‘lS’ and similarly for other commands.
Items that are surrounded by brackets ‘[]’ are optional and you may include them on the basis of the function that you wish to perform. Adding these options adds a sort of extra functionality to the Linux command.
ls
The ls command is used to list the contents of the directory (just in case you are getting confused: a directory can be considered as being analogous to a folder of Windows). You will be using the ls command to gain information about the files and directories.
As I mentioned above, we can add certain options to a Linux command in order to make it do a little bit of extra work. Here’s is how it happens:
cd [dir]
The ‘cd‘ command is used to change the current directory i.e we use this command to switch over to some other directory whose contents we might want to view or perform particular operations upon. It is basically used for navigation purposes. Using this command changes the current directory to ‘dir’. If you simply use the cd command without specifying the directory, it changes the current directory to the home directory.
pwd
The pwd command is used to display the name of the current working directory. In case you are unaware about it, use the pwd command to determine the directory that you are currently placed in.
cat [file]
The cat command concatenates and display files. This command is used to display the contents of the file mentioned along with the command.
echo [argument]
The echo command is one of the most commonly used Linux commands and is used to display the argument mentioned in the command on the screen. It basically displays a line of text/string on standard output or a file.
clear
Sometimes while using the Terminal, there is a tendency for things to get cluttered. There could be too much information on the screen or you might, no longer require the data being displayed. In such cases,we use the clear command to (no prizes for guessing) clear the screen and get rid of the contents of the screen.
exit
As the name suggests, the exit command is used to exit the shell or your current session.
man command
One of the Linux commands that would come to your rescue when things get sticky is the man command. The man command displays the online manual for the ‘command’ specified along with the word man. It is sort of like the help menu. You can get information about any of the command, its function, the options associated with it etc. By using the man command:
This documentation provided for any Linux command by the man command is called ‘man pages’.
Here are some more Linux commands that you should know:
rm: This command removes files and directories.
cp:Â This command copies files and directories.
mv: This command moves files and folders between directories.
mkdir: This command makes a new folder in your working directory.
cal: This command shows calendar on you Terminal.
nano:Â This command is a command line text editor.
sudo: This command gives you the super user privileges.
If you are willing to learn more about Linux command line tools related to various system processes, hardware, users, network etc. here’s a link to a useful cheatsheet.
There are hundreds of Linux commands out there. But, I would advise you to first try out these commands on your own system and gather a basic idea of how they work. You could also refer to the man pages of each command in order to gain more knowledge about them. We shall keep discussing these commands in greater detail in upcoming articles.
Got any doubts, queries of your own, or any suggestions on the topics that you would like us to cover? Drop them in the comments below.