Outils pour utilisateurs

Outils du site


issue74:certifie_linux

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.

Je n'ai pas d'emploi et, là où j'habite, comme c'est le cas, je pense, dans beaucoup de pays, je dois faire acte de candidature à un certain nombre d'emplois par mois. Or, je suis aussi du genre organisé et j'aime archiver mes candidatures dans de jolis dossiers, mois après mois. Ainsi, j'ai la hiérarchie de dossier suivante :

sans emploi –> candidatures –> jan, fev, mai (oui, malheureusement, ça traîne) –> nom_de_l'emploi

Bien entendu, quand je me connecte, j'arrive dans mon dossier personnel et, à cause de l'organisation méticuleuse de mes dossiers :), il me faut un certain temps pour naviguer vers le mois approprié ou même vers la candidature sur laquelle je travaille. J'ai configuré un raccourci dans la fenêtre (pointer-cliquer), mais, comme j'aime me servir du terminal, j'aimerais paramétrer un lien dans mon dossier personnel qui irait jusqu'au mois où je stocke toutes mes candidatures en cours. Et comment faire cela ? Avec un symlink (un lien ou liaison symbolique).

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.

Qu'est-ce qu'un symlink ?

En fait, un symlink est un fichier qui pointe vers un autre fichier.

Le code

Bon. Nous savons que j'en ai besoin d'un. Nous savons ce que c'est… du moins en théorie. Mais comment le créer ? En termes génériques, il y a deux possibilités :

1ère possibilité : ln [options] lien vers un fichier

2ème possibilité : ln [options] dossier de fichiers

Tout d'abord, il faut noter que la configuration d'un symlink n'est pas une option par défaut pour la commande ln. Il est nécessaire de passer -s à la section [options], car, sinon, vous créerez un lien en dur.

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.

Bon, créons maintenant le lien vers la candidature sur laquelle je travaille actuellement. Nous sommes en mai et toutes mes candidatures se trouvent dans mon dossier Mai (écrit Mai, car une partie de mon bureau est organisée en allemand). Je veux également créer un lien vers un dossier, pas vers un fichier. Premier essai. Naviguez à l'endroit où vous voulez mettre le lien (dans ce cas, dans mon dossier Documents), et tapez :

ln -s /home/rpwitt/Documents/unemployed/applications/NPAB_Mai/ new_link

Encore une fois « /home/rpwitt/…. » est l'emplacement de destination du symlink et le nom du lien est « new_link ». Si, maintenant, je tape cd ou ls « new_link », j'obtiens le contenu de mon dossier NPAB_Mai.

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.

La modification des symlinks

Il faut savoir que je n'ai utilisé le nom « new_link » que pour les besoins de ma démonstration ; en outre, nous ne serons pas en mai éternellement. À un moment quelconque, dans un avenir assez rapproché, je vais envoyer des candidatures dans un autre mois. J'ai donc besoin de pouvoir changer le nom du symlink, ainsi que de l'endroit vers lequel il pointe. D'abord, changer le nom. C'est aussi simple que vous pourriez penser. Il suffit de changer le nom du symlink comme vous changeriez le nom d'un fichier :

mv new_link may_app

J'aimerais maintenant changer l'emplacement de destination du lien. Il suffit de répéter le code ci-dessus, mais en indiquant un nouvel emplacement :

ln -s /home/rpwitt/Documents/unemployed/applications/NPAB_Jun/ jun_app

Quoiqu'il en soit, j'espère que ceci vous aura aidé et - si vous êtes un créateur de symlinks aguerri ou venez tout juste de créer votre premier, comme moi - je vous prie de bien vouloir m'écrire pour me faire connaître vos idées. J'aimerais vraiment savoir comment vous utilisez les symlinks.

issue74/certifie_linux.txt · Dernière modification : 2013/12/04 21:11 de fcm_-_ekel