Alias, Environment Variables, Pipe & Vi Editor


Alias

An alias is a shortcut for a long command. Instead of typing the full command every time, you create a short name for it.

Syntax

alias short_name="your command"

Examples

alias l="ls"                        # Type 'l' instead of 'ls'
alias ll="ls -la"                   # Type 'll' for detailed list
alias gs="git status"               # Shortcut for git status
alias cls="clear"                   # Windows-style clear

Print All Existing Aliases

alias -p

Remove an Alias

unalias short_name

Aliases created in terminal are temporary (lost after session ends).

To make them permanent, add them to ~/.bashrc or ~/.bash_aliases and run source ~/.bashrc.


Environment Variables

Environment variables store information that programs and the shell can use — like paths, usernames, or config values.


Temporary Variable (Current session only)

MYVAR="hello world"          # Set variable (only in current shell)
export MYVAR="hello world"   # Export makes it available to child processes