Linux Essentials

Linux Essentials

In this living document I will be talking about the Linux essentials that I think everyone will need to know if they use this wonderful software.

 

Chapter 1 - History And Usage of Linux

Linux is a direct descendant of the Unix operating system. Unix was created by government researchers who needed some custom tools. It spread to universities and students popularized it greatly. Berkeley also played an important part because they modified it extensively. This became known as BSD, the Berkeley Software Distribution. This was now an important time in the history of Linux. At the same time there was also Unix System V, which came from the version maintained by Bell Labs.

Linus Torvalds

Torvalds was a Finnish student in the early 90s. He was working on the core of that would be the Linux kernel as we know it. After it was finished, he combined it with the GNU operating system for the applications. Linux the name comes from the combination of Linus and Unix.

Distributions

Neither a kernel nor applications make a complete operating system. So putting them together was a must. It just so happened that different parties each the separate part ready. Others have since as well. The combination of a kernel and related packages, that run on that system, are known as a distribution. There are hundreds of distributions today. They include development systems, word processing, spreadsheet software, music players, and many other nice utilities.

Software

There are tons of nice packages available for Linux systems today. Most are free, but you can buy some also that will include extras like nice support built in. Graphics tools, web servers, and networking utilities are some of the most popular packages.

Supported Platforms

Almost everything today will run Linux. Intel, Mac, IBM, and Arm based computers all run Linux and does so very well. In fact, Linux is only getting more popular.

Portability

Originally, Unix messed this part up because vendors made versions all for themselves. So the market was very fragmented. However, Linux was written most in the <C> language. This allowed it to be portable between other systems. Doing so allowed it to spread much quicker than Unix ever could.

The Kernel

The kernel’s job is to distribute the computer’s resources. The resources of a computer are things like cpu and memory. Peripherals need access to these items as well, so the kernel will make sure each one gets what it needs. Software will request resources through system calls. The kernel then gives the software what it needs.

Multiuser Support

A Linux system is designed to have many users on one computer. This gives them each their own little area of the operating system and storage. This makes cost a lot less. In fact, this was often done to save money. An organization could have one nice machine and dumb terminals to access located anywhere in the building. It is probably still a good idea if you think about it. Another advantage to this is that it makes the machine more cost efficient. No one can use all of a machine’s resources constantly. So if one person is using it then most of the resources are going unused. This goes hand in hand with the task system. Since Linux is designed to handle multiple users, it can also handle many concurrent tasks at the same time too. This means that each user can run many processes at the same time.

Bash And Other Shells

A shell is a Linux command interpreter. This is just an interface to the core of the operating system. It allows you to run commands and have them act instantly. It is a very powerful concept. Bash is the most popular shell, but there are many other ones. Some are older, but many are newer as well. Each user on a machine can use his own shell if that is his preference. This allows for nice customization.

Desktops

Originally computers were mostly used with shells. This involved users issuing commands as needed on a machine. They could do calculations, manage a server or use a text editor. Eventually, however, a GUI was created, and these were the first desktops. When I say desktop, I am referring to the graphical system that lets you do the same tasks as a shell. The Gnome, Cinnamon, and KDE desktop environments are some of the most popular today. They each have a very different style, but they are also fun to learn. They are fun because each has its own advantages. Today, you can even get desktops with certain spins built in to them. A spin means they come with certain software packages that do a certain role. For example, I could download an Astronomy spin that would include many types of Astronomy software. That is a really cool feature, by the way.

Utilities

Linux comes with many types of useful programs called utilities. These all do some unique task and do it very well. These are the basis behind the commands that you use in a terminal window. I can check the speed of my system, disk space, free memory, cpu usage by process and the list could go on and on.

Application Development

This is one of my favorite features. Almost every distribution has program development built in to its core. Compilers and interpreters are there. Several text editors are there too. Support for several languages come right out of the box. You can start with C++ or C immediately after an install. In one distribution I have, a very nice Python pdf book is even included along with its support of course. Many times an IDE is also included if you prefer that kind of workflow.

Whole books have been written about the history and usage of Linux. It is very rich in history and you can spend a lifetime learning useful things that you can with Linux. Did I mention it is free and has the best computing community in the world? While it came from Unix, it has far surpassed its digital parent. There is a distribution for everyone. It does everything and more that a Windows and Mac computer can do. This is because 99% of the software is free and easily installed.

 

Chapter 2 - 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.  

 

This is the list of the essential Linux 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.

 

Subscribe

* indicates required