How to Create 'Shortcuts' to Freq. Used Terminal Commands

Using a shortcut file in OSX / Unix to save often used commands

How to Create 'Shortcuts' to Freq. Used Terminal Commands
8 Steps
Supplies
Embed
1

Open your terminal or terminal program of choice.

2
Enter 'nano ~/.bash_profile' without quotes. This will bring up the contents of the file .bash_profile or open a new file with that name if it doesn't exist.

Enter 'nano ~/.bash_profile' without quotes. This will bring up the contents of the file .bash_profile or open a new file with that name if it doesn't exist.

Recommended For You
3

To make a shortcut for a frequently used command like cd ~/Sites enter the following on a new line: alias gotoroot="cd ~/Sites". Here we have named our shortcut gotoroot.

4

To save the files press ctrl+x. Nano will prompt you to save the file; answer with 'Y' and then nano will ask you what you want to name the file. It already has the name .bash_profile, so hit enter.

5
To reload the bash-profile file for usage enter 'source ~/.bash_profile' and hit enter.

To reload the bash-profile file for usage enter 'source ~/.bash_profile' and hit enter.

6
Enter your new shortcut and press enter.

Enter your new shortcut and press enter.

7
You have changed directories as indicated above by the working directory.

You have changed directories as indicated above by the working directory.

8

You can use this method to save frequently used commands that are too long to remember. Try this one: find . -type f | wc -l That will return the amount of file in a directory and it's subdirectories!

keyboard shortcuts:     previous step     next step
Comments
0 COMMENTS
View More Comments