How Linux uses the alias command

  
                

alias is one of the commands of the Linux system. It can be used to customize the alias of other commands. It is very useful when the command is long. The following is a small series to introduce the usage of the Linux alias command. Interested friends can Come to understand.

Function Description: Sets the alias command.

Syntax: alias[alias]=[instruction name]

Parameter: If no parameters are added, all current alias settings are listed.

Example:

root@czu:~/projects/myshell/srce# alias

alias begin=‘mount -t vmhgfs .host://mnt/hgfs /’

alias egrep=‘egrep --color=auto’

alias fgrep=‘fgrep --color=auto’

alias gopj=‘ Cd /root/projects’

alias grep=‘grep --color=auto’

alias l=‘ls -CF’

alias la=‘ Ls -A’

alias ll=‘ls -alF’

alias ls=‘ls --color=auto’

alias work=‘cd /Mnt/hgfs/VMwareFolder’

Description: Users can use alias to customize the alias of the instruction. If you only enter alias, you can list all the current alias settings. The role of .alias is limited to the login operation. To automatically set an alias every time you log in, you can set the alias of the command in /etc/profile or your own ~/.bashrc.

Also, if you want to give an alias to every user, add the alias to the end of /etc/bashrc, which is the configuration file for the environment variable. The difference between /etc/bashrc and ~/.bashrc is that one is set to the whole system and the one is set to use for single users.

If you want to be permanent, write this to /etc/bashrc.

The above is the introduction of Linux using the alias command. If you feel that the command is too long when you use the command line, and you often use it, you can use the alias command to set an alias for the command. Save a lot of time.

Copyright © Windows knowledge All Rights Reserved