{"id":121395,"date":"2018-10-05T08:13:02","date_gmt":"2018-10-05T00:13:02","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=121395"},"modified":"2018-09-26T09:13:58","modified_gmt":"2018-09-26T01:13:58","slug":"linux-use-alias","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-use-alias.html","title":{"rendered":"\u5728Linux\u4e2d\u901a\u8fc7alias\u8bbe\u7f6e\u547d\u4ee4\u522b\u540d"},"content":{"rendered":"
\u6709\u65f6\u5019\u5728Linux\u4e0b\u6267\u884c\u4e00\u6761\u547d\u4ee4\u8fc7\u957f\uff0c\u633a\u9ebb\u70e6\u7684\uff0c\u6211\u4eec\u53ef\u4ee5\u5728.bashrc\u6587\u4ef6\u4e0b\u8bbe\u7f6ealias\uff0c\u5bf9\u547d\u4ee4\u8bbe\u7f6e\u7b80\u77ed\u7684\u522b\u540d\uff0c\u76f8\u5f53\u4e8e\u7f29\u77ed\u547d\u4ee4\uff0c\u65b9\u4fbf\u64cd\u4f5c\u3002<\/p>\n
<\/p>\n
alias \u522b\u540d=\u2019\u539f\u547d\u4ee4 -\u9009\u9879\/\u53c2\u6570\u2019<\/p>\n
\u4f8b\u5982:<\/p>\n
alias ll='ls -lt'1<\/pre>\n\u8fd9\u6837\u8bbe\u7f6e\u4e86ls -lt\u547d\u4ee4\u7684\u522b\u540d\u662fll\uff0c\u5728\u7ec8\u7aef\u8f93\u5165ll\u65f6\uff0c\u5219\u76f8\u5f53\u4e8e\u8f93\u5165\u4e86ls -lt\u547d\u4ee4<\/p>\n
\u6ce8\u610f\uff1a \u5728\u5b9a\u4e49\u522b\u540d\u65f6\uff0c\u7b49\u53f7\u4e24\u8fb9\u4e0d\u80fd\u6709\u7a7a\u683c\uff0c\u5426\u5219shell\u4e0d\u80fd\u51b3\u5b9a\u60a8\u9700\u8981\u505a\u4ec0\u4e48\u3002\u4ec5\u5728\u547d\u4ee4\u4e2d\u5305\u542b\u7a7a\u683c\u6216\u7279\u6b8a\u5b57\u7b26\u65f6\u624d\u9700\u8981\u5f15\u53f7\u3002\u5982\u679c\u952e\u5165\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u7684alias \u547d\u4ee4\uff0c\u5c06\u663e\u793a\u6240\u6709\u5df2\u5b9a\u4e49\u7684\u522b\u540d\u3002<\/p>\n
2.\u67e5\u770b\u5df2\u7ecf\u8bbe\u7f6e\u7684\u522b\u540d\u5217\u8868<\/strong><\/span><\/div>\nalias -p1<\/pre>\n3.\u5220\u9664\u522b\u540d<\/strong><\/span><\/div>\nunalias \u522b\u540d1<\/p>\n
\u4f8b\u5982\uff1a<\/p>\n
unalias ll1<\/pre>\n4.\u8bbe\u7f6e\u522b\u540d\u6bcf\u6b21\u767b\u5165\u53ef\u7528<\/strong><\/span><\/div>\nalias\u547d\u4ee4\u53ea\u4f5c\u7528\u4e8e\u5f53\u6b21\u767b\u5165\u7684\u64cd\u4f5c\u3002\u5982\u679c\u60f3\u6bcf\u6b21\u767b\u5165\u90fd\u80fd\u4f7f\u7528\u8fd9\u4e9b\u547d\u4ee4\u7684\u522b\u540d\uff0c\u5219\u53ef\u4ee5\u628a\u76f8\u5e94\u7684alias\u547d\u4ee4\u5b58\u653e\u5728 ~\/.bashrc \u6587\u4ef6\u4e2d\u3002<\/p>\n
\u6253\u5f00~\/.bashrc\u6587\u4ef6\uff0c\u8f93\u5165\u8981\u8bbe\u7f6e\u7684alias\u547d\u4ee4\uff0c\u4fdd\u5b58\uff0c\u7136\u540e\u8fd0\u884c<\/p>\n
source ~\/.bashrc1<\/pre>\n\u5982\u679c\u8fd9\u6837\u8fd8\u4e0d\u884c\uff0c\u8868\u793a\u6ca1\u6709~\/.bash_profile\u6587\u4ef6\u6216\u6587\u4ef6\u4e2d\u6ca1\u6709\u6267\u884c~\/.bashrc\u6587\u4ef6<\/p>\n
\u53ef\u4ee5\u5728~\/.bash_profile\u4e2d\u52a0\u5165\u547d\u4ee4 source ~\/.bashrc \u540e\u4fdd\u5b58<\/p>\n
\u8fd9\u6837\u5c31\u53ef\u4ee5\u6bcf\u6b21\u767b\u5165\u540e\u90fd\u53ef\u4ee5\u4f7f\u7528\u8bbe\u7f6e\u597d\u7684\u547d\u4ee4\u522b\u540d\u3002<\/p>\n
\n\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/www.linuxidc.com\/Linux\/2018-09\/154293.htm<\/a><\/p>\n