alias: Define shorthand commands for longer or frequently used commands
August 9th, 2024 1:59 PM Mr. Q Categories: Command
Command: alias
The alias command allows you to create shortcuts for longer or frequently used commands. This can help streamline your workflow by reducing the amount of typing required.
Commands and Outputs:
- Command:
aliasDescription: List all current aliases. Sample Command and Output:
$ alias
Output:
alias ll='ls -l'
alias gs='git status'
alias ..='cd ..'
- Command:
alias name='command'Description: Create a new alias namednamefor the specifiedcommand. Sample Command and Output:
$ alias ll='ls -l'
Output:
# No output if successful, creates an alias 'll' for 'ls -l'
- Command:
unalias nameDescription: Remove the alias namedname. Sample Command and Output:
$ unalias ll
Output:
# No output if successful, removes the alias 'll'
Example Usage:
- Define a shortcut to list all files with detailed information:
$ alias ll='ls -l'
- Define a shortcut to quickly check Git status:
$ alias gs='git status'
- Define a shortcut to navigate up one directory:
$ alias ..='cd ..'
Note: Aliases are typically defined in shell configuration files like .bashrc or .zshrc to make them persistent across sessions.