shalow丿ovevim
[root@localhost ~]# yum install -y bash-completion Loaded plugins: fastestmirror base | 3.6 kB 00:00:00 epel/x86_64/metalink | 5.2 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/3): extras/7/x86_64/primary_db | 130 kB 00:00:00 (2/3): epel/x86_64/updateinfo | 848 kB 00:00:01 (3/3): epel/x86_64/primary_db | 6.1 MB 00:00:10 Loading mirror speeds from cached hostfile * epel: mirrors.ustc.edu.cn Resolving Dependencies --> Running transaction check ---> Package bash-completion.noarch 1:2.1-6.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved =================================================================================================== Package Arch Version Repository Size =================================================================================================== Installing: bash-completion noarch 1:2.1-6.el7 base 85 k Transaction Summary =================================================================================================== Install 1 Package Total download size: 85 k Installed size: 259 k Downloading packages: bash-completion-2.1-6.el7.noarch.rpm | 85 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:bash-completion-2.1-6.el7.noarch 1/1 Verifying : 1:bash-completion-2.1-6.el7.noarch 1/1 Installed: bash-completion.noarch 1:2.1-6.el7 Complete! [root@localhost ~]# systemctl restart network.service #測試失敗 [root@localhost ~]# reboot #需重啓
使用bash-completion包不只能夠補全命令,還能夠補全參數bash
[root@localhost ~]# systemctl restart network.service #從新測試 [root@localhost ~]# alias restart='systemctl restart network.service' [root@localhost ~]# restart [root@localhost ~]# alias alias cp='cp -i' alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias grep='grep --color=auto' alias l.='ls -d .* --color=auto' alias ll='ls -l --color=auto' alias ls='ls --color=auto' alias mv='mv -i' alias restart='systemctl restart network.service' alias rm='rm -i' alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
各用戶都有本身配置別名的文件~/.bashrcless
[root@localhost ~]# vi .bashrc # .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi
其餘alias配置文件測試
[root@localhost ~]# cd /etc/profile.d [root@localhost profile.d]# ls 256term.csh colorgrep.csh colorls.sh less.csh vim.sh 256term.sh colorgrep.sh lang.csh less.sh which2.csh bash_completion.sh colorls.csh lang.sh vim.csh which2.sh