Red hat linux

Create Permanent alias on CentOS/Redhat

The ‘alias’ command in CentOS allows for you to create an alias to a command. For example, if you want to use the vim text editor, but are used to typing vi file-to-edit.txt, you can create an alias to automatically start vim instead of vi when typing the command.

Showing current aliases

To show the currently configured aliases for your shell simply type ‘alias’ with no arguments.


Setting an alias

To set an alias to use vim for when vi is typed the following syntax would be used.

alias vi='/usr/bin/vim'

Removing an alias

To remove an alias you use the unalias command, for example to remove the previous vi to vim example you would type.

unalias vi

To set Alias as permanent alias,add alias to ~/.bashrc<

vim ~/.bashrc

add alias

alias command1='cd /var/zpanel/hostdata/'

Those are the basics of the command, for more info see the manpage.

man alias

Leave a Reply

Your email address will not be published. Required fields are marked *