Linux Arguments Introduction

The argument, also call command line argument, can be define as input given to a command line to process that input with the help of given command.

It can be in the form of a file or directory.

Arguments are enter 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 process in the order they are write.

Sample syntax of :

# <command> <argument>  
# <command> <argument> <argument>  

Like example of :

 # cd Downloads  
 # ls sample  
 # cd /home/student/Desktop   

This command “cd Downloads” has changed our directory to Downloads

Linux ls sample list down the sample content.

See the command “cd /home/sssit/Desktop” set our path for Desktop directory.

Command “file example test2.txt” displayed ‘example’ file type first and than ‘test2.txt’ file type.

White space removal

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

Now we will use echo command which is use to print the output that it receives from the shell.

Sample syntax of :

# echo <typedTtext>  

Like example of :

# echo welcome to example   

See your terminal after run the command, all the arguments will display the same output by removing white spaces regarding of the spaces present between them.

Single and double quotes

You want white spaces to be display then use them within the quotes.

It can use single as well as double quotes and write argument within the quotes and print it with ‘echo’ command.

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

There are some important differences between single quote and double quote which we’ll study further.

Sample syntax of :

# echo < 'typedTtext' >  
# echo < "typedTtext" >  

See your terminal after run the command, output includes spaces as given in the command line.

echo -e

‘echo -e’ command is use with ‘\n’ and ‘\t’ to start a new line and add a tab space respectively. That works within single as well as double quotes.

Sample syntax of :

# echo -e < 'typedTtext' >  
# echo -e < 'typedTtext" >  

See your terminal after run the command, ‘\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.