Ubuntu Command Structure

Now, one reason that Linux is amazing is that the commands that you type all follow a similar type of structure in the way that you type them. Now, by understanding the structure, you’ll be able to transition from simply just memorizing commands and hoping for the best to actually understanding the common language that all Linux commands use.

And that will give you a massive boost in your abilities and the commands themselves will actually start to look like a language rather than just random gibberish. OK, so the first thing you need to know is that all commands are effectively just little computer programs that are installed somewhere on your computer.

So, for example, date is a program. cal is another program and many other like echo, time, etc are the programs. Here is the example in the screen shot shows the command only

$ date

Then you give the command some options to customize its behavior, then you give the command some inputs to actually operate on. The following screen shot shows you the best

Now you can customize the way that commands work by giving them different options and different inputs. Let’s go ahead and start with the inputs. So it’s important to note that not all commands actually require inputs. Some inputs are optional.

For example, the date command doesn’t strictly require an input.You can just type date and done with it.but most commands do require some form of input which can actually have a fancy name called an operand, because commands operate on the input.The input is sometimes called an operand.

So for example, if we take the cal command, I could just type cal and press enter and I would get this month’s calendar.

$ cal

But to customize the behavior, if I want to get the calendar for the year 2021, I could type cal twenty twentyone (2021) press enter now I get a completely different output.

$ cal 2021

You can see now that I get I’ve given commands to inputs that is twenty twentyone. So I’ve said here can you give me the the calendar for twenty twentyone.

That’s Pretty cool right.

and Similarly with two inputs, I have type cal dec 2030 (or use you type cal 12 2030) and here is the output

$ cal dec 2030
$ cal 12 2030

This is how the structure of the command in linux system goes on. Actually these are commands or we can say programs are stored in the linux file systems called $PATH and from where the shell searches and execute. This is the another topic and is covered in different article. Hope you enjoyed the topic. See you in the next article.

Leave a Reply