Tired of typing big directory path to change to it frequently? (or)
Tired of typing big command frequently in Linux/Unix?
Have your own (small)shortcut command for those long commands.
Steps :
· Create a shell script(.sh) file with the (long)command that needs to be run frequently.
For example,
Create a file '/root/p.sh' and add the following 'cd' command to it.
-------------
cd /var/www/html
· Create an alias to that shell script.
For example,
alias w=’. /root/p.sh’
[Note: dot in the beginning makes the command to be executed in the same shell.]
Add this alias command in ‘.bashrc’ file (anywhere in the file)
Next time, to change to the ‘/var/www/html’ directory, just need to use the command ‘p’.
Note: Any long command(s) can be added to that shell script as required.
Typical commands sequence may be as follows,
vi /root/p.sh
cd /path/to/long/directory
!wq
vi .bashrc
alias w=’. /root/p.sh’