Bash aliases turn long, repetitive commands into short ones you can actually remember. Here’s how to create them.
What is a bash alias
An alias is a shortcut for a command. You declare one with alias alias_name="command". For example, this alias lists hidden files and directories: alias lm="ls -la"
Note: don’t put spaces around the =.
Useful bash aliases
- git init (initializing git)
alias gi= "git init" - git push master (pushing files to GitHub)
alias gpm= "git push your_repo_name master" - listing files vertically
alias l= "ls | more" - Creating directories with a shortcut
alias n= "mkdir" - Removing Directory
alias r= "rm -rf" - Removing an Alias
unalias _alias_name