alias 来简写你常用的命令

alias vncmybox=’ vncviewer [email protected]

Now you have created your first alias. Anytime during the session you type vncmybox it will run the command we assigned to that alias.

Here is the catch, as soon as you close the terminal all is lost.

Let’s make this change permanent.

Go to you home folder and create a file named:

.bash_aliases

(This can also be done via the terminal like so:

touch ~/.bash_aliases

Then add the alias we created earlier on the first line of this text file as so: (Remember to open this file from your home folder you will have to show hidden files by pressing ctrl + h when in your home directory)

alias vncmybox=’ vncviewer [email protected]

Save the file and open the file named:

.bashrc

Find the section that is commented out (lines preceded with #’s) to looks like this:

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

Uncomment those lines. Save and close and then open a new terminal window.

Now type:

alias

It will list your aliases including the one we just added. Now you can go back and add other commonly used commands to your .bash_aliases file to ease your terminal tasks.

你可能感兴趣的:(F#,bash,Go)