Custom commands for linux terminal

Linux operating system allows users to create commands and execute them over the command line. To create a command in Linux, the first step is to create a bash script for the command. The second step is to make the command executable.
Syntax :

 $ nano .bashrc 

Here, bashrc means run the Bash file. Bash is located at /bin/bash . This file helps in creating environment with help of startup files. nano is text editor. Instead of nano, you can use gedit text editor which is GUI base and most of the users are comfortable with it. Then we have to search content as shown below.

# some more ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'

In the above figure :
alias :It allow to user to make custom commands.
unalias :It allow to user to stop working of any command.

Make custom command for our own purpose :

alias [name]=' [command 1]; [command 2]; [command 3]; .....  [command n]'

In place of name provide your custom command.
In place of command 1 provide first command that you want to exceute.
In place of command 2 provide second command that you want to exceute.

Example :

alias ok='echo hELLo WorlD; firefox'

echo hELLo WorlD it will display hELLo WorlD in termainal.
Enter your commands in sequence and then hit CTRL + O to save your commands in file.
Then, hit ENTER for the confirmation and then, hit CTRL + X to exit from file. Now, Restart your terminal.
Now, whenever you will type ok it will execute your command.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :


Please write to us at to report any issue with the above content.