Javatpoint Logo
Javatpoint Logo

Linux Arguments

An argument, also called command line argument, can be defined as input given to a command line to process that input with the help of given command. Argument can be in the form of a file or directory.

Arguments are entered in the terminal or console after entering command. They can be set as a path. We can also write more than one argument together, they will be processed in the order they are writtten.



Linux Arguments1

Look at the above snapshot, command "cd Downloads" has changed our directory to Downloads.

Command "ls sample" list down the sample content.

Command "cd /home/sssit/Desktop" set our path for Desktop directory.

Command "file javatpoint jtp.txt" displayed 'javatpoint' file type first and than 'jtp.txt' file type.

White space removal

White spaces are invisible but take up the spaces. While executing the command these white spaces are automatically removed from the output.

Here, we'll use echo command which is used to print the output that it receives from the shell.



Linux Arguments2

Look at the above snapshot, all the arguments will display the same output by removing white spaces irregarding of the spaces present between them.

Single and double quotes

If you want white spaces to be displayed then use them within the quotes. You can use single as well as double quotes. Write argument within the quotes and print it with 'echo' command.

Linux 'echo' command will consider the whole data as a single argument within the quotes.

Although, there are some important differences between single quote and double quote which we'll study further.


Linux Arguments3

Look at the above snapshot, output includes spaces as given in the command line.

echo -e

Linux 'echo -e' command is used with '\n' and '\t' to start a new line and add a tab space respectively. It works within single as well as double quotes.


Linux Arguments4

Look at the above snapshot, '\n' displayed the output in a new line and '\t' displayed the output with a tab space. Single and double quote displays the same output.

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA