Linux Terminal Command: alias

The alias command is an essential tool in Foundations & Navigation. In this tutorial, we will explore what alias does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.


Concept & Explanation

The alias command creates keyboard shortcuts for long commands, modifying the shell environment.


Common Options & Syntax

alias [options] [arguments]

Here are the most common flags used with alias:


1. Interactive Example (Simple)

Here is how most people run the command:

# Example
alias ll='ls -lh'

What it does: Defines ’ll’ to run ’ls -lh'.


2. Power-User Example (Advanced)

For scripting and advanced diagnostics, use this configuration:

# Advanced
alias gs='git status' && alias gp='git push'

What it does: Creates multiple shortcuts for git operations.


⚙️ Warning & Common Pitfalls

[!WARNING] Aliases are session-specific. To persist them, you must write them inside ~/.bashrc or ~/.zshrc.


Here are some related posts on cli_tty1 you might want to check out: