美文网首页
Linux 创建自定义命令

Linux 创建自定义命令

作者: 木偶跳舞 | 来源:发表于2021-12-27 22:02 被阅读0次

    以创建ll命令为例

    步骤:

    1、在/home目录用户文件夹下打开.profile文件

    vim ~/.profile
    

    ubuntu系统是~/.profile, centos系统用 ~/.bashrc

    2、在.profile文件中写入

    语法: alias[别名]=[指令名称]

    alias ll="ls -alh" 
    

    3、 然后执行

    source ~/.profile
    

    若系统启动时不会自动加载 ~/.profile 文件,则将 source ~/.profile 命令添加到要自动加载的文件中即可,如~/.bash.profile 文件

    source ~/.profile
    

    ————————————————
    本文由木偶笔记发表于 2021-11-07
    转载请务必保留本文链接:https://www.muouseo.com/article/n2oegzv73m.html

    相关文章

      网友评论

          本文标题:Linux 创建自定义命令

          本文链接:https://www.haomeiwen.com/subject/mekuqrtx.html