alias 来简写你常用的命令

alias vncmybox=’ vncviewer admin@192.168.245.231′

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 admin@192.168.245.231′

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值