Last active
April 13, 2021 19:31
-
-
Save marcelscruz/56e6ac3c7f554be6f6aab7ced0af6693 to your computer and use it in GitHub Desktop.
My collection of .bash_profile aliases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The following commands are tested on macOS only, so a few | |
# tweaks might be necessary on a different OS | |
# Go to home folder | |
alias ~='cd ~' | |
# Navigate back | |
alias cd1='cd ..' | |
alias cd2='cd ../..' | |
alias cd3='cd ../../..' | |
alias cd4='cd ../../../..' | |
alias cd5='cd ../../../../..' | |
alias cd6='cd ../../../../../..' | |
# Quick access to frequently used directories | |
# Keep the '/' in the end to avoid overwriting built-in commands | |
alias projectName/='cd /path/to/project' | |
# Copy/move file or folder | |
# 'i' for prompting before overwrite | |
# 'v' for printing source and destination | |
alias cp='cp -iv' | |
alias mv='mv -iv' | |
# Create new directory on navigate into it | |
mcd () { mkdir -p "$1" && cd "$1"; } | |
# Move file to trash | |
trash () { command mv "$@" ~/.Trash ; } | |
# Create new directory | |
# 'p' for creating parent folders of target, if they don't exist | |
# 'v' for printing destination | |
alias mkdir='mkdir -pv' | |
# Clear terminal | |
alias c='clear' | |
# 'edit file_name' - Open the target file on Sublime | |
# Link on the tweet for how to configure opening Sublime from terminal | |
edit () { sublime "$1" } | |
# Open bash_profile on Sublime | |
alias ebp='edit ~/.bash_profile' | |
# Restart bash_profile after editing it, | |
# otherwise changes will only work on a new tab | |
alias rbp='source ~/.bash_profile' | |
# NPM frequently used commands shortcuts | |
alias npms='npm start' | |
alias npmb='npm run build' | |
alias npmt='npm run test' | |
# 'npmr your_command' - Shortcut for custom commands | |
npmr () { npm run "$1" } | |
# Git frequently used commands shortcuts | |
alias gcs='git checkout staging' | |
alias gcp='git checkout production' | |
# Vercel | |
alias v='vercel' | |
alias vp='vercel --prod' | |
# Connect to server through SSH | |
alias serverName='ssh root@xxx.xxx.xxx.xxx' | |
# Display public and local IP | |
alias publicIP='curl ipecho.net/plain ; echo' | |
alias localIP='ifconfig | grep inet' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment