Linux 创建自定义命令

以创建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