loading...
Play Button Pause Button

Shell Aliases For Easy Directory Navigation #OneDevMinute

mrahmadawais profile image Ahmad Awais ⚡️ ・1 min read

🔥 #OneDevMinute is my new series on development tips in one minute. Wish me luck to keep it consistent on a daily basis. Your support means a lot to me. Feedback on the video is welcomed as well.

Ever had that typo where you wrote cd.. instead of cd .. — well this tip not only addresses that typo but also adds a couple other aliases to help you easily navigate through your systems directories. More in the video…

OneDevMinute

################################################
# 🔥 #OneDevMinute
#
# Daily one minute developer tips.
# Ahmad Awais (https://twitter.com/MrAhmadAwais)
################################################

# Easier directory navigation.
alias ~="cd ~"
alias .="cd .."
alias ..="cd ../.."
alias ...="cd ../../.."
alias ....="cd ../../../.."
alias cd..="cd .." # Typo addressed.
Enter fullscreen mode Exit fullscreen mode

Copy paste these aliases at the end of your .zshrc/.bashrc files and then reload/restart your shell/terminal application.

If you'd like to 📺 watch in 1080p that's on Youtube →
This is a new project so bear with me. Peace! ✌️

Discussion

pic
Editor guide
Collapse
sh78 profile image
Sean Henderson

cd without any arguments will default to ~

Collapse
mrahmadawais profile image
Collapse
azeznassar profile image
Azez Nassar

Here are some of the aliases I'm using, hopefully someone might find one useful.

# Shortcuts
alias db="cd ~/Documents/Dropbox"
alias dl="cd ~/Downloads"
alias dt="cd ~/Desktop"
alias p="cd ~/Projects"
alias g="git"

# List all files colorized in long format
alias l="ls -lF -G"

# List all files colorized in long format, including dot files
alias la="ls -laF -G"

# List only directories
alias lsd="ls -lF -G | grep --color=never '^d'"

# Always use color output for `ls`
alias ls="command ls -G"

# Always enable colored `grep` output
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
Collapse
charlie1404_sg profile image
Shailendra Gupta

alias -="cd -"
To go last working directory

Collapse
mrahmadawais profile image
Collapse
itsdarrylnorris profile image
Darryl Norris

I never thought about the adding the typo as an alias, very neat idea.

alias cd..="cd .." # Typo addressed.
Collapse
fabioperrella profile image
Fabio Perrella

You can use autojump to change folders faster

Collapse
mrahmadawais profile image
Ahmad Awais ⚡️ Author

There's also z and j packages which are pretty cool.