Ceci est une ancienne révision du document !
I'm unemployed, and where I live, as I think is also the case in a lot of countries, I need to make a number of job applications a month. Now, I’m also the organised type and I like to keep all my applications nicely foldered away in their respective months. Hence, I have a folder hierarchy as follows:
unemployed –> applications –> jan, feb, may (it's been some time now) –> job_name
Now, of course, when I log in, I arrive in the home directory, and because of my meticulous folder architecture :), it takes some time to navigate to the said month or even application upon which I'm working. In the window (point & click), I have set up a shortcut, but as I like to use the terminal, I'd like to set up a link in my home directory which will jump to the month where all my current applications are stored. Now how do I do that? With a symlink.
What are symlinks?
Basically, a symlink is a file which points to another file.
The code
So we know I need one. We know what it is, well in theory at least. Now how do I create one? In generic terms there are two possibilities:
Possibility 1: ln [options] file link
Possibility 2: ln [options] files directory
The first noteworthy item is that setting a symlink isn't a default option for the ln command. You need to pass -s to the [options] section, otherwise you'll create a hard link.
Now to create the link to the application I'm working on. Presently it's May and all my applications are in my May folder (some of my desktop is organised in German so it's written Mai). Also I want to create a link to a folder, not a file. My first attempt. Navigate to where I want to place the link (in my case in my Documents folder), and type:
ln -s /home/rpwitt/Documents/unemployed/applications/NPAB_Mai/ new_link
To repeat, '/home/rpwitt/….' is the location to which I want the symlink to jump to, and the name of the link is 'new_link'. Now if I cd or ls 'new_link', I get the contents of my NPAB_Mai directory.
Editing symlinks
Now I only used the name 'new_link' for demonstrative purposes and also it's not going to be May for ever. At some point, in the not too distant future, I'm going to be sending applications in another month. So I need to be able to change the name of my symlink, and also the location to which it points. First, change the name. This is as simple as one would imagine it might be. Simply change the symlink name as you might a filename:
mv new_link may_app
Now I would like to change the location to which the link points. Just repeat the code above, but pointing to a new location:
ln -s /home/rpwitt/Documents/unemployed/applications/NPAB_Jun/ jun_app
Anyway, I hope that helped, and if you are a seasoned symlinker or have just put together your first, like me, please write to let me know your ideas. I would love to hear about how you use symlinks.