How to set command aliases in Linux

  
                

In the Linux system operation, when using the command, some command lines are very long and often used. It is very inconvenient to use. If you can rename the command, it will be much simpler. Everyone introduces how Linux sets up command aliases.

recently engaged in a Django site, often need to enter the /var /www /site /mycitsm /directory, each had to repeat this long list of input into the path of the directory, it is cumbersome and time-consuming Is there a good way to take an alias like "cd /var/www/site/mycitsm" and you can enter this directory by typing the alias each time?

Fortunately, the Linux system provides a useful tool called alias, which allows us to set an alias for some commands that need to be used frequently but are too lengthy, so that you only need to enter a short one in the future. Alias ​​can achieve the same effect.

Usage: alias [-p] [name[=value] . . . ] Note that ‘=’ and strings cannot contain spaces

Show the currently set alias:

shell"alias -p

alias l.=‘ Ls -d .* --color=tty’

alias ll=‘ls -l --color=tty’

alias ls=‘ls --color=tty’< Br>

alias vi=‘vim’

alias which=‘alias

Copyright © Windows knowledge All Rights Reserved