Linux命令别名命令-alias | IT运维网
  • 本站启用了账户登录密码错误就锁定模式,如有人误操作被锁请邮件(yvan.lu@ityww.cn)告知我账户名。
  • 本站为个人技术性站点,上面会更新一些系统、网络、虚拟化及云计算等相关的文章,与大家一起参考、学习和交流。
  • 欢迎访问本网站;本站QQ交流群:654792529;如果您觉得本站非常有看点,那么赶紧使用Ctrl+D收藏吧!

Linux命令别名命令-alias

Linux 基础 yvan 3年前 (2021-08-11) 3958次浏览 已收录 0个评论 扫描二维码

说明:
        这个命令别名等于自定义命令,当我们需要反复频繁的操作某条或者某几条命令(针对较长的或较复杂的命令)时针对此种情况可以把需要的较长的或较复杂的命令赋予一个自定义的简短的命令来替代;

格式:alias [-p] [name[=value] … ]    #不加任何参数为查看系统当前Shell进程所有命令别名
    别名命令=’具体精确命令’:设置命令别名

举个具体的实例,Ubuntu桌面系统命令行执行rdesktop远程Windows桌面:

1、临时生效:只在当前Shell环境下生效,退出重连接或新的连接都会失效;
    直接执行命令配置命令别名即可:alias rdp=’rdesktop -u administrator -p 123456 172.16.100.164′

buntu@ubuntu-virtual-machine:~$ alias rdp='rdesktop -u administrator -p 123456 172.16.100.164'
ubuntu@ubuntu-virtual-machine:~$ rdp
Core(warning): Certificate received from server is NOT trusted by this system, an exception has been added by the user to trust this specific certificate.
Failed to initialize NLA, do you have correct Kerberos TGT initialized ?
Core(warning): Certificate received from server is NOT trusted by this system, an exception has been added by the user to trust this specific certificate.
Connection established using SSL.
Protocol(warning): process_pdu_logon(), Unhandled login infotype 1
Core(warning): Certificate received from server is NOT trusted by this system, an exception has been added by the user to trust this specific certificate.
Failed to initialize NLA, do you have correct Kerberos TGT initialized ?
Core(warning): Certificate received from server is NOT trusted by this system, an exception has been added by the user to trust this specific certificate.
Connection established using SSL.
Protocol(warning): process_pdu_logon(), Unhandled login infotype 1

Linux命令别名命令-alias
2、永久生效:需在用户自己家目录下的配置文件(.bashrc)中配置命令别名;配置后重读下配置文件(source FileName)使之立即生效;

vim .bashrc

Linux命令别名命令-alias

ubuntu@ubuntu-virtual-machine:~$ source .bashrc
ubuntu@ubuntu-virtual-machine:~$ rdp
Core(warning): Certificate received from server is NOT trusted by this system, an exception has been added by the user to trust this specific certificate.
Failed to initialize NLA, do you have correct Kerberos TGT initialized ?
Core(warning): Certificate received from server is NOT trusted by this system, an exception has been added by the user to trust this specific certificate.
Connection established using SSL.
Protocol(warning): process_pdu_logon(), Unhandled login infotype 1
Clipboard(error): xclip_handle_SelectionNotify(), unable to find a textual target to satisfy RDP clipboard text request
Core(warning): Certificate received from server is NOT trusted by this system, an exception has been added by the user to trust this specific certificate.
Failed to initialize NLA, do you have correct Kerberos TGT initialized ?
Core(warning): Certificate received from server is NOT trusted by this system, an exception has been added by the user to trust this specific certificate.
Connection established using SSL.
Protocol(warning): process_pdu_logon(), Unhandled login infotype 1
Clipboard(error): xclip_handle_SelectionNotify(), unable to find a textual target to satisfy RDP clipboard text request

Linux命令别名命令-alias


IT运维网 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明Linux命令别名命令-alias
喜欢 (3)
yvan
关于作者:
聪明来自勤奋、知识在于积累、好记性不如烂键盘!

您必须 登录 才能发表评论!