When you are navigating up a very long directory structure, you may be using
cd ..\..\ with multiple ..\’s depending on how many directories you want to go
up as shown below.
following three alias methods:
Method 1: Navigate up the directory using “..n”
In the example below, ..4 is used to go up 4 directory level, ..3 to go up 3
directory level, ..2 to go up 2 directory level. Add the following alias to your
~/.bash_profile and re-login.
In the example below, ..... (five dots) is used to go up 4 directory level.
Typing 5 dots to go up 4 directory structure is really easy to remember, as
when you type the first two dots, you are thinking “going up one directory”,
after that every additional dot, is to go one level up. So, use .... (four dots) to
go up 3 directory level and .. (two dots) to go up 1 directory level. Add the
following alias to your ~/.bash_profile and re-login for the ..... (five dots) to
work properly.
consecutive dots
In the example below, cd..... (cd followed by five dots) is used to go up 4
directory level. Making it 5 dots to go up 4 directory structure is really easy to
remember, as when you type the first two dots, you are thinking “going up
one directory”, after that every additional dot, is to go one level up. So, use
cd.... (cd followed by four dots) to go up 3 directory level and cd... (cd
followed by three dots) to go up 2 directory level. Add the following alias to
your ~/.bash_profile and re-login for the above cd..... (five dots) to work
properly.
In the example below, cd4 (cd followed by number 4) is used to go up 4
directory level.
cd ..\..\ with multiple ..\’s depending on how many directories you want to go
up as shown below.
# mkdir -p
/tmp/very/long/directory/structure/that/is/too/deep
# cd /tmp/very/long/directory/structure/that/is/too/deep
# pwd
/tmp/very/long/directory/structure/that/is/too/deep
# cd ../../../../
# pwdInstead of executing cd ../../../.. to navigate four levels up, use one of the
/tmp/very/long/directory/structure
following three alias methods:
Method 1: Navigate up the directory using “..n”
In the example below, ..4 is used to go up 4 directory level, ..3 to go up 3
directory level, ..2 to go up 2 directory level. Add the following alias to your
~/.bash_profile and re-login.
alias ..="cd .."Method 2: Navigate up the directory using only dots
alias ..2="cd ../.."
alias ..3="cd ../../.."
alias ..4="cd ../../../.."
alias ..5="cd ../../../../.."
# cd
/tmp/very/long/directory/structure/that/is/too/deep
# ..4
[Note: use ..4 to go up 4 directory level]
# pwd
/tmp/very/long/directory/structure/
In the example below, ..... (five dots) is used to go up 4 directory level.
Typing 5 dots to go up 4 directory structure is really easy to remember, as
when you type the first two dots, you are thinking “going up one directory”,
after that every additional dot, is to go one level up. So, use .... (four dots) to
go up 3 directory level and .. (two dots) to go up 1 directory level. Add the
following alias to your ~/.bash_profile and re-login for the ..... (five dots) to
work properly.
Method 3: Navigate up the directory using cd followed by
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."
# cd /tmp/very/long/directory/structure/that/is/too/deep
# .....
[Note: use ..... (five dots) to go up 4 directory level]
# pwd
/tmp/very/long/directory/structure/
consecutive dots
In the example below, cd..... (cd followed by five dots) is used to go up 4
directory level. Making it 5 dots to go up 4 directory structure is really easy to
remember, as when you type the first two dots, you are thinking “going up
one directory”, after that every additional dot, is to go one level up. So, use
cd.... (cd followed by four dots) to go up 3 directory level and cd... (cd
followed by three dots) to go up 2 directory level. Add the following alias to
your ~/.bash_profile and re-login for the above cd..... (five dots) to work
properly.
Method 5: Navigate up the directory using cd followed by number
alias cd..="cd .."
alias cd...="cd ../.."
alias cd....="cd ../../.."
alias cd.....="cd ../../../.."
alias cd......="cd ../../../../.."
# cd /tmp/very/long/directory/structure/that/is/too/deep
# cd.....
[Note: use cd..... to go up 4 directory level]
# pwd
/tmp/very/long/directory/structure
In the example below, cd4 (cd followed by number 4) is used to go up 4
directory level.
alias cd1="cd .."
alias cd2="cd ../.."
alias cd3="cd ../../.."
alias cd4="cd ../../../.."
alias cd5="cd ../../../../.."
No comments:
Post a Comment