Open In App
Related Articles

alias command in Linux with Examples

Improve Article
Improve
Save Article
Save
Like Article
Like

alias command instructs the shell to replace one string with another string while executing the commands. 

When we often have to use a single big command multiple times, in those cases, we create something called as alias for that command. Alias is like a shortcut command which will have same functionality as if we are writing the whole command. 

Syntax:  

alias [-p] [name[=value] ... ]

  
Creating an alias

Syntax: 

alias name="value"

Creating an Unalias : Removing an existing alias is known as unaliasing. 
Syntax: 

unalias [alias name]

Options for Alias command: 

  • -p option : This option prints all the defined aliases is reusable format. 

    Syntax: 

alias -p

  • –help option : It displays help Information. 

    Syntax: 

alias --help

How to remove an alias? 
We use unalias command for this purpose. 

How to permanently store aliases across sessions? 
We can store aliases in shell configuration files. For example for Bash Shell, we can write in ~/.bashrc

alias CD="cd Desktop" 

?t=291 
 

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 29 Nov, 2022
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials