Command Line Mastery

Whether you are software engineer, computer engineer, computer science student, nerd, tech – having the command line terminal usage under your belt can give you extra boost and make your life way easier than going around with GUI. In fact, some of the operations you are allowed to perform via command line only. We are going to dive in and start using command line today.

Warning before you start

One of the warning sign, know that command line literally takes you seriously and does not understand your mistake or anything therefore can become extremely unforgiving. So, it is worth your time to pay extra attention and double check before proceeding with various commands. You can lose everything – your data, OS and that can be irreversible.

Just be sure before hitting the enter button.

With this section, we will explore around with various commands and navigate our way around in our operating system’s folder structure. With a little heads up you will know when to use certain command and command line in general.

Command line structure: switches and syntax

You will find that all command lines have the same structure and execution format. You will type the name of the command, leading into a target of that command and any modifications you want to do to that target. You typically make this modification by adding some extra letter or number, which in tech term is called a switch or option.

This switch will then follow the command or the target. That depends on the kind of command that is type in. These commands, when you write in the right way to perform some actions are called syntax.

One thing you should keep in mind that you certainly do not want to misspell the command in any way. If a command requires you to use a backward slash, \ and you use a forward slash /, things not going to work at all. This is nothing crazy but requires your understanding, effort and time to get used to these syntax.

Getting help for the syntax

The typical syntax may look like this: [command] [target (if any)] [switches]. This one mentioned is the typical syntax, but note that the target and switch may change its place but the command will not. You will always start with a command invariably.

So, how will you figure out which comes first and last? The quickest and simplest way to do so is to typing in /? and this will let the system know that you are looking for help with this command. So, it will go something like: [command name ] /?

As for the macOS or Linux, you want to type in the help first then the command name. Help command for these UNIX based operating system is man which stands for manual, and then your command name. Something like this – man [command name]. To exit for that you just have to type q as in quit to get out of the manual.

Directory and command line

So, how about now we move around in the directory via a cool command line? To do so keep these two commands under your sleeve, dir and ls. These two commands will be your most-used commands since these are to help you explore.

dir is for windows system and ls for macOS and Linux, helps you to show you the list of contents in a directory. Directory is just your folder. When you open a command line in windows, it opens up the command line in your user folder. Typically look something like this – C:\Users\userName. There if you now run the dir command you will see the list of things inside that directory.

Now as for the Linux, it does not open the terminal in your user folder by showing off the full path but typing ls shows some of the content in your user folder, especially in Ubuntu.