Saturday, January 18, 2025
HomeProgrammingHow I Create and Use Alias Command in Linux?

How I Create and Use Alias Command in Linux?

To create and use alias commands in Linux, follow these steps:

1. Create an Alias:

You can define an alias using the alias command. For example:

alias ll=’ls -l’

This creates an alias ll for the command ls -l, so typing ll will run ls -l.

See also  Top 10 IDEs for Programmers

2. Make Alias Permanent:

To make your alias available in every session, add it to your shell configuration file (e.g., .bashrc or .bash_profile for Bash). Open the file with a text editor:

nano ~/.bashrc

Add your alias command at the end of the file:

See also  How Can I Reset or Revert a File to a Specific Revision in Git

alias ll=’ls -l’

Save and close the file. Then, apply the changes:

source ~/.bashrc

3. List Aliases:

To view all active aliases, use the alias command:

alias

4. Remove an Alias:

To remove an alias, use the unalias command:

unalias ll

See also   Binary Tree

Now, you can use aliases to save time and simplify command execution!

RELATED ARTICLES
0 0 votes
Article Rating

Leave a Reply

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
- Advertisment -

Most Popular

Recent Comments

0
Would love your thoughts, please comment.x
()
x