How to create custom commands in linux?
How to create custom commands in Linux to use with terminal?
As a Linux user you may like to use the Terminal and type long commands and work with those stuff. It sounds you like a hacker. But some times it takes a long time and makes you inconvenient. So...
Let's make it easy....
Step 1:
Open the Terminal(keyboard shortcut : Ctrl+Alt + t)
Step 2:
Navigate to the /usr/local/bin (command: cd /usr/local/bin)
Step 3:
Create the script file( use a name which can be easily typed)
Step 4:
Open the file that you created with nano editor
As a Linux user you may like to use the Terminal and type long commands and work with those stuff. It sounds you like a hacker. But some times it takes a long time and makes you inconvenient. So...
Let's make it easy....
Step 1:
Open the Terminal(keyboard shortcut : Ctrl+Alt + t)
Step 2:
Navigate to the /usr/local/bin (command: cd /usr/local/bin)
Step 3:
Create the script file( use a name which can be easily typed)
Step 4:
Open the file that you created with nano editor
Then type #!/bin/bash at the first line and type your command that you want to make shorter at the next line.
Then press Ctrl+x to exit and nano editor automatically prompts you to save the file.
So press 'y' and press Enter.
Step 5:
Congratulations! You did it ;)
Now close the Terminal and open a new one.
Just type your script name and press Enter.
ex: $ mycmd.sh
It should work!
Comments
Post a Comment