Essential Linux Commands To Get You Started
These essential Linux commands form the basis of your everyday work. It just makes sense to leverage these utilities as much as possible.
Essential Linux Commands
The whole advantage you could say with Linux is the power and freedom it gives you. With its software repositories and command line environment you can make your computer behave the exact way that you want. You do not have to rely on any other company to allow your computer to run right. This is the importance of Linux and it is why we learn the commands and the way it works.
Linux utilities are the heart and soul of the operating system. They do more than anything in a graphical environment can. For any utility you can see all of its options by using the man command with any utility. So just open a terminal and try them out. Feel free to experiment too.
This is a starting list of essential Linux commands and utilities that I think are the most useful. Consider this as a reference with examples you can refer to. I use this myself whenever I forget something. There are a lot of commands so is almost impossible to remember them all and how to use them. I hope this article helps and keeps your work moving!
Cd
This is your main command for moving around in the filesystem. Here are some examples.
This takes you to your Music folder. cd Music
This will take your to the Documents folder. cd Documents
If you need to go up one level then try this. cd ..
Goign to your Home directory is easy to do. cd
That is all it takes. There are more advanced uses but this will be how the majority of users will do it.
Clear
It lets you clear your current window of activity. clear
This is a simple but useful utility. Sometimes you might have a need to only show certain things in your terminal. This will reset you quickly. I used it several times when writing this post because I did not want my terminal to be cluttered.
There are so many commands in Linux that sometimes it is hard to keep track of what you have done. This is not a huge issue but it comes up from time to time. If you have had a very long terminal session going then you will have a screen full of commands and output from those commands. So occasionally you might just want to clean things up. That is what this command is for.
History
This will show your history of commands. history
The <history> command will conveniently show the history of all the commands you have issued. This can be useful if you do not want to repeat long commands again.
Ls
The basic form shows the most basic information. ls
Show everything including hidden files. ls -a
Shows author of each file. ls --author
Makes output more human readable. ls -h
List files by size. ls -s
Lists and sorts by file size. ls -S
This is one of the basic essential Linux commands because it displays information about files. It will work on a single file or multiples if used as an argument. There are a variety of ways to using it.
Cat
This command will show the contents of a file. cat some_file
This utility displays a file and its contents. It is the simplest of the utilities. Its arguments are any files you want it to join or view. There are options available depending on your needs. One of the most useful is numbering the lines.
Pwd
This describes your present working directory. pwd
While there is not a lot to this utility, it can still be helpful.
Cal
Shows a mini calendar in the terminal. cal
This is a handy little Linux utility. It shows the month in day form while highlighting the current day. Not much more to be said for this but when your in a hurry and do not want to close window or switch to another one this can give you the information quickly that you need. It is just a 3 letter command so it is quick.
Sudo
This gives you superuser privileges if you have the access. sudo [command]
This is a very useful and quite essential Linux commands. It allows one to have superuser privileges on a case by case basis. This is important because you will generally have to think about what you are doing while using this. If you run as root all of the time then you will forget the ramifications of your actions at some point and make some drastic mistakes.
Mkdir
This command will create directories for you. mkdir New_Music
This is also one of those essential Linux commands to know. Mkdir is pretty self explanatory and has a bunch of options. So look at the manual page for them if you are curious or have a need.
Cp
This will make a copy of a file for you. cp document1 document 2
This is the copy command. It's one of the essential Linux commands that you will use often. It will copy files or directories to whatever location you designate. There are many options available. For a full list just use [man cp] in a terminal. I will go over the ones I think are most important. The -a option is for archiving and tries to preserve permissions. The -r option is again for recursively copying directory contents over to another directory.
Grep
This is a very valuable command. grep "event" error_log
This will search for for any mention of the word "event" in the file.
This is one of the most important Linux commands and is the foundational search command. It is the most useful one in my opinion so it pays to know it well in how to use it. It can search in one or multiple files at once. You use it to look for strings of text that will identify something you are looking for. Its first argument is the pattern you are looking for. The you direct it where to look for that pattern at. There are various options for using this.
The -c option lists all the files it finds a match in and then displays how many matches are in that file. This is useful for relevancy. The -color option will output any matches in color on your screen to make it easier to see what has been found. The -w option will look for any word that you use as an argument. This is also very useful.
Tail
This shows you the last portion of a file. tail -f error_log
The tail Linux utility will output the last 10 lines of a file to your screen by default. This is useful when you need to quickly know the contents of a configuration file. The best option it has is for adjusting how many lines you want it to count. The default is 10 but if you use -8 and then your filename then it will output the last 8 lines of your file.
If you have ever opened up a big log file before then you will know what I mean. It can take forever to get to the end or even the middle of the file.
Chmod
Another of the essential Linux commands, changing permissions ona file is very important.
Allows any user to execute this file. chmod +x song
Gives read permission to all users. chmod +r song
Gives you full permissions and everyone else just read/execute. chmod 755 song.txt
This is how you change permissions. Linux has a very flexible permission system. It is good to understand what is happening even if you are just a user.
Conclusion
This is the list of the Linux essentials commands that I find the most useful. There are many other ones of course and soon I will try to cover more of them. If you know these though they will give you a great start in learning how to navigate and control the various processes that you do on a daily basis in any Linux system. For more information on any particular command you can use the man page for that utility.