Skip to content

Instantly share code, notes, and snippets.

@sobi3ch
Last active July 28, 2017 06:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sobi3ch/ad72dc0a0965874f5831 to your computer and use it in GitHub Desktop.
Save sobi3ch/ad72dc0a0965874f5831 to your computer and use it in GitHub Desktop.
Add this to your linux aliases file definition and use dots instead 'cd' command itself.
# This script production following aliases.
#
# alias ..='cd ../'
# alias ...='cd ../../'
# alias ....='cd ../../../'
# alias .....='cd ../../../../'
# alias ......='cd ../../../../../'
# alias .......='cd ../../../../../../'
# alias ........='cd ../../../../../../../'
# alias .........='cd ../../../../../../../../'
# alias ..........='cd ../../../../../../../../../'
# alias ...........='cd ../../../../../../../../../../'
#
# If you what even deeper `cd` then just change 10 in `seq 10` for number you like.
# You can use it in your `.bashrc` or `.bash_aliases` or wherever you loading your aliases.
# quick go up (cd ..)
for i in `seq 10`
do
cdpath=''
dots='.'
for p in `seq 1 $i`
do
cdpath=$cdpath'../'
dots=$dots.
done
alias ${dots}="cd ${cdpath}"
done
@Gerst20051
Copy link

pretty cool! 👍

@sobi3ch
Copy link
Author

sobi3ch commented Jul 28, 2017

@Grest20051 thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment