Linux alias command details, linuxalias command details

Source: Internet
Author: User
Tags egrep

Linux alias command details, linuxalias command details
Detailed description of alias commands in linux

 
Description

Set the alias of the command. In linux, if the command is too long and does not conform to the user's habits, you can specify an alias for it. Although you can create a "Link" for the command"

Solve the problem of long file names, but for commands with command line parameters, the link is powerless. Specifying an alias can solve all such problems [1 ]. Frequently used aliases to simplify

Ssh logon [see Example 3] to shorten long commands, short commonly used long command lines, and ask when executing commands forcibly.

Function Description:Set the alias of the command.

Syntax:Alias [alias] = [command name]

Parameters:If no parameter is added, all current alias settings are listed.

For example:Ermao @ lost-desktop :~ $ Alias

                  alias egrep='egrep --color=auto'

                  alias fgrep='fgrep --color=auto'

                 alias grep='grep --color=auto'

                 alias l='ls -CF'

                 alias la='ls -A'

                 alias ll='ls -alF'

                 alias ls='ls --color=auto'

Description:You can use alias to customize the alias of the command.

If you only enter alias, all current alias settings can be listed.

Note:

Using alias, you can change a long command into a short one that we like.

Alias is valid only for this login operation. If you want to automatically set an alias for each login, you can go to/etc/profile or your own ~ /. Set the alias of the command in bashrc.

File:

/Etc/profile or references other files (such as/etc/bash. bashrc in Ubuntu 12.0.4 ). This is global. We do not recommend that you modify this file. If you modify this file, a startup error may occur.

If you want to add a line alias la = 'LS-al' to the end of/etc/bashrc, which is the configuration file of Environment Variables

~ /. Bashrc is the current user, but it must be implemented after bash is started.

/Etc/bashrc and ~ /. The difference between bashrc and bashrc is that it is set for all systems to be set for individual users.

Of course: How to cancel the alias of a command in Linux

1. if you add a statement to the configuration file, you need to modify or delete the corresponding statement.

2. if the function is only temporarily enabled, enter the unalias command (for example, unalias clear ).

Test @ ubuntu :~ $ Alias c = cleartest @ ubuntu :~ $ Unalias clear

   

   


 

Questions about alias commands in linux

This is only useful for this time. The definition of alias is usually put in. bashrc under the user's home directory.
Vi ~ /. Bashrc check whether there are several default defined alias? To be available upon each restart
Add a line of alias you want to define in it. Save the line and restart it.

Also, if you want to add the alias la = 'LS-al' line to the end of/etc/bashrc, bashrc is the environment variable configuration file/etc/bashrc and ~ /. The difference between bashrc and bashrc is that it is set for all systems and for single users.

In Linux, how does one specify an alias for a command (alias?

If the command or command sequence is too long or does not meet the user's habits, it is good to specify an alias for it. The alias can solve all such problems. Just give some examples:
Alias l = 'LS-l'; use l instead of the ls-l command (similar l commands are available in Xenix)
Alias cd... = 'CD... '; replacing the cd... command with cd... (it helps a lot for people who use cd... in DOS)
Alias md = 'mkdir'; replace mkdir with md (for DOS ...)
Alias c: = 'mount/dev/hda1/mnt/c & cd/mnt/C'; replace command sequence with c: Command: Install DOS partition, and then enter
Hope to help the landlord

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.