Ubuntu 18.04.2 aliases set up permanent solution

Set up a temporary alias

alias ll="ls -al"

The disadvantage is that the next time you log does not take effect

Permanent solution

Etc into the folder

 cd /etc/

Create a file bash_aliases

 vim bash_aliases

Fill in the alias command, if necessary, you can fill in your own command aliases

alias gohome="cd ~"
alias ll="ls -al"

Press ESCEnter :wqto save the file

Modify bash.bashrc file

vim /etc/bash.bashrc 

Move the cursor to the bottom paste the code below ( Reference Bowen )

if [ -f /etc/bash_aliases ]; then     
    . /etc/bash_aliases         
fi 

Press ESCEnter :wqto save the file

Execute source ~/.bashrcimmediate effect

If you do not become effective
execution rebootrestart (Note: The server should not arbitrarily executed)

re-register

C:\Users\admin>ssh [email protected]
[email protected]'s password: 
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-52-generic x86_64)    

Input ll
display

root@iZs9kgd0x5xmhaZ:~# ll
total 108
drwx------  14 root root  4096 Jul 22 16:13 .
drwxr-xr-x  22 root root  4096 Jul 22 13:59 ..
drwxr-xr-x   3 root root  4096 Jul 18 10:25 .aspnet
-rw-------   1 root root  6241 Jul 22 16:13 .bash_history
-rw-r--r--   1 root root    83 Jul 22 14:25 .bash_profile

Reference article:

alias Ubuntu permanent configuration summary

Ubuntu18.04 permanently set alias method

Guess you like

Origin www.cnblogs.com/zhaozhengyan/p/ubuntu_alias_permanent.html