Link to home
Start Free TrialLog in
Avatar of johnkan
johnkan

asked on

Creating an alias to a directory so I can change the directory 'contents' by changing the alias

Hello experts,

I am a linux newbie, and was wondering if I can create an 'alias', not sure it thats the correct term, to a directory that points to another directory ?.

e.g.

my path is this,
 ~/projects/mysite/folder_to_be_aliased

I would like to have the folder_to_be_aliased to 'see' contents from some other directory, not a device but another directory.

The reason I want to do this is that the contents of the 'folder_to_be_aliased' is stored in different locations depending on the environment. So development, and production for instance, and I dont want to populate the directory manually each time I change environments.

Not sure if this is possible.

Thanks heaps in advance.
SOLUTION
Avatar of phoffric
phoffric

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of johnkan
johnkan

ASKER

hi phorric,

thanks for the quick response.

I will give this a go.

looks like what I need.

thanks
fyi - symbolix links created with ln -s are basically files that have small size (roughly the size of the true file/directory string name) and exist even if the target file/directory disappears. In my environment (RHEL), if the true destination is unavailable (either because it is deleted, moved, or possibly not mounted), then the ls command indicates this by showing the target in red.

Using the example in the link, if /tmp/one/two did not exist, then it would appear in red (on my system).
$ ln -s /tmp/one/two three
$ ls -l three
lrwxrwxrwx 1 user group 12 Jul 22 10:02 /tmp/three -> /tmp/one/two
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of johnkan

ASKER

Hi experts,

thanks for your responses. Despite the way I worded my question.

thanks