说明:
这个命令别名等于自定义命令,当我们需要反复频繁的操作某条或者某几条命令(针对较长的或较复杂的命令)时针对此种情况可以把需要的较长的或较复杂的命令赋予一个自定义的简短的命令来替代;
这个命令别名等于自定义命令,当我们需要反复频繁的操作某条或者某几条命令(针对较长的或较复杂的命令)时针对此种情况可以把需要的较长的或较复杂的命令赋予一个自定义的简短的命令来替代;
格式: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
2、永久生效:需在用户自己家目录下的配置文件(.bashrc)中配置命令别名;配置后重读下配置文件(source FileName)使之立即生效;
vim .bashrc
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