Original image from Infogalactic
What Is The Linux Command Line?
The command line is a blank screen with a blinking cursor and username. It can be very intimidated to a new user of Linux but they will soon find out how great this little application can be. It is here where you can type in commands and the computer will run them. You actually can run Linux with just a command line. No graphical user interface, no pictures, no mouse.
You will often hear the command line called the ‘terminal’ and I’ll be using this for most of the post. It is actually a terminal emulator since a terminal is actually a piece of hardware used to enter commands into the old mainframe computers of yesteryear. Your terminal emulator does the same stuff that the old UNIX terminals did except that it’s now in software and a part of the computer itself.
// Side note: you will also hear this application called a shell at times.
This seems daunting if you have never used something like this in the past and that is understandable. I was a bit of an exception to the rule as usual. Before I ever touched Linux I had a computer that only ran MS-DOS. I believe it was actually ‘Free DOS’ but it does the same thing. This was a computer that only rand a blank screen with a blinking cursor.
This may seem very limited in its ability to perform actions on your computer but I assure you it’s the exact opposite. Once you drop the mouse and start seeing all that the terminal can do you’ll be amazed. Things include text editing, programming, running programs, listening to music, installing programs, searching for files, navigating around files, and monitoring the system resources.
The more time I spend in Linux the more I find myself looking for terminal-based applications to replace the graphical ones I have always used. However, there is one thing that I don’t think I’ll ever be able to replace with a terminal and that is video playing. Videos just are not the same when you are viewing them as ASCII art…
You can even browse the internet within your terminal app. How cool is that!
Image from Infogalactic
Why use the CLI?
So you may be thinking, “J. R. why should I bother? My mouse works fine, stop trying to make me a super nerd!”. Well, I have some points below that outline why I use the terminal for most of my work.
Since the terminal does not rely on or need graphics, buttons, and windowed applications it runs much faster than a traditional method. I can easily rename a group of files with a one-line command. This kind of speed translate into faster computations and more time for you to do more cool stuff.
Let’s say you want to changes a bunch of files to lower case. You could right click them one at a time and retype the words in lower case.
You can use the terminal and tell the computer to change them all at once using what is called ‘regular expression’ and in the amount of time it would take you to right click and start changing one file with a mouse the computer will have them all finished. That’s the kind of speed I’m talking about.
Using terminal based applications are not only fast but they are lightweight. This gains a huge advantage over GUI based applications. The terminal apps get their sleekness from not having to generate a window, buttons, and other GUI stuff that we get with normal application. This allows us to have many more things running in real time.
I do this often using tmux. Tmux is a terminal application that brings a tiling window manager like feel into your terminal. We can get into tiling window managers in a later post because they are epic and makes any workflow more streamlined.
I load up my terminal emulator and within that, I run tmux. Once tmux is open I can have two terminals open side by side. Nothing too special since we can do with any window manager. Within tmux, they give you the option to have tabs of a sort. This allows you to organize your tasks into groups.
I often run a pane with a system monitor and normal terminal for general commands. Another pan will have Vim open for editing text, programs, and websites With maybe another open to browse the web for any information I may need for a given task. The best part is that I can detach from tmux and return to my normal terminal and everything keeps running in the background.
All of that is possible and my CPU does not even hit ten percent usage! When doing a heavy task such as video editing or rendering the terminal will become your best friend since it almost never hits a bottleneck.
Linux is the king of customization and the terminal applications are no exception to this rule. You are able to change colors of just about everything within your terminal. Some terminal emulators are less customization than others but you can easily install one over another.
I like tmux for this reason as well. Since it is taking the terminal to a desktop level they have a status bar that is completely customizable. You can add scripts to show the time, date, batter percentage, if you’re on a VPN, and so much more.
If you a script it with bash you can add it to your status bar. I love that, and it works a lot better than most of the GUI based options. This very nice if you SSH into servers. You can use tmux and have it customized to show you information that you need at glance.
Best way to learn the terminal
No better way than to start using it. If you do not have Linux you should be playing around with it. It can be easily dual booted next to Windows and takes up very little space (unlike Windows). You may even be able to find a terminal emulator that will run as a program within Windows to get the feel for the powerhouse of Linux.
If you own a Mac you already have a terminal built into your system. It won’t have the same exact functionality as those on Linux but you can still do a lot of cool stuff. This is because Mac’s are built as a spin-off of UNIX and that is what Linux did as well. I do believe even get tmux running within your Mac terminal.
The more you use the terminal the more you will find how much time it will save you. There is a small learning curve and there is no way you will memorize every command. There is just way too many. Run a search online for what you need to do within the terminal and you’ll find the command to do said action.
Always be careful running commands you find online and make sure you understand what the line does before executing it on your own PC. This is even more imperative if it’s asking you to run as SUDO (or root) since that will give the command full access to your operating system.
Thanks for taking the time to read. It means a whole lot that you spent your time with my work today.