{"id":6446,"date":"2021-01-29T07:35:49","date_gmt":"2021-01-29T07:35:49","guid":{"rendered":"http:\/\/hengowebsite.luong.fr\/?page_id=6446"},"modified":"2021-01-29T07:35:50","modified_gmt":"2021-01-29T07:35:50","slug":"powercli-linux","status":"publish","type":"page","link":"https:\/\/hengowebsite.luong.fr\/?page_id=6446","title":{"rendered":"PowerCli-Linux"},"content":{"rendered":"<div id='layer_slider_1'  class='avia-layerslider main_color avia-shadow  avia-builder-el-0  el_before_av_heading  avia-builder-el-first  container_wrap fullsize' style='  height: 701px;' ><\/div><div id='after_layer_slider_1'  class='main_color av_default_container_wrap container_wrap fullsize' style=' '  ><div class='container' ><div class='template-page content  av-content-full alpha units'><div class='post-entry post-entry-type-page post-entry-6446'><div class='entry-content-wrapper clearfix'>\n<div  style='padding-bottom:10px; ' class='av-special-heading av-special-heading-h3    avia-builder-el-1  el_after_av_layerslider  el_before_av_textblock  avia-builder-el-first  '><h3 class='av-special-heading-tag '  itemprop=\"headline\"  >Equivalences entre Linux et Windows (bash\/Dos\/Powershell)<\/h3><div class='special-heading-border'><div class='special-heading-inner-border' ><\/div><\/div><\/div>\n<section class=\"av_textblock_section \"  itemscope=\"itemscope\" itemtype=\"https:\/\/schema.org\/CreativeWork\" ><div class='avia_textblock  '   itemprop=\"text\" ><article>\n<div>\n<section class=\"ct cu cv cw cx\">\n<div class=\"n p\">\n<div class=\"ab ac ae af ag cy ai aj\">\n<div class=\"\">\n<h1 id=\"aed8\" class=\"cz da db dc b dd de df dg dh di dj dk dl dm dn do dp dq dr ds dt du dv dw dx dy\">Equivalences entre Linux et Windows (bash\/Dos\/Powershell)<\/h1>\n<div class=\"dz\">\n<div class=\"n ea eb ec ed\">\n<div class=\"o n\">\n<div><a href=\"https:\/\/louisjj.medium.com\/?source=post_page-----821e39e15bf--------------------------------\" rel=\"noopener\"><img decoding=\"async\" loading=\"lazy\" class=\"s ee ef eg\" src=\"https:\/\/miro.medium.com\/fit\/c\/96\/96\/0*yzet_BiNBxGSTybY.jpg\" alt=\"Louis Jeanne-Julien\" width=\"48\" height=\"48\" \/><\/a><\/div>\n<div class=\"eh aj s\">\n<div class=\"n\">\n<div>\n<div class=\"el n o em\"><span class=\"ei b ej ek bs en eo ep eq er es dy\"><a class=\"et eu bb bc bd be bf bg bh bi ev bl ew ex\" href=\"https:\/\/louisjj.medium.com\/?source=post_page-----821e39e15bf--------------------------------\" rel=\"noopener\">Louis Jeanne-Julien<\/a><\/span><\/p>\n<div class=\"ey s aw h\"><button class=\"ei b ez ek fa fb fc fd fe ff fg bi fh fi fj fk fl fm fn co fo fp\">Follow<\/button><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div><a class=\"et eu bb bc bd be bf bg bh bi ev bl ew ex\" href=\"https:\/\/medium.com\/ouidou\/equivalences-entre-linux-et-windows-bash-dos-powershell-821e39e15bf?source=post_page-----821e39e15bf--------------------------------\" rel=\"noopener\">Oct 16, 2020<\/a>\u00a0\u00b7\u00a012\u00a0min read<\/div>\n<\/div>\n<\/div>\n<div class=\"n fr fs ft fu fv fw fx fy z\">\n<div class=\"n o\">\n<div class=\"fz s aw\"><\/div>\n<div class=\"fz s aw\"><\/div>\n<div class=\"fz s aw\"><\/div>\n<div class=\"gd s\">\n<div class=\"gc\"><\/div>\n<\/div>\n<div class=\"ge s an\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h1 id=\"3088\" class=\"gf gg db ei gh gi gj gk gl gm gn go gp gq gr gs gt gu gv gw gx gy gz ha hb hc dy\" data-selectable-paragraph=\"\">Avant de commencer<\/h1>\n<p id=\"d799\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">Ca y est, vous avez \u00e9t\u00e9 plac\u00e9 sur le projet de vos r\u00eaves, qui va enfin vous permettre de laisser parler le g\u00e9nie qui est en vous! Mais\u2026 comment? pour des raisons de gestions d\u2019\u00e9quipe ou d\u2019exigences du client, vous devez vous passer de votre syst\u00e8me d\u2019exploitation pr\u00e9f\u00e9r\u00e9 pour travailler sur un syst\u00e8me inconnu, et forc\u00e9ment moins pratique que celui auquel vous \u00eates habitu\u00e9s? Il est toujours possible d\u2019effectuer des t\u00e2ches similaires, mais il faut r\u00e9-apprendre \u00e0 dire \u00e0 la machine comment faire&#8230; Heureusement, cet ensemble d\u2019\u00e9quivalences d\u2019instructions est l\u00e0 pour vous y aider!<br \/>\nDe fa\u00e7on g\u00e9n\u00e9rale, les instructions par ligne de commande sont effectu\u00e9es en\u00a0<strong class=\"hf hz\">bash\u00a0<\/strong>(ou similaire) pour les distributions Linux, et en\u00a0<strong class=\"hf hz\">Dos\u00a0<\/strong>(ou plus r\u00e9cemment\u00a0<strong class=\"hf hz\">Powershell<\/strong>) pour les distributions Windows. Ces syst\u00e8mes d\u2019exploitation et ces langages \u00e9tant diff\u00e9rents, il n\u2019existe pas n\u00e9cessairement d\u2019\u00e9quivalence directe entre deux commandes, et certains moyens d\u00e9tourn\u00e9s sont parfois n\u00e9cessaires pour effectuer une op\u00e9ration particuli\u00e8re. C\u2019est pourquoi cet petit manuel illustre plus diff\u00e9rents moyens de parvenir \u00e0 une m\u00eame fin sur diff\u00e9rents syst\u00e8mes qu\u2019une r\u00e9elle \u201ctraduction\u201d entre diverses commandes.<br \/>\nIl est avant tout utile d\u2019avoir quelques g\u00e9n\u00e9ralit\u00e9s \u00e0 l\u2019esprit :<\/p>\n<ul class=\"\">\n<li id=\"d54f\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy if ig ih dy\" data-selectable-paragraph=\"\">les commandes bash, et le dialogue avec un syst\u00e8me Linux de fa\u00e7on g\u00e9n\u00e9ral sont sensibles \u00e0 la casse. Ce n\u2019est pas le cas des commandes Dos\/Powershell.<\/li>\n<li id=\"cdc0\" class=\"hd he db hf b hg ii gk hi hj ij go hl hm ik ho hp hq il hs ht hu im hw hx hy if ig ih dy\" data-selectable-paragraph=\"\">les wildcards sont g\u00e9n\u00e9ralement compris par les 2 syst\u00e8mes d\u2019exploitation. Par exemple, pour supprimer tous les fichier textes d\u2019un dossier, il est possible d\u2019utiliser la commande de suppression sur\u00a0<code class=\"in io ip iq ir b\">*.txt<\/code>.<\/li>\n<li id=\"04e0\" class=\"hd he db hf b hg ii gk hi hj ij go hl hm ik ho hp hq il hs ht hu im hw hx hy if ig ih dy\" data-selectable-paragraph=\"\">lorsqu\u2019une commande a pour r\u00e9sultat l\u2019affichage d\u2019informations dans la sortie standard (affichage du contenu d\u2019un fichier, listage du contenu d\u2019un dossier, etc\u2026), il est possible sous Windows comme sous Linux d\u2019enregistrer ces informations dans un fichier par l\u2019utilisation de chevrons :<br \/>\n<code class=\"in io ip iq ir b\"><commande> > fichier<\/code>: le r\u00e9sultat est enregistr\u00e9 dans le fichier, qui est \u00e9cras\u00e9\/cr\u00e9\u00e9 pour l\u2019occasion.<br \/>\n<code class=\"in io ip iq ir b\"><commande> >> fichier<\/code>: le r\u00e9sultat est concat\u00e9n\u00e9 au fichier, qui est cr\u00e9\u00e9 si besoin, sans \u00eatre \u00e9cras\u00e9.<\/li>\n<li id=\"0cad\" class=\"hd he db hf b hg ii gk hi hj ij go hl hm ik ho hp hq il hs ht hu im hw hx hy if ig ih dy\" data-selectable-paragraph=\"\">il est possible de consulter directement la documentation sur une commande dans la console d\u2019instructions, avec\u00a0<code class=\"in io ip iq ir b\">man <commande><\/code>\u00a0ou\u00a0<code class=\"in io ip iq ir b\"><commande> -h<\/code>\u00a0sous\u00a0<strong class=\"hf hz\">Linux<\/strong>,\u00a0<code class=\"in io ip iq ir b\"><commande> \/?<\/code>\u00a0sous\u00a0<strong class=\"hf hz\">Windows<\/strong>, ou encore\u00a0<code class=\"in io ip iq ir b\"><commande> -whatif<\/code>\u00a0en Powershell.<\/li>\n<li id=\"9353\" class=\"hd he db hf b hg ii gk hi hj ij go hl hm ik ho hp hq il hs ht hu im hw hx hy if ig ih dy\" data-selectable-paragraph=\"\">les commandes Dos sont souvent d\u00e9clar\u00e9es comme alias des commandes Powershell. Il est donc g\u00e9n\u00e9ralement possible d\u2019utiliser les commandes Dos dans la console Powershell.<\/li>\n<li id=\"ec10\" class=\"hd he db hf b hg ii gk hi hj ij go hl hm ik ho hp hq il hs ht hu im hw hx hy if ig ih dy\" data-selectable-paragraph=\"\">certaines commandes peuvent \u00eatre agr\u00e9ment\u00e9es d\u2019une longue liste d\u2019options, qui ne sont pas toutes pr\u00e9sent\u00e9es ici, certaines listes \u00e9tant loin d\u2019\u00eatre exhaustives. Ainsi, pour une utilisation sur-mesure parfaitement adapt\u00e9e \u00e0 un script particulier, il est toujours recommand\u00e9 de consulter la documentation des commandes que l\u2019on souhaite utiliser.<\/li>\n<li id=\"7290\" class=\"hd he db hf b hg ii gk hi hj ij go hl hm ik ho hp hq il hs ht hu im hw hx hy if ig ih dy\" data-selectable-paragraph=\"\">il est possible de cumuler diff\u00e9rentes options sur une m\u00eame commande :<br \/>\n<strong class=\"hf hz\">bash\u00a0<\/strong>:\u00a0<code class=\"in io ip iq ir b\"><commande> -option1option2<\/code>, par exemple\u00a0<code class=\"in io ip iq ir b\">ls -lArth<\/code>\u00a0(<code class=\"in io ip iq ir b\">ls -l -A -r -t -h<\/code>fonctionne \u00e9galement)<br \/>\n<strong class=\"hf hz\">Dos\u00a0<\/strong>:\u00a0<code class=\"in io ip iq ir b\"><commande> \/option1 \/option2<\/code><br \/>\n<strong class=\"hf hz\">Powershell\u00a0<\/strong>:\u00a0<code class=\"in io ip iq ir b\"><commande> -option1 -option2<\/code><\/li>\n<li id=\"c0c0\" class=\"hd he db hf b hg ii gk hi hj ij go hl hm ik ho hp hq il hs ht hu im hw hx hy if ig ih dy\" data-selectable-paragraph=\"\">afin d\u2019\u00e9viter d\u2019avoir \u00e0 \u00e9crire l\u2019int\u00e9gralit\u00e9 d\u2019une commande, l\u2019autocompl\u00e9tion est impl\u00e9ment\u00e9e sous\u00a0<strong class=\"hf hz\">Linux\u00a0<\/strong>comme sous\u00a0<strong class=\"hf hz\">Windows\u00a0<\/strong>: apr\u00e8s avoir tap\u00e9 les premi\u00e8res lettres, la touche de tabulation compl\u00e8tera automatiquement avec le reste de la commande. Si les premi\u00e8res lettres rentr\u00e9es peuvent potentiellement constituer le d\u00e9but de plusieurs instructions, l\u2019autocompl\u00e9tion se comporte diff\u00e9remment en bash et en Dos\/Powershell :<br \/>\n<strong class=\"hf hz\">bash\u00a0<\/strong>: la ligne est compl\u00e9t\u00e9e jusqu\u2019au point o\u00f9 les diverses instructions potentielles divergent, et l\u2019utilisateur doit entrer une lettre suppl\u00e9mentaire avant de r\u00e9-utiliser l\u2019autocompl\u00e9tion. Appuyer 2 fois successives sur la touche de tabulation permet d\u2019obtenir la liste des instructions possibles.<br \/>\n<strong class=\"hf hz\">Dos \/ Powershell\u00a0<\/strong>: la ligne est compl\u00e9t\u00e9e avec la totalit\u00e9 de la premi\u00e8re instruction valide. Appuyer \u00e0 nouveau sur la touche de tabulation changera la ligne pour qu\u2019elle corresponde \u00e0 la deuxi\u00e8me instruction valide, etc\u2026 La liste des diverses instructions potentielles est parcourue dans l\u2019ordre alphab\u00e9tique.<\/li>\n<\/ul>\n<figure class=\"it iu iv iw ix iy iz ja fn jb jc jd je jf bg jg jh ji jj jk jl paragraph-image\">\n<div class=\"cl cm is\">\n<div class=\"jr s js in\">\n<div class=\"jt ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*2YoAVR0XBLhHKV8pyuqZmw.jpeg?q=20\" alt=\"Image for post\" width=\"450\" height=\"210\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/450\/1*2YoAVR0XBLhHKV8pyuqZmw.jpeg\" sizes=\"450px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*2YoAVR0XBLhHKV8pyuqZmw.jpeg 276w, https:\/\/miro.medium.com\/max\/450\/1*2YoAVR0XBLhHKV8pyuqZmw.jpeg 450w\" alt=\"Image for post\" width=\"450\" height=\"210\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<p id=\"9ae7\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">Ca y est, nous pouvons rentrer dans le vif du sujet! L\u2019impl\u00e9mentation des tables \u00e9tant compliqu\u00e9e sur Medium, les tables ci-dessous sont des images, donc\u2026pas de copier-coller des commandes possible.<\/p>\n<h1 id=\"fa71\" class=\"gf gg db ei gh gi gj gk gl gm gn go gp gq gr gs gt gu gv gw gx gy gz ha hb hc dy\" data-selectable-paragraph=\"\">Utilitaires g\u00e9n\u00e9raux<\/h1>\n<h2 id=\"e6dc\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Imprimer une phrase<\/h2>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm kp\">\n<div class=\"jr s js in\">\n<div class=\"kq ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*gv2Z9KolOnTko0mWBKc1ig.png?q=20\" alt=\"Image for post\" width=\"568\" height=\"107\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/568\/1*gv2Z9KolOnTko0mWBKc1ig.png\" sizes=\"568px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*gv2Z9KolOnTko0mWBKc1ig.png 276w, https:\/\/miro.medium.com\/max\/552\/1*gv2Z9KolOnTko0mWBKc1ig.png 552w, https:\/\/miro.medium.com\/max\/568\/1*gv2Z9KolOnTko0mWBKc1ig.png 568w\" alt=\"Image for post\" width=\"568\" height=\"107\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h2 id=\"573c\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Ex\u00e9cuter une commande en tant qu\u2019admin<\/h2>\n<p id=\"52d9\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">Sous\u00a0<strong class=\"hf hz\">Linux<\/strong>, un utilisateur non administrateur peut lancer les commandes en tant qu\u2019administrateur s\u2019il conna\u00eet le mot de passe admin, et qu\u2019il fait partie du groupe des \u2018sudoers\u2019. Sous\u00a0<strong class=\"hf hz\">Windows<\/strong>, outre l\u2019alternative \u2018runas\u2019 peu utilis\u00e9e, il est possible de lancer toute une console en tant qu\u2019administrateur, c\u2019est pourquoi la commande Powershell n\u2019est pas indiqu\u00e9e.<\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm kr\">\n<div class=\"jr s js in\">\n<div class=\"ks ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*_cH9ZXFBwm4c284VDZmwUA.png?q=20\" alt=\"Image for post\" width=\"373\" height=\"76\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/373\/1*_cH9ZXFBwm4c284VDZmwUA.png\" sizes=\"373px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*_cH9ZXFBwm4c284VDZmwUA.png 276w, https:\/\/miro.medium.com\/max\/373\/1*_cH9ZXFBwm4c284VDZmwUA.png 373w\" alt=\"Image for post\" width=\"373\" height=\"76\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h2 id=\"c5f4\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Recherche de texte<\/h2>\n<p id=\"c2a5\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">En bash comme en Dos ou Powershell, la liste des options pour affiner la recherche de texte est consid\u00e9rable. Les options pr\u00e9sent\u00e9es ici sont communes, mais cette liste est loin d\u2019\u00eatre exhaustive.<\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"ku kv js kw aj kx\" tabindex=\"0\" role=\"button\">\n<div class=\"cl cm kt\">\n<div class=\"jr s js in\">\n<div class=\"ky ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*ewFQlbc1JtOaHxn11onhmA.png?q=20\" alt=\"Image for post\" width=\"920\" height=\"367\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/920\/1*ewFQlbc1JtOaHxn11onhmA.png\" sizes=\"700px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*ewFQlbc1JtOaHxn11onhmA.png 276w, https:\/\/miro.medium.com\/max\/552\/1*ewFQlbc1JtOaHxn11onhmA.png 552w, https:\/\/miro.medium.com\/max\/640\/1*ewFQlbc1JtOaHxn11onhmA.png 640w, https:\/\/miro.medium.com\/max\/700\/1*ewFQlbc1JtOaHxn11onhmA.png 700w\" alt=\"Image for post\" width=\"920\" height=\"367\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<p id=\"f72b\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">Concernant l\u2019affichage des num\u00e9ros de ligne en Powershell, deux options sont possibles :<\/p>\n<ul class=\"\">\n<li id=\"98fd\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy if ig ih dy\" data-selectable-paragraph=\"\"><code class=\"in io ip iq ir b\">(Get-Content <fichier> | Select-String <texte>).LineNumber\u00a0<\/code>: cette option affiche uniquement le num\u00e9ro des lignes, non les r\u00e9sultats eux-m\u00eames.<\/li>\n<li id=\"bb01\" class=\"hd he db hf b hg ii gk hi hj ij go hl hm ik ho hp hq il hs ht hu im hw hx hy if ig ih dy\" data-selectable-paragraph=\"\"><code class=\"in io ip iq ir b\">$i=1; (Get-Content <fichier> | Select-String <texte>) | % {\"$($i) `t $_\"; $i++}<\/code>: cette option plus verbeuse permet d\u2019afficher le num\u00e9ro de ligne et la ligne en question, s\u00e9par\u00e9s par une tabulation.<\/li>\n<\/ul>\n<h2 id=\"186f\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Afficher l\u2019historique des commandes utilis\u00e9es<\/h2>\n<p id=\"c29a\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">L\u2019affichage de l\u2019historique des commandes est souvent suivi d\u2019une recherche de texte pour filtrer les r\u00e9sultats.<\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm kz\">\n<div class=\"jr s js in\">\n<div class=\"la ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*MzqkwBEoJp3HVeT8A3hbow.png?q=20\" alt=\"Image for post\" width=\"399\" height=\"107\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/399\/1*MzqkwBEoJp3HVeT8A3hbow.png\" sizes=\"399px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*MzqkwBEoJp3HVeT8A3hbow.png 276w, https:\/\/miro.medium.com\/max\/399\/1*MzqkwBEoJp3HVeT8A3hbow.png 399w\" alt=\"Image for post\" width=\"399\" height=\"107\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h2 id=\"cbb1\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Effacer le contenu de la console<\/h2>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm lb\">\n<div class=\"jr s js in\">\n<div class=\"lc ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*PKnD3JZpl1uYZ-9Lb9AObw.png?q=20\" alt=\"Image for post\" width=\"181\" height=\"73\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/181\/1*PKnD3JZpl1uYZ-9Lb9AObw.png\" sizes=\"181px\" srcset=\"\" alt=\"Image for post\" width=\"181\" height=\"73\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h2 id=\"0264\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Fermer la console<\/h2>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm ld\">\n<div class=\"jr s js in\">\n<div class=\"le ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*90XVvfaqadj5ueCrmexmBA.png?q=20\" alt=\"Image for post\" width=\"182\" height=\"73\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/182\/1*90XVvfaqadj5ueCrmexmBA.png\" sizes=\"182px\" srcset=\"\" alt=\"Image for post\" width=\"182\" height=\"73\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h1 id=\"a433\" class=\"gf gg db ei gh gi gj gk gl gm gn go gp gq gr gs gt gu gv gw gx gy gz ha hb hc dy\" data-selectable-paragraph=\"\">Navigation<\/h1>\n<h2 id=\"a307\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Afficher le r\u00e9pertoire courant<\/h2>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm lf\">\n<div class=\"jr s js in\">\n<div class=\"lg ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*kPFdXfl2H-YzgHrAv0P1hQ.png?q=20\" alt=\"Image for post\" width=\"189\" height=\"76\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/189\/1*kPFdXfl2H-YzgHrAv0P1hQ.png\" sizes=\"189px\" srcset=\"\" alt=\"Image for post\" width=\"189\" height=\"76\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h2 id=\"8bf4\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Changer de r\u00e9pertoire<\/h2>\n<p id=\"e511\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">En bash, la commande\u00a0<code class=\"in io ip iq ir b\">cd -<\/code>\u00a0permet de se d\u00e9placer vers le r\u00e9pertoire pr\u00e9c\u00e9dent.<br \/>\nSous\u00a0<strong class=\"hf hz\">Linux\u00a0<\/strong>comme sous\u00a0<strong class=\"hf hz\">Windows<\/strong>, le r\u00e9pertoire courant est not\u00e9\u00a0<code class=\"in io ip iq ir b\">.\/<\/code>, et le r\u00e9pertoire parent est not\u00e9\u00a0<code class=\"in io ip iq ir b\">..\/<\/code><\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm lh\">\n<div class=\"jr s js in\">\n<div class=\"li ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*tG8XENhVvlBzgiUqtfXq1Q.png?q=20\" alt=\"Image for post\" width=\"406\" height=\"71\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/406\/1*tG8XENhVvlBzgiUqtfXq1Q.png\" sizes=\"406px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*tG8XENhVvlBzgiUqtfXq1Q.png 276w, https:\/\/miro.medium.com\/max\/406\/1*tG8XENhVvlBzgiUqtfXq1Q.png 406w\" alt=\"Image for post\" width=\"406\" height=\"71\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h1 id=\"625a\" class=\"gf gg db ei gh gi gj gk gl gm gn go gp gq gr gs gt gu gv gw gx gy gz ha hb hc dy\" data-selectable-paragraph=\"\">Manipulation de fichiers et de r\u00e9pertoires<\/h1>\n<h2 id=\"3961\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Imprimer le contenu d\u2019un fichier dans la console<\/h2>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm lj\">\n<div class=\"jr s js in\">\n<div class=\"lk ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*PJ_geZ6hYkY4X63h-wqdrg.png?q=20\" alt=\"Image for post\" width=\"580\" height=\"108\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/580\/1*PJ_geZ6hYkY4X63h-wqdrg.png\" sizes=\"580px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*PJ_geZ6hYkY4X63h-wqdrg.png 276w, https:\/\/miro.medium.com\/max\/552\/1*PJ_geZ6hYkY4X63h-wqdrg.png 552w, https:\/\/miro.medium.com\/max\/580\/1*PJ_geZ6hYkY4X63h-wqdrg.png 580w\" alt=\"Image for post\" width=\"580\" height=\"108\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<p id=\"922c\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">En Powershell, l\u2019affichage des num\u00e9ros de lignes n\u00e9cessite (tout comme lors de la recherche de texte) d\u2019encha\u00eener plusieurs instructions, afin de g\u00e9n\u00e9rer ces num\u00e9ros et de les afficher avant chaque ligne :\u00a0<code class=\"in io ip iq ir b\">$i=1; Get-Content <fichier> | % {\"$($i) `t $_\"; $i++}<\/code><\/p>\n<h2 id=\"0624\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Copier un ou plusieurs fichiers\/r\u00e9pertoires<\/h2>\n<p id=\"ba83\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">En Dos, la copie est r\u00e9cursive par d\u00e9faut, mais seuls les fichiers contenus dans les diff\u00e9rents r\u00e9pertoires sont copi\u00e9s, et non les r\u00e9pertoires eux-m\u00eames.<\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"ku kv js kw aj kx\" tabindex=\"0\" role=\"button\">\n<div class=\"cl cm ll\">\n<div class=\"jr s js in\">\n<div class=\"lm ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*YfU78X4es-lPCDbxYtWDmg.png?q=20\" alt=\"Image for post\" width=\"922\" height=\"220\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/922\/1*YfU78X4es-lPCDbxYtWDmg.png\" sizes=\"700px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*YfU78X4es-lPCDbxYtWDmg.png 276w, https:\/\/miro.medium.com\/max\/552\/1*YfU78X4es-lPCDbxYtWDmg.png 552w, https:\/\/miro.medium.com\/max\/640\/1*YfU78X4es-lPCDbxYtWDmg.png 640w, https:\/\/miro.medium.com\/max\/700\/1*YfU78X4es-lPCDbxYtWDmg.png 700w\" alt=\"Image for post\" width=\"922\" height=\"220\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h2 id=\"6a35\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">D\u00e9placer\/renommer un ou plusieurs fichiers\/r\u00e9pertoires<\/h2>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm ln\">\n<div class=\"jr s js in\">\n<div class=\"lo ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*ZJydCH3QCcw2TzQ85ZKOOw.png?q=20\" alt=\"Image for post\" width=\"683\" height=\"75\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/683\/1*ZJydCH3QCcw2TzQ85ZKOOw.png\" sizes=\"683px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*ZJydCH3QCcw2TzQ85ZKOOw.png 276w, https:\/\/miro.medium.com\/max\/552\/1*ZJydCH3QCcw2TzQ85ZKOOw.png 552w, https:\/\/miro.medium.com\/max\/640\/1*ZJydCH3QCcw2TzQ85ZKOOw.png 640w, https:\/\/miro.medium.com\/max\/683\/1*ZJydCH3QCcw2TzQ85ZKOOw.png 683w\" alt=\"Image for post\" width=\"683\" height=\"75\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h2 id=\"a05f\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Cr\u00e9er un ou plusieurs nouveaux r\u00e9pertoires<\/h2>\n<p id=\"4334\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">Sous\u00a0<strong class=\"hf hz\">Linux\u00a0<\/strong>comme sous\u00a0<strong class=\"hf hz\">Windows<\/strong>, il est possible de g\u00e9n\u00e9rer plusieurs niveaux de r\u00e9pertoires :\u00a0<code class=\"in io ip iq ir b\"><commande de cr\u00e9ation> <dossier>\/<sous-dossier><\/code><\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"ku kv js kw aj kx\" tabindex=\"0\" role=\"button\">\n<div class=\"cl cm ll\">\n<div class=\"jr s js in\">\n<div class=\"lp ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*a2qOmGgxOdBl7sSdw2m3YA.png?q=20\" alt=\"Image for post\" width=\"922\" height=\"105\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/922\/1*a2qOmGgxOdBl7sSdw2m3YA.png\" sizes=\"700px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*a2qOmGgxOdBl7sSdw2m3YA.png 276w, https:\/\/miro.medium.com\/max\/552\/1*a2qOmGgxOdBl7sSdw2m3YA.png 552w, https:\/\/miro.medium.com\/max\/640\/1*a2qOmGgxOdBl7sSdw2m3YA.png 640w, https:\/\/miro.medium.com\/max\/700\/1*a2qOmGgxOdBl7sSdw2m3YA.png 700w\" alt=\"Image for post\" width=\"922\" height=\"105\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h2 id=\"3d77\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Cr\u00e9er un ou plusieurs nouveau fichiers<\/h2>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm lq\">\n<div class=\"jr s js in\">\n<div class=\"lr ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*xo0OF2KLFwLriKCFFt57JQ.png?q=20\" alt=\"Image for post\" width=\"550\" height=\"73\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/550\/1*xo0OF2KLFwLriKCFFt57JQ.png\" sizes=\"550px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*xo0OF2KLFwLriKCFFt57JQ.png 276w, https:\/\/miro.medium.com\/max\/550\/1*xo0OF2KLFwLriKCFFt57JQ.png 550w\" alt=\"Image for post\" width=\"550\" height=\"73\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<p id=\"6953\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">En bash, la fonction de la commande\u00a0<code class=\"in io ip iq ir b\">touch<\/code>\u00a0est en r\u00e9alit\u00e9 de mettre \u00e0 jour la date d\u2019acc\u00e8s et de modification du fichier pass\u00e9 en param\u00e8tre. Se ledit fichier n\u2019existe pas, il est cr\u00e9\u00e9. Cette commande est donc souvent utilis\u00e9e pour cr\u00e9er un nouveau fichier, mais il est possible d\u2019utiliser l\u2019option\u00a0<code class=\"in io ip iq ir b\">touch -c<\/code>\u00a0pour \u00e9viter de le cr\u00e9er s\u2019il n\u2019existe pas.<br \/>\nEn Dos, on utilise simplement un chevron pour rediriger une impression nulle dans le nouveau fichier.<\/p>\n<h2 id=\"b7f1\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Supprimer un ou plusieurs fichiers\/r\u00e9pertoires<\/h2>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"ku kv js kw aj kx\" tabindex=\"0\" role=\"button\">\n<div class=\"cl cm ls\">\n<div class=\"jr s js in\">\n<div class=\"lt ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*cFkEfcR8wH3d6SELr_7JVw.png?q=20\" alt=\"Image for post\" width=\"819\" height=\"209\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/819\/1*cFkEfcR8wH3d6SELr_7JVw.png\" sizes=\"700px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*cFkEfcR8wH3d6SELr_7JVw.png 276w, https:\/\/miro.medium.com\/max\/552\/1*cFkEfcR8wH3d6SELr_7JVw.png 552w, https:\/\/miro.medium.com\/max\/640\/1*cFkEfcR8wH3d6SELr_7JVw.png 640w, https:\/\/miro.medium.com\/max\/700\/1*cFkEfcR8wH3d6SELr_7JVw.png 700w\" alt=\"Image for post\" width=\"819\" height=\"209\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<p id=\"f96a\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">En Dos, la commande est r\u00e9cursive par d\u00e9faut, mais seuls les fichiers sont supprim\u00e9s et non les dossiers : cela est d\u00fb au fait que le dossier doit \u00eatre vide pour \u00eatre supprim\u00e9. Il faut donc en premier lieu utiliser\u00a0<code class=\"in io ip iq ir b\">del<\/code>\u00a0pour supprimer les fichiers, puis\u00a0<code class=\"in io ip iq ir b\">rd<\/code>\u00a0pour supprimer le dossier vide. L\u2019\u00e9quivalent bash de cette commande de suppression de dossier vide, plus pr\u00e9cautionneuse, est\u00a0<code class=\"in io ip iq ir b\">rmdir <dossier><\/code>, utilisable \u00e9galement telle quelle en Dos et Powershell.<\/p>\n<h2 id=\"3934\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Rechercher un fichier\/r\u00e9pertoire<\/h2>\n<p id=\"5a2a\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">En bash comme en Dos et Powershell, beaucoup d\u2019options cumulables existent pour affiner la recherche, la liste ci-dessous est non exhaustive.<br \/>\nAttention, pour l\u2019affinage selon une regex en bash, la regex doit correspondre au path complet, et donc inclure les caract\u00e8res \u2018^\u2019 et \u2018$\u2019.<\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"ku kv js kw aj kx\" tabindex=\"0\" role=\"button\">\n<div class=\"cl cm lu\">\n<div class=\"jr s js in\">\n<div class=\"lv ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*Stpc0baRIbdP8GY-PkQhHw.png?q=20\" alt=\"Image for post\" width=\"926\" height=\"361\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/926\/1*Stpc0baRIbdP8GY-PkQhHw.png\" sizes=\"700px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*Stpc0baRIbdP8GY-PkQhHw.png 276w, https:\/\/miro.medium.com\/max\/552\/1*Stpc0baRIbdP8GY-PkQhHw.png 552w, https:\/\/miro.medium.com\/max\/640\/1*Stpc0baRIbdP8GY-PkQhHw.png 640w, https:\/\/miro.medium.com\/max\/700\/1*Stpc0baRIbdP8GY-PkQhHw.png 700w\" alt=\"Image for post\" width=\"926\" height=\"361\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<p id=\"8e13\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">On remarque qu\u2019en Powershell, l\u2019affinage par nom ou regex est en fait constitu\u00e9 de 2 commandes jointes par un pipe.<br \/>\nEn bash, il est possible d\u2019utiliser des options pour effectuer directement des commandes sur chacun des r\u00e9sultats de la liste :<\/p>\n<ul class=\"\">\n<li id=\"dbbe\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy if ig ih dy\" data-selectable-paragraph=\"\"><code class=\"in io ip iq ir b\">find <r\u00e9pertoire de d\u00e9part><options> -exec <commande><\/code>\u00a0: ex\u00e9cution de la commande\u00a0<code class=\"in io ip iq ir b\"><commande><\/code>\u00a0sur chaque r\u00e9sultat, d\u00e9sign\u00e9 par la chaine \u201c{}\u201d. Exemple avec suppression de dossiers :\u00a0<code class=\"in io ip iq ir b\">find .\/ -type d -exec rmdir {}<\/code><\/li>\n<li id=\"14b5\" class=\"hd he db hf b hg ii gk hi hj ij go hl hm ik ho hp hq il hs ht hu im hw hx hy if ig ih dy\" data-selectable-paragraph=\"\"><code class=\"in io ip iq ir b\">find <r\u00e9pertoire de d\u00e9part><options> -execdir <commande><\/code>\u00a0: idem que la commande pr\u00e9c\u00e9dente, mais l\u2019instruction\u00a0<code class=\"in io ip iq ir b\"><commande><\/code>\u00a0est ici lanc\u00e9e depuis le r\u00e9pertoire contenant le r\u00e9sultat et non le r\u00e9pertoire courant.<\/li>\n<li id=\"4693\" class=\"hd he db hf b hg ii gk hi hj ij go hl hm ik ho hp hq il hs ht hu im hw hx hy if ig ih dy\" data-selectable-paragraph=\"\"><code class=\"in io ip iq ir b\">find <r\u00e9pertoire de d\u00e9part><options> -ok <commande><\/code>\u00a0: idem que pr\u00e9c\u00e9demment, mais une confirmation est demand\u00e9e syst\u00e9matiquement avant l\u2019ex\u00e9cution de l\u2019instruction\u00a0<code class=\"in io ip iq ir b\"><commande><\/code>. La diff\u00e9rence entre\u00a0<code class=\"in io ip iq ir b\">-ok<\/code>\u00a0et\u00a0<code class=\"in io ip iq ir b\">-okdir<\/code>\u00a0est la m\u00eame qu\u2019entre\u00a0<code class=\"in io ip iq ir b\">-exec<\/code>\u00a0et\u00a0<code class=\"in io ip iq ir b\">-execdir<\/code>.<\/li>\n<\/ul>\n<h2 id=\"2bc5\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Lister des fichiers\/r\u00e9pertoires<\/h2>\n<p id=\"3ade\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">Le listage concerne les \u00e9l\u00e9ments du r\u00e9pertoire courant par d\u00e9faut, mais il est possible de pr\u00e9ciser un r\u00e9pertoire apr\u00e8s la commande\u00a0<code class=\"in io ip iq ir b\">ls<\/code>,\u00a0<code class=\"in io ip iq ir b\">dir\u00a0<\/code>ou\u00a0<code class=\"in io ip iq ir b\">Get-ChildItem -Path<\/code>\u00a0pour pr\u00e9ciser depuis quel r\u00e9pertoire doit \u00eatre lanc\u00e9 l\u2019instruction.<\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm lw\">\n<div class=\"jr s js in\">\n<div class=\"lx ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*v-Q9BE7TmutbYkhEUcJOHg.png?q=20\" alt=\"Image for post\" width=\"516\" height=\"210\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/516\/1*v-Q9BE7TmutbYkhEUcJOHg.png\" sizes=\"516px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*v-Q9BE7TmutbYkhEUcJOHg.png 276w, https:\/\/miro.medium.com\/max\/516\/1*v-Q9BE7TmutbYkhEUcJOHg.png 516w\" alt=\"Image for post\" width=\"516\" height=\"210\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<p id=\"83c6\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">En bash, les r\u00e9sultats ne sont pas affich\u00e9s sous forme de liste par d\u00e9faut, il faut pour cela utiliser l\u2019option\u00a0<code class=\"in io ip iq ir b\">-l<\/code>. Pour plus de commodit\u00e9, la commande\u00a0<code class=\"in io ip iq ir b\">ls -l<\/code>est souvent enregistr\u00e9e sous l\u2019alias\u00a0<code class=\"in io ip iq ir b\">ll<\/code>.<br \/>\nEn bash,\u00a0<code class=\"in io ip iq ir b\">ls -a\u00a0<\/code>et\u00a0<code class=\"in io ip iq ir b\">ls -A\u00a0<\/code>fournissent le m\u00eame r\u00e9sultat, si ce n\u2019est que l\u2019utilisation de\u00a0<code class=\"in io ip iq ir b\">-a<\/code>\u00a0affiche \u00e9galement les dossiers .\/ et ..\/, \u00e0 l\u2019inverse de\u00a0<code class=\"in io ip iq ir b\">-A<\/code>.<\/p>\n<h2 id=\"9d6d\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Afficher une partie d\u2019un fichier (pratique pour les logs)<\/h2>\n<p id=\"b4ef\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">En bash, les options des commandes\u00a0<code class=\"in io ip iq ir b\">head<\/code>\u00a0et\u00a0<code class=\"in io ip iq ir b\">tail<\/code>\u00a0sont semblables, mais seule l\u2019une des deux commandes est affich\u00e9e dans la liste ci-dessous pour plus de commodit\u00e9.<\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"ku kv js kw aj kx\" tabindex=\"0\" role=\"button\">\n<div class=\"cl cm ly\">\n<div class=\"jr s js in\">\n<div class=\"lz ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*1nkihQSGHk8KcyfrDSNXUg.png?q=20\" alt=\"Image for post\" width=\"831\" height=\"174\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/831\/1*1nkihQSGHk8KcyfrDSNXUg.png\" sizes=\"700px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*1nkihQSGHk8KcyfrDSNXUg.png 276w, https:\/\/miro.medium.com\/max\/552\/1*1nkihQSGHk8KcyfrDSNXUg.png 552w, https:\/\/miro.medium.com\/max\/640\/1*1nkihQSGHk8KcyfrDSNXUg.png 640w, https:\/\/miro.medium.com\/max\/700\/1*1nkihQSGHk8KcyfrDSNXUg.png 700w\" alt=\"Image for post\" width=\"831\" height=\"174\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h2 id=\"9918\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Comparer deux fichiers ligne \u00e0 ligne<\/h2>\n<p id=\"f8ec\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">Pour plus de commodit\u00e9, dans les commandes ci-dessous,\u00a0<code class=\"in io ip iq ir b\"><fichier1><\/code>\u00a0et\u00a0<code class=\"in io ip iq ir b\"><fichier2><\/code>\u00a0ont \u00e9t\u00e9 respectivement remplac\u00e9s par\u00a0<code class=\"in io ip iq ir b\"><f1><\/code>\u00a0et\u00a0<code class=\"in io ip iq ir b\"><f2><\/code>.<br \/>\nEn Powershell, cette op\u00e9ration, bien que possible, est tr\u00e8s verbeuse. C\u2019est pourquoi elle ne figure pas dans la table, et est affich\u00e9e ci-apr\u00e8s :\u00a0<code class=\"in io ip iq ir b\">Compare-Object -ReferenceObject (Get-Content -Path <f1>) -DifferenceObject (Get-Content -Path <f2><\/code>. Il est possible d\u2019utiliser l\u2019option\u00a0<code class=\"in io ip iq ir b\">-CaseSensitive<\/code>\u00a0pour tenir compte des diff\u00e9rences de casse, qui sont ignor\u00e9es par d\u00e9faut.<\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm lj\">\n<div class=\"jr s js in\">\n<div class=\"ma ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*ffM9xJFMqESodsHIFsRQUw.png?q=20\" alt=\"Image for post\" width=\"580\" height=\"275\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/580\/1*ffM9xJFMqESodsHIFsRQUw.png\" sizes=\"580px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*ffM9xJFMqESodsHIFsRQUw.png 276w, https:\/\/miro.medium.com\/max\/552\/1*ffM9xJFMqESodsHIFsRQUw.png 552w, https:\/\/miro.medium.com\/max\/580\/1*ffM9xJFMqESodsHIFsRQUw.png 580w\" alt=\"Image for post\" width=\"580\" height=\"275\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<p id=\"4c83\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">En bash, si la cible ou la source est un r\u00e9pertoire, la comparaison est faite avec le fichier contenu dans ce r\u00e9pertoire portant le m\u00eame nom que le fichier \u00e0 comparer. Si la source et la cible sont tous deux des r\u00e9pertoires, la comparaison est faite entre tous les fichiers portant le m\u00eame nom dans les deux r\u00e9pertoires, dans l\u2019ordre alphab\u00e9tique. Cette comparaison n\u2019est pas r\u00e9cursive par d\u00e9faut, il faut utiliser l\u2019option\u00a0<code class=\"in io ip iq ir b\">-r<\/code>\u00a0pour cela.<\/p>\n<h1 id=\"406b\" class=\"gf gg db ei gh gi gj gk gl gm gn go gp gq gr gs gt gu gv gw gx gy gz ha hb hc dy\" data-selectable-paragraph=\"\">Gestion de syst\u00e8me<\/h1>\n<h2 id=\"ee2b\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Informations sur l\u2019utilisation du disque syst\u00e8me par les diff\u00e9rents syst\u00e8mes de fichiers<\/h2>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm lw\">\n<div class=\"jr s js in\">\n<div class=\"mb ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*KoFFeSUzwSImMAQ5ak8KIA.png?q=20\" alt=\"Image for post\" width=\"516\" height=\"154\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/516\/1*KoFFeSUzwSImMAQ5ak8KIA.png\" sizes=\"516px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*KoFFeSUzwSImMAQ5ak8KIA.png 276w, https:\/\/miro.medium.com\/max\/516\/1*KoFFeSUzwSImMAQ5ak8KIA.png 516w\" alt=\"Image for post\" width=\"516\" height=\"154\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<p id=\"32d4\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">En Powershell, \u00e0 partir de\u00a0<strong class=\"hf hz\">Windows 10<\/strong>, il est possible d\u2019utiliser la commande\u00a0<code class=\"in io ip iq ir b\">Get-Volume<\/code>, qui permet d\u2019obtenir les informations (nom du lecteur, type de partition, taille disponible, taille totale) concernant tous les volumes de toutes les partition.<\/p>\n<h2 id=\"d4c3\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Informations sur le volume occup\u00e9 par un fichier\/r\u00e9pertoire<\/h2>\n<p id=\"0138\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">Cette fonctionnalit\u00e9 n\u2019existe pas par d\u00e9faut en Dos ou Powershell, mais il est possible de cr\u00e9er un script en Powershell qui donne un r\u00e9sultat similaire. Ce script repose sur les commandes\u00a0<code class=\"in io ip iq ir b\">-Get-ChildItem\u00a0<\/code>et\u00a0<code class=\"in io ip iq ir b\">Measure-Object<\/code>\u00a0:<\/p>\n<pre class=\"it iu iv iw ix mc md ca\"><span id=\"e33b\" class=\"dy jy gg db ir b me mf mg s mh\" data-selectable-paragraph=\"\">function du-equivalent($dir=\".\") { \n  get-childitem $dir | \n    % { $f = $_ ; \n        get-childitem -r $_.FullName | \n           measure-object -property length -sum | \n             select @{Name=\"Name\";Expression={$f}},Sum}\n}<\/span><\/pre>\n<p id=\"55f0\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">Il doit \u00eatre not\u00e9 que la dur\u00e9e d\u2019ex\u00e9cution de ce script peut \u00eatre significative selon la taille du r\u00e9pertoire \u00e0 analyser.<br \/>\nEn bash, la commande\u00a0<code class=\"in io ip iq ir b\">du<\/code>\u00a0peut s\u2019appliquer \u00e0 un fichier ou un dossier qu\u2019il est possible de pr\u00e9ciser (par exemple\u00a0<code class=\"in io ip iq ir b\">du <dossier><\/code>). Par d\u00e9faut, elle s\u2019applique au r\u00e9pertoire courant.<\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm mi\">\n<div class=\"jr s js in\">\n<div class=\"mj ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*fj8KG0Kmd0YG4OWn5vgMsg.png?q=20\" alt=\"Image for post\" width=\"517\" height=\"305\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/517\/1*fj8KG0Kmd0YG4OWn5vgMsg.png\" sizes=\"517px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*fj8KG0Kmd0YG4OWn5vgMsg.png 276w, https:\/\/miro.medium.com\/max\/517\/1*fj8KG0Kmd0YG4OWn5vgMsg.png 517w\" alt=\"Image for post\" width=\"517\" height=\"305\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h2 id=\"1bae\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Informations sur le syst\u00e8me d\u2019exploitation<\/h2>\n<p id=\"e955\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">L\u2019obtention des informations sur le syst\u00e8me d\u2019exploitation peut \u00eatre facilement soumise \u00e0 un affinage en bash, mais la commande\u00a0<code class=\"in io ip iq ir b\">systeminfo<\/code>\u00a0utilis\u00e9e en Dos et Powershell donne directement toutes les informations disponibles. C\u2019est pourquoi seul le langage bash figure dans la table ce-dessous.<\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm mk\">\n<div class=\"jr s js in\">\n<div class=\"ml ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*WhPGA-jGgG_kxMxWB2qWaA.png?q=20\" alt=\"Image for post\" width=\"352\" height=\"267\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/352\/1*WhPGA-jGgG_kxMxWB2qWaA.png\" sizes=\"352px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*WhPGA-jGgG_kxMxWB2qWaA.png 276w, https:\/\/miro.medium.com\/max\/352\/1*WhPGA-jGgG_kxMxWB2qWaA.png 352w\" alt=\"Image for post\" width=\"352\" height=\"267\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h2 id=\"5802\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Changer les permissions sur un fichier\/r\u00e9pertoire<\/h2>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"ku kv js kw aj kx\" tabindex=\"0\" role=\"button\">\n<div class=\"cl cm mm\">\n<div class=\"jr s js in\">\n<div class=\"mn ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*8UOU96_TOCp3p39VhR0nxQ.png?q=20\" alt=\"Image for post\" width=\"919\" height=\"161\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/919\/1*8UOU96_TOCp3p39VhR0nxQ.png\" sizes=\"700px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*8UOU96_TOCp3p39VhR0nxQ.png 276w, https:\/\/miro.medium.com\/max\/552\/1*8UOU96_TOCp3p39VhR0nxQ.png 552w, https:\/\/miro.medium.com\/max\/640\/1*8UOU96_TOCp3p39VhR0nxQ.png 640w, https:\/\/miro.medium.com\/max\/700\/1*8UOU96_TOCp3p39VhR0nxQ.png 700w\" alt=\"Image for post\" width=\"919\" height=\"161\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<p id=\"55dd\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">En bash, \u2018xxx\u2019 correspond aux autorisations attribu\u00e9es au propri\u00e9taire du fichier, au groupe propri\u00e9taire, et aux autres utilisateurs, selon les sommes de num\u00e9ros : 1 (ex\u00e9cution)-2 (\u00e9criture)-4 (lecture).<br \/>\nExemple : si les droits sur le fichier\u00a0<code class=\"in io ip iq ir b\">fichier<\/code>\u00a0sont :<\/p>\n<ul class=\"\">\n<li id=\"db84\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy if ig ih dy\" data-selectable-paragraph=\"\">pour le propri\u00e9taire du fichier : ex\u00e9cution+lecture+\u00e9criture=1+2+4=7<\/li>\n<li id=\"ab80\" class=\"hd he db hf b hg ii gk hi hj ij go hl hm ik ho hp hq il hs ht hu im hw hx hy if ig ih dy\" data-selectable-paragraph=\"\">pour le groupe propri\u00e9taire : ex\u00e9cution+lecture=1+4=5<\/li>\n<li id=\"bf01\" class=\"hd he db hf b hg ii gk hi hj ij go hl hm ik ho hp hq il hs ht hu im hw hx hy if ig ih dy\" data-selectable-paragraph=\"\">pour n\u2019importe quel autre utilisateur : ex\u00e9cution=1<\/li>\n<\/ul>\n<p id=\"02a7\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">Alors, \u2018xxx\u2019 vaut 751.<br \/>\nIl est possible de changer le propri\u00e9taire ou le groupe propri\u00e9taire d\u2019un fichier avec les commandes\u00a0<code class=\"in io ip iq ir b\">chown<\/code>\u00a0et\u00a0<code class=\"in io ip iq ir b\">chgrp<\/code>.<br \/>\nEn Dos et Powershell, il est \u00e0 chaque fois n\u00e9cessaire pr\u00e9ciser l\u2019utilisateur pour qui les droits sont modifi\u00e9s.<\/p>\n<h2 id=\"700a\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Afficher la liste des t\u00e2ches\/processus en cours<\/h2>\n<p id=\"ea71\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">De (tr\u00e8s) nombreuses options existent pour ces commandes, dont l\u2019int\u00e9r\u00eat varient selon le contexte. Se reporter \u00e0 la documentation de ces commandes pour une liste exhaustive.<\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm mo\">\n<div class=\"jr s js in\">\n<div class=\"mp ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*LF2J6pSiipe_1TyKKQYvQA.png?q=20\" alt=\"Image for post\" width=\"397\" height=\"84\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/397\/1*LF2J6pSiipe_1TyKKQYvQA.png\" sizes=\"397px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*LF2J6pSiipe_1TyKKQYvQA.png 276w, https:\/\/miro.medium.com\/max\/397\/1*LF2J6pSiipe_1TyKKQYvQA.png 397w\" alt=\"Image for post\" width=\"397\" height=\"84\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h2 id=\"ba2a\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Arr\u00eater une t\u00e2che\/un processus<\/h2>\n<p id=\"0b88\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">Pour conna\u00eetre l\u2019identifiant du processus \u00e0 arr\u00eater qu\u2019il faut passer en param\u00e8tre des commandes ci-dessous, il est possible d\u2019utiliser la commande d\u2019affichage des processus en cours (voir ci-dessus), et d\u2019affiner la liste des r\u00e9sultats par une recherche de texte.<br \/>\nExemple bash :\u00a0<code class=\"in io ip iq ir b\">ps | grep firefox<\/code><br \/>\nExemple Powershell :\u00a0<code class=\"in io ip iq ir b\">tasklist | Select-String \"firefox\"<\/code><\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"ku kv js kw aj kx\" tabindex=\"0\" role=\"button\">\n<div class=\"cl cm mq\">\n<div class=\"jr s js in\">\n<div class=\"mr ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*3Xt9wdc-TLuw7yCaiSgD7Q.png?q=20\" alt=\"Image for post\" width=\"718\" height=\"121\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/718\/1*3Xt9wdc-TLuw7yCaiSgD7Q.png\" sizes=\"700px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*3Xt9wdc-TLuw7yCaiSgD7Q.png 276w, https:\/\/miro.medium.com\/max\/552\/1*3Xt9wdc-TLuw7yCaiSgD7Q.png 552w, https:\/\/miro.medium.com\/max\/640\/1*3Xt9wdc-TLuw7yCaiSgD7Q.png 640w, https:\/\/miro.medium.com\/max\/700\/1*3Xt9wdc-TLuw7yCaiSgD7Q.png 700w\" alt=\"Image for post\" width=\"718\" height=\"121\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<p id=\"72fd\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">En Powershell, l\u2019option\u00a0<code class=\"in io ip iq ir b\">-Force<\/code>\u00a0se contente de ne pas demander de confirmation.<\/p>\n<h2 id=\"a94a\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Informations sur les interfaces r\u00e9seau de la machine<\/h2>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"ku kv js kw aj kx\" tabindex=\"0\" role=\"button\">\n<div class=\"cl cm ms\">\n<div class=\"jr s js in\">\n<div class=\"mt ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*BP5RBIlG0PGjB8n2L0noqQ.png?q=20\" alt=\"Image for post\" width=\"596\" height=\"121\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/596\/1*BP5RBIlG0PGjB8n2L0noqQ.png\" sizes=\"596px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*BP5RBIlG0PGjB8n2L0noqQ.png 276w, https:\/\/miro.medium.com\/max\/552\/1*BP5RBIlG0PGjB8n2L0noqQ.png 552w, https:\/\/miro.medium.com\/max\/596\/1*BP5RBIlG0PGjB8n2L0noqQ.png 596w\" alt=\"Image for post\" width=\"596\" height=\"121\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<p id=\"adb8\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">En bash, la commande\u00a0<code class=\"in io ip iq ir b\">ifconfig<\/code>\u00a0permet \u00e9galement de configurer les diff\u00e9rentes interfaces r\u00e9seau selon les options utilis\u00e9es.<\/p>\n<h1 id=\"4b14\" class=\"gf gg db ei gh gi gj gk gl gm gn go gp gq gr gs gt gu gv gw gx gy gz ha hb hc dy\" data-selectable-paragraph=\"\">Connectivit\u00e9<\/h1>\n<h2 id=\"6c7d\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">V\u00e9rifier la connexion \u00e0 un serveur<\/h2>\n<p id=\"f793\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">Pour des raisons de s\u00e9curit\u00e9, le protocole utilis\u00e9 par la commande\u00a0<code class=\"in io ip iq ir b\">ping<\/code>\u00a0est souvent bloqu\u00e9, mais d\u2019autres commandes utilisant des protocoles diff\u00e9rents sont disponibles.<\/p>\n<p id=\"4a37\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">En Dos, la commande\u00a0<code class=\"in io ip iq ir b\">telnet<\/code>\u00a0doit \u00eatre activ\u00e9e avant de pouvoir \u00eatre utilis\u00e9e.<\/p>\n<p id=\"95cb\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">En bash et en Dos, la commande\u00a0<code class=\"in io ip iq ir b\">telnet<\/code>\u00a0utilise par d\u00e9faut le port 23 quand aucun port n\u2019est pr\u00e9cis\u00e9. En Powershell, il est syst\u00e9matiquement n\u00e9cessaire de pr\u00e9ciser le port.<\/p>\n<p id=\"aa4d\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">La commande\u00a0<code class=\"in io ip iq ir b\">netcat<\/code>\u00a0est une bo\u00eete \u00e0 outil comportant de nombreuses options pour interagir en utilisant les protocoles TCP et UDP. Cet outil n\u2019est pas disponible par d\u00e9faut sous\u00a0<strong class=\"hf hz\">Windows<\/strong>, bien qu\u2019il soit possible d\u2019installer\u00a0<code class=\"in io ip iq ir b\">ncat<\/code>, qui offre des fonctionnalit\u00e9s similaires.<\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"ku kv js kw aj kx\" tabindex=\"0\" role=\"button\">\n<div class=\"cl cm ll\">\n<div class=\"jr s js in\">\n<div class=\"mu ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*yqcDK-tjavlmUpKzGy9Yng.png?q=20\" alt=\"Image for post\" width=\"922\" height=\"274\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/922\/1*yqcDK-tjavlmUpKzGy9Yng.png\" sizes=\"700px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*yqcDK-tjavlmUpKzGy9Yng.png 276w, https:\/\/miro.medium.com\/max\/552\/1*yqcDK-tjavlmUpKzGy9Yng.png 552w, https:\/\/miro.medium.com\/max\/640\/1*yqcDK-tjavlmUpKzGy9Yng.png 640w, https:\/\/miro.medium.com\/max\/700\/1*yqcDK-tjavlmUpKzGy9Yng.png 700w\" alt=\"Image for post\" width=\"922\" height=\"274\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h2 id=\"8f71\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">T\u00e9l\u00e9charger une URL<\/h2>\n<p id=\"4c25\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">En bash, le t\u00e9l\u00e9chargement, et de fa\u00e7on g\u00e9n\u00e9rale l\u2019interaction avec les pages web se font par l\u2019interm\u00e9diaire de deux commandes principales :\u00a0<code class=\"in io ip iq ir b\">wget<\/code>\u00a0et\u00a0<code class=\"in io ip iq ir b\">curl<\/code>.<br \/>\nCes deux commandes sont en r\u00e9alit\u00e9 deux vastes boites \u00e0 outils, poss\u00e9dant de consid\u00e9rables listes d\u2019options. C\u2019est pourquoi la lecture de la documentation de ces commandes tr\u00e8s polyvalentes est vivement conseill\u00e9e, afin de pouvoir les adapter au mieux au contexte d\u2019utilisation.<br \/>\nIl est possible sous Windows d\u2019installer la commande\u00a0<code class=\"in io ip iq ir b\">wget<\/code>. En Powershell, il est possible d\u2019utiliser une alternative indirecte de cette commande :<\/p>\n<pre class=\"it iu iv iw ix mc md ca\"><span id=\"2810\" class=\"dy jy gg db ir b me mf mg s mh\" data-selectable-paragraph=\"\">$client = New-Object System.Net.WebClient\n$client.DownloadFile(\"<url>\")<\/span><\/pre>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"cl cm mv\">\n<div class=\"jr s js in\">\n<div class=\"mw ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*KNYcEU8JaCPOwmC9QwQiIw.png?q=20\" alt=\"Image for post\" width=\"470\" height=\"158\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/470\/1*KNYcEU8JaCPOwmC9QwQiIw.png\" sizes=\"470px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*KNYcEU8JaCPOwmC9QwQiIw.png 276w, https:\/\/miro.medium.com\/max\/470\/1*KNYcEU8JaCPOwmC9QwQiIw.png 470w\" alt=\"Image for post\" width=\"470\" height=\"158\" \/><\/div>\n<\/div>\n<\/div>\n<\/figure>\n<h2 id=\"d4f5\" class=\"jy gg db ei gh jz ka kb gl kc kd ke gp kf kg kh gt ki kj kk gx kl km kn hb ko dy\" data-selectable-paragraph=\"\">Informations d\u00e9taill\u00e9es sur une machine (ip, nom d\u2019h\u00f4te\u2026)<\/h2>\n<p id=\"dd69\" class=\"hd he db hf b hg hh gk hi hj hk go hl hm hn ho hp hq hr hs ht hu hv hw hx hy ct dy\" data-selectable-paragraph=\"\">Sous\u00a0<strong class=\"hf hz\">Linux<\/strong>, utiliser simplement la commande\u00a0<code class=\"in io ip iq ir b\">nslookup<\/code>\u00a0sans argument permet de lancer la console nslookup. Il suffit alors de rentrer une IP ou un nom d\u2019h\u00f4te pour obtenir les informations disponibles. Cette console permet d\u2019avoir acc\u00e8s \u00e0 d\u2019autres options dont l\u2019impl\u00e9mentation d\u00e9pend de la distribution\u00a0<strong class=\"hf hz\">Linux\u00a0<\/strong>utilis\u00e9e.<\/p>\n<p id=\"ba8e\" class=\"hd he db hf b hg ia gk hi hj ib go hl hm ic ho hp hq id hs ht hu ie hw hx hy ct dy\" data-selectable-paragraph=\"\">Les deux premi\u00e8res options de la table ci-dessous ne sont pas affich\u00e9es en Powershell, car la commande\u00a0<code class=\"in io ip iq ir b\">Resolve-DnsName <ip> (ou <host>)<\/code>\u00a0permet d\u2019effectuer ces actions.<\/p>\n<figure class=\"it iu iv iw ix iy cl cm paragraph-image\">\n<div class=\"ku kv js kw aj kx\" tabindex=\"0\" role=\"button\">\n<div class=\"cl cm mx\">\n<div class=\"jr s js in\">\n<div class=\"my ju s\">\n<div class=\"jm jn t u v jo aj bs jp jq\"><img decoding=\"async\" loading=\"lazy\" class=\"t u v jo aj jv jw ax vr\" src=\"https:\/\/miro.medium.com\/max\/60\/1*fKFWyCMDa17_fmiOh8OaJg.png?q=20\" alt=\"Image for post\" width=\"921\" height=\"255\" \/><\/div>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"vm vn t u v jo aj c\" src=\"https:\/\/miro.medium.com\/max\/921\/1*fKFWyCMDa17_fmiOh8OaJg.png\" sizes=\"700px\" srcset=\"https:\/\/miro.medium.com\/max\/276\/1*fKFWyCMDa17_fmiOh8OaJg.png 276w, https:\/\/miro.medium.com\/max\/552\/1*fKFWyCMDa17_fmiOh8OaJg.png 552w, https:\/\/miro.medium.com\/max\/640\/1*fKFWyCMDa17_fmiOh8OaJg.png 640w, https:\/\/miro.medium.com\/max\/700\/1*fKFWyCMDa17_fmiOh8OaJg.png 700w\" alt=\"Image for post\" width=\"921\" height=\"255\" \/><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/figure>\n<\/div>\n<\/div>\n<\/section>\n<\/div>\n<\/article>\n<div>\n<div class=\"pd iy n nk p\">\n<div class=\"n p\">\n<div class=\"ab ac ae af ag cy ai aj\">\n<div class=\"n pe\"><\/div>\n<div class=\"n o pe\"><\/div>\n<div class=\"pf s\">\n<ul class=\"bg bh\">\n<li class=\"fo bx gd pg\"><a class=\"ei b ez ph fq pi pj fp s md\" href=\"https:\/\/medium.com\/ouidou\/tagged\/command-line\">Command Line<\/a><\/li>\n<li class=\"fo bx gd pg\"><a class=\"ei b ez ph fq pi pj fp s md\" href=\"https:\/\/medium.com\/ouidou\/tagged\/bash\">Bash<\/a><\/li>\n<li class=\"fo bx gd pg\"><a class=\"ei b ez ph fq pi pj fp s md\" href=\"https:\/\/medium.com\/ouidou\/tagged\/powershell\">Powershell<\/a><\/li>\n<li class=\"fo bx gd pg\"><a class=\"ei b ez ph fq pi pj fp s md\" href=\"https:\/\/medium.com\/ouidou\/tagged\/linux\">Linux<\/a><\/li>\n<li class=\"fo bx gd pg\"><a class=\"ei b ez ph fq pi pj fp s md\" href=\"https:\/\/medium.com\/ouidou\/tagged\/windows\">Windows<\/a><\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div><\/section>\n<div  class='avia-button-wrap avia-button-center  avia-builder-el-3  el_after_av_textblock  avia-builder-el-last ' ><a href=''  class='avia-button  avia-color-theme-color   avia-icon_select-yes-left-icon avia-size-small avia-position-center '   ><span class='avia_button_icon avia_button_icon_left ' aria-hidden='true' data-av_icon='' data-av_iconfont='entypo-fontello'><\/span><span class='avia_iconbox_title' >Cliquez sur moi<\/span><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ngg_post_thumbnail":0},"_links":{"self":[{"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=\/wp\/v2\/pages\/6446"}],"collection":[{"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6446"}],"version-history":[{"count":3,"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=\/wp\/v2\/pages\/6446\/revisions"}],"predecessor-version":[{"id":6450,"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=\/wp\/v2\/pages\/6446\/revisions\/6450"}],"wp:attachment":[{"href":"https:\/\/hengowebsite.luong.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}