issue132:c_c
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue132:c_c [2018/04/30 12:13] – créée auntiee | issue132:c_c [2018/05/02 19:19] (Version actuelle) – auntiee | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | I’ve frequently written articles on tools and websites that I find useful in my work life. However, it has been a long time since I focused on CLI tools. As such, I thought it would be good to revisit this topic and share an up-to-date list of commands that I find myself using almost every day. | + | **I’ve frequently written articles on tools and websites that I find useful in my work life. However, it has been a long time since I focused on CLI tools. As such, I thought it would be good to revisit this topic and share an up-to-date list of commands that I find myself using almost every day. |
dig | dig | ||
Ligne 7: | Ligne 7: | ||
dig @8.8.8.8 google.com | dig @8.8.8.8 google.com | ||
- | The @ indicates what DNS server it should use - omitting this will use your default DNS. | + | The @ indicates what DNS server it should use - omitting this will use your default DNS.** |
- | time | + | J'ai fréquemment écrit des articles sur les outils et les sites Web que je trouve utiles pour ma vie professionnelle. Cependant, il s'est passé longtemps depuis que j'ai ciblé les outils en ligne de commande (CLI), de sorte que j'ai pensé qu'il serait bien de revisiter ce sujet et de partager une liste à jour des commandes que j' |
+ | |||
+ | dig | ||
+ | |||
+ | Dig est un outil qui vous permet d' | ||
+ | |||
+ | dig @8.8.8.8 google.com | ||
+ | |||
+ | Le @ indique quel serveur DNS il faut utiliser, sans cela, il utilisera votre DNS par défaut. | ||
+ | |||
+ | **time | ||
If you’re a programmer or just someone who uses the CLI a lot, you may occasionally notice a command taking a long time to complete. When this happens to me, I like to run it through time to get a value for the duration of the command, and tweak settings as I compare the numbers. | If you’re a programmer or just someone who uses the CLI a lot, you may occasionally notice a command taking a long time to complete. When this happens to me, I like to run it through time to get a value for the duration of the command, and tweak settings as I compare the numbers. | ||
Ligne 20: | Ligne 30: | ||
Most likely, everyone already knows this command - but if you’re looking for a domain’s IP, or just checking whether or not something responds, this is a tool I use every day. If Ping indicates to me that one domain isn’t responding while another is, then I’ll move onto something like downforeveryoneorjustme.com | Most likely, everyone already knows this command - but if you’re looking for a domain’s IP, or just checking whether or not something responds, this is a tool I use every day. If Ping indicates to me that one domain isn’t responding while another is, then I’ll move onto something like downforeveryoneorjustme.com | ||
+ | |||
+ | ping www.google.com** | ||
+ | |||
+ | time | ||
+ | |||
+ | Que vous soyez un programmeur, | ||
+ | |||
+ | time < | ||
+ | |||
+ | Remplacez < | ||
+ | |||
+ | ping | ||
+ | |||
+ | Très probablement, | ||
+ | |||
ping www.google.com | ping www.google.com | ||
- | lynx | + | |
+ | **lynx | ||
Lynx is a CLI-based browser. While this isn’t a tool I use too frequently, it can be useful if you want a text-based display of a site (eg, a tutorial), or if your X Server won’t start and you need to google something without the aid of another device. | Lynx is a CLI-based browser. While this isn’t a tool I use too frequently, it can be useful if you want a text-based display of a site (eg, a tutorial), or if your X Server won’t start and you need to google something without the aid of another device. | ||
Ligne 28: | Ligne 54: | ||
tmux | tmux | ||
- | A few months ago, I switched from two monitors to a single ultra wide display. Previously I’d dedicate a single monitor to my terminal, but nowadays I have to split my display in order to have a comfortable size browser and terminal. While I can use i3 to vertically/ | + | A few months ago, I switched from two monitors to a single ultra wide display. Previously I’d dedicate a single monitor to my terminal, but nowadays I have to split my display in order to have a comfortable size browser and terminal. While I can use i3 to vertically/ |
- | tmux -d -s “Session Name” < | + | lynx |
+ | |||
+ | Lynx est un navigateur en ligne de commande. Bien qu'il ne soit pas un outil que j' | ||
+ | |||
+ | tmux | ||
+ | |||
+ | Il y a quelques mois, je suis passé de deux moniteurs à un seul avec un affichage ultra-large. Avant, j' | ||
+ | |||
+ | **tmux -d -s “Session Name” < | ||
The example creates a detached (hidden) session using the given command and session name. If you then want to check the output for errors (for example), you simply need to run the tmux attach command (and indicate the ID of the detached session). | The example creates a detached (hidden) session using the given command and session name. If you then want to check the output for errors (for example), you simply need to run the tmux attach command (and indicate the ID of the detached session). | ||
Ligne 36: | Ligne 70: | ||
grep or find | grep or find | ||
- | Very often, I’ll have some configuration files, or small text files with notes or fixes I’ve hastily typed up. When looking for the correct files, I almost always use grep (or find). Grep is used to check the contents of a file, while find can be used to search for files by name, type, etc. You can also combine the two commands by executing a grep search on all results returned by find (see example below). | + | Very often, I’ll have some configuration files, or small text files with notes or fixes I’ve hastily typed up. When looking for the correct files, I almost always use grep (or find). Grep is used to check the contents of a file, while find can be used to search for files by name, type, etc. You can also combine the two commands by executing a grep search on all results returned by find (see example below).** |
- | find . -name “*.py” -exec grep -H “searchterm” {} \; | + | tmux -d -s “Session Name” < |
+ | |||
+ | L' | ||
+ | |||
+ | grep ou find | ||
+ | |||
+ | Très souvent, j' | ||
+ | |||
+ | **find . -name “*.py” -exec grep -H “searchterm” {} \; | ||
The above command searches all python files in the local directory and subfolders for the word “searchterm”. The -H flag tells grep to list the file name, so you can actually know what file it is you’re looking for. You can adjust any of the parameters as necessary. | The above command searches all python files in the local directory and subfolders for the word “searchterm”. The -H flag tells grep to list the file name, so you can actually know what file it is you’re looking for. You can adjust any of the parameters as necessary. | ||
Ligne 44: | Ligne 86: | ||
killall | killall | ||
- | Also a command that most people probably know. It takes the name of an application, | + | Also a command that most people probably know. It takes the name of an application, |
- | < | + | find . -name “*.py” -exec grep -H “searchterm” {} \; |
+ | |||
+ | La commande ci-dessus cherche le mot « searchterm » dans tous les fichiers python dans le répertoire local et ses sous-dossiers. Le commutateur -H dit à grep de lister les noms de fichiers de sorte que vous pouvez vraiment savoir quel fichier vous cherchez. Vous pouvez régler chacun des paramètres si nécessaire. | ||
+ | |||
+ | killall | ||
+ | |||
+ | Encore une commande que tout le monde connaît probablement. Je donne le nom d'une application et il tue toutes ses instances. Très utile quand quelque chose ne répond pas ou qu'il n'y a pas de moyen officiel de l' | ||
+ | |||
+ | **< | ||
Not really a command, but a feature of the Linux Shell that I use all the time. It essentially says “if command1 completes successfully, | Not really a command, but a feature of the Linux Shell that I use all the time. It essentially says “if command1 completes successfully, | ||
Ligne 53: | Ligne 103: | ||
This is simply an additional argument to mkdir, which creates any folders along the path if they don’t exist. So, if you tell it to create ~/ | This is simply an additional argument to mkdir, which creates any folders along the path if they don’t exist. So, if you tell it to create ~/ | ||
+ | |||
+ | {item1, | ||
+ | |||
+ | < | ||
+ | |||
+ | Ce n'est pas vraiment une commande, mais une fonctionnalité du Shell de Linux que j' | ||
+ | |||
+ | mkdir -p | ||
+ | |||
+ | C'est juste un argument complémentaire pour mkdir, qui crée tous les dossiers d'un chemin quand ils n' | ||
{item1, | {item1, | ||
- | This is a convention that Bash and most other shells allow. It is essentially a list of options that it cycles through one by one. Combining it with the mkdir command from above, something like this is possible: | + | **This is a convention that Bash and most other shells allow. It is essentially a list of options that it cycles through one by one. Combining it with the mkdir command from above, something like this is possible: |
mkdir -p ~/ | mkdir -p ~/ | ||
Ligne 62: | Ligne 122: | ||
The command would create the folders 2017 and 2018 in the folder taxes. Each year would also contain the folders “receipts” and “forms”. The key thing here is to avoid using spaces around the commas. If you’re using spaces in the items, be sure to escape them or to enclose the items in quotes. | The command would create the folders 2017 and 2018 in the folder taxes. Each year would also contain the folders “receipts” and “forms”. The key thing here is to avoid using spaces around the commas. If you’re using spaces in the items, be sure to escape them or to enclose the items in quotes. | ||
- | I hope this list introduces you to a few new commands or shell tricks. If you know of a tool or a trick that I haven’t covered that you can’t live without, feel free to let me know about it via email. As always, I can be reached at lswest34+fcm@gmail.com. | + | I hope this list introduces you to a few new commands or shell tricks. If you know of a tool or a trick that I haven’t covered that you can’t live without, feel free to let me know about it via email. As always, I can be reached at lswest34+fcm@gmail.com.** |
+ | |||
+ | C'est une convention que Bash et la plupart des shells autorisent. C'est en gros une liste d' | ||
+ | |||
+ | mkdir -p ~/ | ||
+ | |||
+ | La commande créera les dossiers 2017 et 2018 dans le dossier taxes. Chacune des années contiendra aussi les dossiers « receipts » et « forms ». Le point clé ici est d' | ||
+ | |||
+ | J' | ||
issue132/c_c.1525083184.txt.gz · Dernière modification : 2018/04/30 12:13 de auntiee