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.


Recommended Posts:
- Cool Custom Welcome Messages on Linux terminal
- Formatted text in Linux Terminal using Python
- How to copy a file's content from Linux terminal?
- Fun Commands in Linux
- Linux Commands
- Internal and External Commands in Linux
- Essential Linux/Unix Commands
- Basic Shell Commands in Linux
- Basic Linux Commands for day to day life
- Daily life Linux Commands
- Useful and time saving bash commands in Linux
- Python | Execute and parse Linux commands
- halt, poweroff and reboot Commands in Linux
- Network configuration and trouble shooting commands in Linux
- Important Linux Commands (leave, diff, cal, ncal, locate and ln)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. 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.



