How to define a symbolic link that I can use in every directoryHow do I copy a symbolic link?cannot create...
Does the UK have a written constitution?
How do I find and plot the intersection of these three surfaces?
“Transitive verb” + interrupter+ “object”?
How well known and how commonly used was Huffman coding in 1979?
How can I check type T is among parameter pack Ts... in C++?
Symbol for "not absolutely continuous" in Latex
Are there any vegetarian astronauts?
What do you call the action of someone tackling a stronger person?
Dual statement category theory
How to modify the uneven space between separate loop cuts, while they are already cut?
Zombie Diet, why humans
Was touching your nose a greeting in second millenium Mesopotamia?
how to remove the dotted white border around focused button text?
Is there a short way to check uniqueness of values without using 'if' and multiple 'and's?
When is it ok to add filler to a story?
Is adding a new player (or players) a DM decision, or a group decision?
Generate and graph the Recamán Sequence
Confusion about multiple information Sets
How to determine what is the correct level of detail when modelling?
AT system without -5v
Can a US president have someone sent to prison?
Children's short story about material that accelerates away from gravity
What does 2>&1 | tee mean?
Why cruise at 7000' in an A319?
How to define a symbolic link that I can use in every directory
How do I copy a symbolic link?cannot create symbolic link on CentOS 5.6 - File exists errorCreate a symbolic link relative to the current directoryFinding the original file of a symbolic linkWhen is a symbolic link not acceptable?Equivalent of alias for a symbolic link?Directing old symbolic link to a different locationCopy directory tree, changing the target of absolute symbolic linksOpenSSH refused .ssh directory with a symbolic linkhow do i link one directory to another directory so that FTP or SMB share can still use that directory
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
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?
bash symlink
add a comment |
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?
bash symlink
add a comment |
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?
bash symlink
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?
bash symlink
bash symlink
edited 15 mins ago
Nepumuk
10913 bronze badges
10913 bronze badges
asked Apr 30 '14 at 14:33
LaTeXistLaTeXist
833 bronze badges
833 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Most shells have a CDPATH variable that cd 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 do CDPATH=~/projects, you'll be able to do cd foo to go in ~/projects/foo
With zsh, if $var contains a path you can do cd ~var to cd to that path. The useful part of that is when your prompt has %~ which then reflects it in your prompt:
$ proj1=/usr/local proj2=/etc/apache2
$ PS1='%~$ '
$ cd ~proj1
~proj1$ cd ~proj2/sites-enabled
~proj2/sites-enabled$
With setopt cdablevars, you can also do cd proj1 instead of cd ~proj1.
add a comment |
You probably want to use variables instead of symbolic links, e.g.
export project=/home/me/project
then
cd $project
or
vim $project/file
UPDATE
As pointed out by peterph, you can also combine these (including predefined variables), e.g.
export project=$HOME/project
1
Or even betterproject=$HOME/project...
– peterph
Apr 30 '14 at 14:40
@peterph, or even simpler~/project.
– Stéphane Chazelas
Apr 30 '14 at 14:54
4
Withzsh, you can also dosetopt cdablevarsand thencd project
– Stéphane Chazelas
Apr 30 '14 at 14:56
@StephaneChazelas: I think that's a good point - though as it's specific tozshperhaps you could add that as a separate answer?
– jmetz
Apr 30 '14 at 14:58
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f127297%2fhow-to-define-a-symbolic-link-that-i-can-use-in-every-directory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Most shells have a CDPATH variable that cd 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 do CDPATH=~/projects, you'll be able to do cd foo to go in ~/projects/foo
With zsh, if $var contains a path you can do cd ~var to cd to that path. The useful part of that is when your prompt has %~ which then reflects it in your prompt:
$ proj1=/usr/local proj2=/etc/apache2
$ PS1='%~$ '
$ cd ~proj1
~proj1$ cd ~proj2/sites-enabled
~proj2/sites-enabled$
With setopt cdablevars, you can also do cd proj1 instead of cd ~proj1.
add a comment |
Most shells have a CDPATH variable that cd 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 do CDPATH=~/projects, you'll be able to do cd foo to go in ~/projects/foo
With zsh, if $var contains a path you can do cd ~var to cd to that path. The useful part of that is when your prompt has %~ which then reflects it in your prompt:
$ proj1=/usr/local proj2=/etc/apache2
$ PS1='%~$ '
$ cd ~proj1
~proj1$ cd ~proj2/sites-enabled
~proj2/sites-enabled$
With setopt cdablevars, you can also do cd proj1 instead of cd ~proj1.
add a comment |
Most shells have a CDPATH variable that cd 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 do CDPATH=~/projects, you'll be able to do cd foo to go in ~/projects/foo
With zsh, if $var contains a path you can do cd ~var to cd to that path. The useful part of that is when your prompt has %~ which then reflects it in your prompt:
$ proj1=/usr/local proj2=/etc/apache2
$ PS1='%~$ '
$ cd ~proj1
~proj1$ cd ~proj2/sites-enabled
~proj2/sites-enabled$
With setopt cdablevars, you can also do cd proj1 instead of cd ~proj1.
Most shells have a CDPATH variable that cd 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 do CDPATH=~/projects, you'll be able to do cd foo to go in ~/projects/foo
With zsh, if $var contains a path you can do cd ~var to cd to that path. The useful part of that is when your prompt has %~ which then reflects it in your prompt:
$ proj1=/usr/local proj2=/etc/apache2
$ PS1='%~$ '
$ cd ~proj1
~proj1$ cd ~proj2/sites-enabled
~proj2/sites-enabled$
With setopt cdablevars, you can also do cd proj1 instead of cd ~proj1.
edited May 1 '14 at 6:45
answered Apr 30 '14 at 14:59
Stéphane ChazelasStéphane Chazelas
323k57 gold badges623 silver badges990 bronze badges
323k57 gold badges623 silver badges990 bronze badges
add a comment |
add a comment |
You probably want to use variables instead of symbolic links, e.g.
export project=/home/me/project
then
cd $project
or
vim $project/file
UPDATE
As pointed out by peterph, you can also combine these (including predefined variables), e.g.
export project=$HOME/project
1
Or even betterproject=$HOME/project...
– peterph
Apr 30 '14 at 14:40
@peterph, or even simpler~/project.
– Stéphane Chazelas
Apr 30 '14 at 14:54
4
Withzsh, you can also dosetopt cdablevarsand thencd project
– Stéphane Chazelas
Apr 30 '14 at 14:56
@StephaneChazelas: I think that's a good point - though as it's specific tozshperhaps you could add that as a separate answer?
– jmetz
Apr 30 '14 at 14:58
add a comment |
You probably want to use variables instead of symbolic links, e.g.
export project=/home/me/project
then
cd $project
or
vim $project/file
UPDATE
As pointed out by peterph, you can also combine these (including predefined variables), e.g.
export project=$HOME/project
1
Or even betterproject=$HOME/project...
– peterph
Apr 30 '14 at 14:40
@peterph, or even simpler~/project.
– Stéphane Chazelas
Apr 30 '14 at 14:54
4
Withzsh, you can also dosetopt cdablevarsand thencd project
– Stéphane Chazelas
Apr 30 '14 at 14:56
@StephaneChazelas: I think that's a good point - though as it's specific tozshperhaps you could add that as a separate answer?
– jmetz
Apr 30 '14 at 14:58
add a comment |
You probably want to use variables instead of symbolic links, e.g.
export project=/home/me/project
then
cd $project
or
vim $project/file
UPDATE
As pointed out by peterph, you can also combine these (including predefined variables), e.g.
export project=$HOME/project
You probably want to use variables instead of symbolic links, e.g.
export project=/home/me/project
then
cd $project
or
vim $project/file
UPDATE
As pointed out by peterph, you can also combine these (including predefined variables), e.g.
export project=$HOME/project
edited Apr 30 '14 at 14:42
answered Apr 30 '14 at 14:38
jmetzjmetz
2711 silver badge6 bronze badges
2711 silver badge6 bronze badges
1
Or even betterproject=$HOME/project...
– peterph
Apr 30 '14 at 14:40
@peterph, or even simpler~/project.
– Stéphane Chazelas
Apr 30 '14 at 14:54
4
Withzsh, you can also dosetopt cdablevarsand thencd project
– Stéphane Chazelas
Apr 30 '14 at 14:56
@StephaneChazelas: I think that's a good point - though as it's specific tozshperhaps you could add that as a separate answer?
– jmetz
Apr 30 '14 at 14:58
add a comment |
1
Or even betterproject=$HOME/project...
– peterph
Apr 30 '14 at 14:40
@peterph, or even simpler~/project.
– Stéphane Chazelas
Apr 30 '14 at 14:54
4
Withzsh, you can also dosetopt cdablevarsand thencd project
– Stéphane Chazelas
Apr 30 '14 at 14:56
@StephaneChazelas: I think that's a good point - though as it's specific tozshperhaps you could add that as a separate answer?
– jmetz
Apr 30 '14 at 14:58
1
1
Or even better
project=$HOME/project...– peterph
Apr 30 '14 at 14:40
Or even better
project=$HOME/project...– peterph
Apr 30 '14 at 14:40
@peterph, or even simpler
~/project.– Stéphane Chazelas
Apr 30 '14 at 14:54
@peterph, or even simpler
~/project.– Stéphane Chazelas
Apr 30 '14 at 14:54
4
4
With
zsh, you can also do setopt cdablevars and then cd project– Stéphane Chazelas
Apr 30 '14 at 14:56
With
zsh, you can also do setopt cdablevars and then cd project– Stéphane Chazelas
Apr 30 '14 at 14:56
@StephaneChazelas: I think that's a good point - though as it's specific to
zsh perhaps you could add that as a separate answer?– jmetz
Apr 30 '14 at 14:58
@StephaneChazelas: I think that's a good point - though as it's specific to
zsh perhaps you could add that as a separate answer?– jmetz
Apr 30 '14 at 14:58
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f127297%2fhow-to-define-a-symbolic-link-that-i-can-use-in-every-directory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown