We all know that scripts are a very handy way to get repetitive jobs done quicker (and much more).
Now, let’s suppose you have a script located at /path/to/dir directory.
Each time you need to run the script you would:
- Open a terminal
- change dir to /path/to/dir and then
- run your script using “./myscript” notation
- Or (a “faster” alternative) writing “/path/to/dir/myscript” to execute it
It might doesn’t look that much to do, but when you’re using it frequently, it can save time to just open a terminal and type “myscript” to run it.
So, in order to do that, you will need to:
- create a directory in which your scripts will be saved, i.e. ~/myscripts/
- open the file ~/.bashrc in a text editor and append this line:
or if you choose your directory of scripts to be anywhere else:
- As a final step you will need to source your ~/.bashrc or logout/login. To source your bashrc file type:
So, now if you have a script called remote you can open the terminal and just type “remote” and watch the magic happen! 😛