How to use the Command Line like a Pro
After writing my previous post about Sass, I have realised that it is important to write a little tutorial on Command Line usage too. It will complement the recent post exploring why to use the command line and will let you to easily use the Command Line tools and its utilities. Let’s get started.
The Command Line program will be used a bit different depending on which operating system you are using – Linux, Mac or Windows. In this article I will only discuss *nix systems – i.e. Linux and Mac since they both have lots of things in common when working with a Command Line. Windows are a bit different (though the principles are the same) and therefore a separate article is coming about it. If you are using some other operating system, I will assume that you have enough knowledge about it and will be able to apply the principles discussed in this article too.
Starting the Command Line
The biggest difference of the Command Line on Mac and Linux is that on Mac it is called Terminal and on Linux it can be called Terminal, Konsole or even more specific, like Gnome-konsole. Kidding. If you dig deeper you will be able to spot the differences, but once again, the basics described in this tutorial do not differ much.
First, let’s start the Command Line. Terminal on Mac is located in the Applications folder. Alternative is to just type “Terminal” in the spotlight search.
On Linux, say Debian, you need to start the Konsole program. More detailed info on starting the Command Line on various distributions of Linux can be found here.
When you have started the Command Line, you will be presented with a black or white (depending on the configuration) window with the input prompt. It can look like this:
or this:
Now, you can write various commands into the prompt to:
- Navigate the folder structure
- View and open the files
- Search for files and for the text in files
- Start programs