Linux might not be as popular an operating system that Windows or MAC but, it does have its established user base. It is important to know that Linux is not just an operating system meant to be used by geeks. It is in fact, capable of doing much more that what a simple Windows operating system can do. Therefore, people who are actually familiar with the ins and outs of operating systems mostly prefer Linux over other operating systems.
This articles introduces some very basic Linux commands that every beginner should know. Some of these might come in handy with even expert users. Some people might argue that knowing these commands and such others is not worth it anymore owing to the fact that most of the famous Linux distributions now have a GUI. While that is correct, the power that comes with the command line utility (known as a terminal in Linux) is much more compared to using a simple GUI. Therefore, without wasting any more time, lets jump into our main topic and go over some basic Linux commands that everyone should know.
Similar to the “Folders” in a Windows operating system, Linux has directories. How does one make directories, you may ask? Well, by using mkdir! This simple command will make a new, empty directory in the directory which you are currently accessing. So, for example, if your current directory is “Home”, you new empty folder will be created in the Home directory.
The previous command taught you how to make a new directory inside your current directory. But what if, you want to create a new directory at a different location? There is a simple solution to this problem; change your directory! the cd command does just that. It takes you to your required directory and then you can create a new directory there, as you originally intended to.
Made your directory at the wrong place? Or simply changed your mind after making it and want to get rid of it now? Remove it using the rmdir command. This command will remove the directory whose name it is fed, as shown in the following example:
The ls command simply lists all the files and directories located inside your current directory. So if I wanted to know whether the NewFolder has actually been deleted from the Desktop, I’ll just go to the terminal, and type in ls which will print out a list of all the current contents of my directory as shown below:
Note that, when my current directory had no sub-directories or files, the ls command did not show any message. But, when there was a sub-directory present, it simply printed its name.
Copy-pasting files and folders from one destination to another is a rather common practice among computer users. Linux provides the copying functionality through both the terminal and the GUI. To make the use of the former, simply use the cp command followed by the named of the source and then the destination separated by a space. It should be remembered however, that cp alone cannot shif entire sub-directories or directories from the source to the destination. To do this, cp -r is used. The following example shows exactly how to do this.
This command is used to move files or folders from one directory to another. Both directories may be present as sub-directories inside a single directory or they may exist as two independent directories. In the demonstration given below, a new sub-directory named “T” was moved into another sub-directory already present on the Desktop. Then, this directory, named as “ThisFolder” was moved to the “Home” directory (~ is often used as an abbreviation for the Home directory).
It is possible, rather common, for users to have a large number of text files stashed somewhere in their computer with valuable information on them. While some of these files may be short, some may have lines upon lines of information. To find your desired needle from this haystack of data can be a painful task which is why grep is used to take care of this issue. grep -i followed by the string that you want to search for, and the file from which it is to be searched (separated by a space) returns a case insensitive result from the given file. The following example will help you get a better understanding of how to use grep.
This is another very useful command that can help you look for files without having to go through a whole list of them by yourself. This command can be used in a number of ways. The most common ones include, a case sensitive find and a case insensitive find, specified by the parameter “-iname”, following the keyword, find. Take a look at the following example:
One of the most helpful commands in the terminal to get to know about what exactly a command does is whatis. It is simple to use and returns an precise, one-liner telling about the functionality of the command that you searched for. More on how to use whatis, in the picture below:
This is the most helpful command in the Linux terminal. It can tell you about the different kinds of parameters that go with a specific command and their exact functionality. So, even if you are a beginner and have little or now knowledge about a specific Linux command, you can simple type in, –help after the command name and it will return a comprehensive log on the usage of that specific command.
This concludes our article on the basic Linux commands that everyone should know. If you are a beginner, make sure that you remember these so that you can easily make you way out of a messy situation, should you end up in one. For expert users with years of experience, it is common to forget about the basics, and well it is lethal. Use this article as an opportunity to catch up on the forgotten material.
Until next time!