Linux is one of the favorite systems of users specialized in programming thanks, in part, to the fact that can be handled almost entirely from your command terminal, increasing the efficiency of the processes.
This efficiency provided by the commands is due since most have a series of options that modify their behavior and they provide a wide variety of alternatives for use.
In this note we will explain what are command options in Linux and how can you use them to increase the number of processes that you can do in your operating system, regardless of the Linux distribution you have.
What are options in Linux and what are they for in the operating system?
It is known as option a an extension of the command used to modify its behavior parameters and extend the scope of the command to perform different actions related to the purpose established by the users.
Is about a command line plugin that specifies the action we want it to take. The syntax of a command line is made up of three key components: command, option, and arguments. While the command determines the main action we want to carry out, the option and the arguments specifically determine the variations and scope of that action, so that the result adapts the best possible to our requirement.
What are the differences between a command and an option in Linux?
Although both parts are part of the syntax of a command line, it is necessary to be clear about the difference between command and option, since one of its main characteristics is that both need the other to function correctly. To get an idea of the difference between command and option, you just have to think in the terms “general” and “specific”, then the option provides a specific feature which is not present in the range of action of the command.
A command is an order that is entered and that performs an action, or run a program for a specific purpose. Regarding the command ls
, for example, when running shows us a list of the files in a directory.
An option, on the other hand, it is a direct indication that is written next to the command so that the executed program performs an action or show something differently. Usually an option is written as a hyphen followed by a letter. In the case of the command “ls “, which will show us a list of the files in a folder, the option –l
It will give us this list with date, user permissions, group and name of each file.
What kind of data can be used as options for a command?
The actions that can be used as command options they are generally specific addresses that modify the path or result of the main action of the executed command. For instance, from Linux command terminal, it is possible to execute a command that create a directory between two existing directories. The command to create a new directory is mkdir
, while the option –p
will specify the creation path.
Some of the options available for commands in Linux are:
-
-l
: shows a greater number of data of the elements of a list -
-p
– Create a new directory between two existing directories. -
-r
: concentrates the actions in the current directory. -
-R
: lists files in subdirectories. -
-m
– Specify reports in megabytes. -
-h
– Specifies reports in bytes, kilobytes, and megabytes. -
-n
– Specify the name of a file to perform an action. -
-I
: shows the IP address of your network.