Is it possible to set a symbolic link so that I can use project
to point the directory home/me/project
, e. g.? This should be independent of the location in the file system.
I'd like to use commands like cd project
, nano project/file1.tex
and so on.
Do I have to write a symbolic link to all of my directories?
Best Answer
Most shells have a
CDPATH
variable thatcd
can lookup for directories to change to in the same way that executables are searched in$PATH
.So if you add your symlinks in a
~/projects
directory and doCDPATH=~/projects
, you'll be able to docd foo
to go in~/projects/foo
With
zsh
, if$var
contains a path you can docd ~var
tocd
to that path. The useful part of that is when your prompt has%~
which then reflects it in your prompt:With
setopt cdablevars
, you can also docd proj1
instead ofcd ~proj1
.