Outils pour utilisateurs

Outils du site


issue219:c_c

Ceci est une ancienne révision du document !


I just had a question as to where to find help in Ubuntu. While the man pages are there, they are sometimes so bad, I have no idea what they are trying to say. I realise these pages were written for eggheads, by eggheads, so maybe we can help ourselves a bit? Open a terminal and let’s get busy. Try this on for size: help printf You should see something like the above. Now go look at the man page for printf. You may say, all good and well, but as they say in the adverts, wait, there’s more! Try that same command with tack d, like so: help -d printf Right, you can see where I am going here, so I will not add screenshots of everything; if you are a n00b, I want you to actually do it to see the output change. Now we know: Option: -d Display a short description for each topic.

Aide pour Linux

Je me demandais juste où trouver de l'aide sous Ubuntu. Bien que les pages de manuel soient là, elles sont parfois si mauvaises que je n'ai aucune idée de ce qu'elles veulent dire. Je me rends compte que ces pages ont été écrites par des intellos, pour des intellos. On pourrait peut-être s'aider un peu ?

Ouvrez un terminal et mettons-nous au travail. Essayez ceci :

help printf

Vous devriez voir quelque chose comme ci-dessus. Maintenant, allez voir la page de manuel de printf.

Vous vous dites peut-être : « Tout va bien, mais comme on dit dans les publicités, attendez, il y a plus !»

Essayez la même commande avec tiret d, comme ceci :

help -d printf

Bien, vous voyez où je veux en venir, donc je ne vais pas ajouter de captures d'écran de tout ; si vous êtes novice, je veux que vous le fassiez pour voir le résultat changer.

Maintenant, on sait.

Option : -d

Afficher une courte description pour chaque sujet.

Now I want you to repeat that with the -m instead of the -d. You will notice that it looks a bit more like a man page. What do you think the -m is for? Yes! Option: -m Display usage in pseudo-manpage format. You will agree that it is better than the manpage. If you are not sure, go look at the manpage again. So if we wanted to see the syntax, what do you think we would use? Correct -s ! See you guys are really good at this. Suddenly the Linux command line is not so scary any more! So go ahead and try: help -s printf Option: -s Display a short usage synopsis for each topic. The other thing I want to address in this CnC is echo. Yes, that thing you use to print something to the screen. I want you to try this: It is just a quote from ‘Bridge to Tarabithia’, but you can type anything. Put as many spaces as you like between the words. See what you get. So if you have some horribly formatted text, you can use echo to straighten it out for you; neat, hey? Simply type echo, then copy and paste the badly formatted text in and press enter. There may also be the odd occasion where you need to actually push spaces to the screen. The way to do that is to encapsulate the text with quotes. Maintenant, je veux que vous répétiez cela avec -m au lieu de -d. Vous remarquerez que cela ressemble un peu à une page de manuel. À quoi sert -m, selon vous ? Oui ! Option : -m Afficher l'utilisation sous forme de pseudo-page de manuel. Vous conviendrez que c'est mieux que la page de manuel. En cas de doute, consultez à nouveau la page de manuel. Si nous voulions voir la syntaxe, que pensez-vous qu'on utiliserait ? Correct, -s ! Vous êtes vraiment doués. Soudain, la ligne de commande Linux n'est plus si effrayante ! Alors, allez-y, essayez : help -s printf Option : -s Afficher un court résumé d'utilisation pour chaque sujet. L'autre point que je souhaite aborder dans ce C&C est echo. Oui, cet outil qui permet d'afficher quelque chose à l'écran. Je veux que vous essayiez la commande affichée dans l'image ci-dessous. C'est juste une citation de « Bridge to Tarabithia », mais vous pouvez saisir ce que vous voulez. Mettez autant d'espaces que vous le souhaitez entre les mots. Voyez ce que vous obtenez. Ainsi, si votre texte est mal formaté, vous pouvez utiliser echo pour le rectifier ; sympa, non ? Tapez simplement echo, copiez-collez le texte mal formaté et appuyez sur Entrée. Il peut également arriver que vous ayez vraiment besoin des espaces à l'écran. Pour cela, entourez le texte de guillemets. Obviously, if the text has no quotes, it does not matter which quotes you use, double or single. Usually one uses these quotes to insert escape characters. Quoted lines can include special escaped characters recognized by the echo command (when using echo -e).

Try: echo -e “ a new line\n here and also a \t tab”

You may not know all these escape characters, but now is a great time to give the help command a go as above. I suggest using all the options at your disposal to get used to them.

Those of you who actually did it before I suggested it, bravo! You will have this command line thing down in no time!

Just be aware that some commands are installed with external applications and may not have a help file or a man page. Here you usually need to try -h or –help as an alternative. My suggestion is to make sure of what you are installing, from say, github, by reading the new command’s documentation. Some of these may not even have any help built in, so it would be up to you to familiarise yourself with the command before you forget where you installed it from.

If the program you installed does not seem to respond to any of the usual channels, you can try the “Windows” way by using “/?” instead. Sometimes these things are written with Windows in mind and somehow find their way into the Linux ecosystem.

Remember that as per my answer in QnA, there is always F1. F1 from within a program, is usually help, though it will not help you on the command line.

OK, I hope I helped someone find help and gave one of you, at least, a handy tip to format text.

If you think there are errors here: misc@fullcirclemagazine.org **

Bien sûr, si le texte ne contient pas de guillemets, peu importe les guillemets utilisés, simples ou doubles. On utilise généralement ces guillemets pour insérer des caractères d'échappement. Les lignes entre guillemets peuvent inclure des caractères d'échappement spéciaux reconnus par la commande echo (avec echo -e).

Essayez :

echo -e « un saut de ligne\n ici et aussi une tabulation \t »

Vous ne connaissez peut-être pas tous ces caractères d'échappement, mais c'est le moment idéal pour essayer la commande d'aide comme ci-dessus. Je vous suggère d'utiliser toutes les options à votre disposition pour vous y familiariser.

Bravo à ceux d'entre vous qui l'ont déjà fait avant moi ! Vous maîtriserez cette ligne de commande en un rien de temps !

Sachez simplement que certaines commandes sont installées avec des applications externes et peuvent ne pas avoir de fichier d'aide ni de page de manuel. Dans ce cas, vous devrez généralement essayer -h ou –help comme alternative. Je vous conseille de vérifier ce que vous installez, par exemple depuis GitHub, en lisant la documentation de la nouvelle commande. Certains programmes n'intègrent peut-être même pas d'aide ; il vous appartient donc de vous familiariser avec la commande avant d'oublier d'où vous l'avez installé.

Si le programme que vous avez installé ne semble répondre à aucun des canaux habituels, vous pouvez essayer la méthode « Windows » en utilisant « / ?». Parfois, ces programmes sont conçus pour Windows et finissent par s'intégrer à l'écosystème Linux.

N'oubliez pas que, comme je l'ai indiqué dans ma réponse Q. & R., il y a toujours la touche F1. Dans un programme, la touche F1 sert généralement d'aide, mais elle ne vous sera d'aucune aide en ligne de commande.

J'espère avoir aidé quelqu'un et avoir donné à l'un d'entre vous, au moins, une astuce pratique pour formater du texte.

Si vous pensez qu'il y a des erreurs ici : misc@fullcirclemagazine.org

issue219/c_c.1753850983.txt.gz · Dernière modification : 2025/07/30 06:49 de d52fr