diff --git a/AUTHORS.md b/AUTHORS.md index c134346..302dcba 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -8,25 +8,27 @@ They have kindly agreed to review and help update future contributions for the t * [0xCD](https://github.com/0xCD) — [4+](https://github.com/jlevy/the-art-of-command-line/commits?author=0xCD)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3A0xCD) +* [Ahmad Zafrullah (23Pstars)](https://github.com/23Pstars) — [3+](https://github.com/jlevy/the-art-of-command-line/commits?author=23Pstars)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3A23Pstars) — _translation maintainer (id)_ * [Adrian Abreu Gonzalez (aabreuglez)](https://github.com/aabreuglez) — [6+](https://github.com/jlevy/the-art-of-command-line/commits?author=aabreuglez)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aaabreuglez) * [Antonio Ossa (aaossa)](https://github.com/aaossa) — [5+](https://github.com/jlevy/the-art-of-command-line/commits?author=aaossa)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aaaossa) — _translator (es)_ +* [Haoxuan Li (accnme)](https://github.com/accnme) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=accnme)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aaccnme) * [Ahmet Alp Balkan (ahmetalpbalkan)](https://github.com/ahmetalpbalkan) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=ahmetalpbalkan)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aahmetalpbalkan) * [Semir Patel (analogue)](https://github.com/analogue) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=analogue)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aanalogue) * [Andreas Hofmann (andreas-hofmann)](https://github.com/andreas-hofmann) — [2+](https://github.com/jlevy/the-art-of-command-line/commits?author=andreas-hofmann)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aandreas-hofmann) * [Desmond Stonie (aneasystone)](https://github.com/aneasystone) — [3+](https://github.com/jlevy/the-art-of-command-line/commits?author=aneasystone)/[8+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aaneasystone) -* [Haoxuan Li (angel1a)](https://github.com/angel1a) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=angel1a)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aangel1a) * [anna-4](https://github.com/anna-4) — [2+](https://github.com/jlevy/the-art-of-command-line/commits?author=anna-4)/[0+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aanna-4) * [anna-d (anna-d)](https://github.com/anna-d) — [19+](https://github.com/jlevy/the-art-of-command-line/commits?author=anna-d)/[5+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aanna-d) — _translation maintainer (el)_ * [Chong Guo (Armour)](https://github.com/Armour) — [2+](https://github.com/jlevy/the-art-of-command-line/commits?author=Armour)/[0+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3AArmour) — _translator (zh)_ * [Brad Beyenhof (augmentedfourth)](https://github.com/augmentedfourth) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=augmentedfourth)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aaugmentedfourth) * [b-jazz (b-jazz)](https://github.com/b-jazz) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=b-jazz)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Ab-jazz) * [bafoed](https://github.com/bafoed) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=bafoed)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Abafoed) +* [BogdanLp (bgdnlp)](https://github.com/bgdnlp) — _translator (ro)_ * [Alex Vergara Gil (BishopWolf)](https://github.com/BishopWolf) — [4+](https://github.com/jlevy/the-art-of-command-line/commits?author=BishopWolf)/[3+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3ABishopWolf) — _translator (es)_ * [Arturo Fernandez (bsnux)](https://github.com/bsnux) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=bsnux)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Absnux) * [Alex Cabrera (cabreraalex)](https://github.com/cabreraalex) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=cabreraalex)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Acabreraalex) * [Carlos Mantilla (ceoaliongroo)](https://github.com/ceoaliongroo) — [29+](https://github.com/jlevy/the-art-of-command-line/commits?author=ceoaliongroo)/[16+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aceoaliongroo) — _translation maintainer (es)_ * [Chris Kuehl (chriskuehl)](https://github.com/chriskuehl) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=chriskuehl)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Achriskuehl) -* [Corey "See More" Richardson (cmr)](https://github.com/cmr) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=cmr)/[3+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Acmr) +* [Corey "cmr" Richardson (cmr)](https://github.com/cmr) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=cmr)/[3+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Acmr) * [CodinCat (CodinCat)](https://github.com/CodinCat) — [2+](https://github.com/jlevy/the-art-of-command-line/commits?author=CodinCat)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3ACodinCat) * [Colas BROUX (ColasBroux)](https://github.com/ColasBroux) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=ColasBroux)/[2+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3AColasBroux) * [Colin Wang (colinwjd)](https://github.com/colinwjd) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=colinwjd)/[2+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Acolinwjd) @@ -35,7 +37,7 @@ They have kindly agreed to review and help update future contributions for the t * [Daniel t. (danasmera)](https://github.com/danasmera) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=danasmera)/[3+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Adanasmera) * [Dmytro Danylevskyi (danylevskyi)](https://github.com/danylevskyi) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=danylevskyi)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Adanylevskyi) * [Dave Loyall (daveloyall)](https://github.com/daveloyall) — [2+](https://github.com/jlevy/the-art-of-command-line/commits?author=daveloyall)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Adaveloyall) -* [Deborah Digges (Deborah-Digges)](https://github.com/Deborah-Digges) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=Deborah-Digges)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3ADeborah-Digges) +* [Deborah Gertrude Digges (Deborah-Digges)](https://github.com/Deborah-Digges) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=Deborah-Digges)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3ADeborah-Digges) * [Jamie Luck (delucks)](https://github.com/delucks) — [2+](https://github.com/jlevy/the-art-of-command-line/commits?author=delucks)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Adelucks) * [Dima Paloskin (dimapaloskin)](https://github.com/dimapaloskin) * [Michael Diamond (dimo414)](https://github.com/dimo414) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=dimo414)/[4+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Adimo414) @@ -43,14 +45,14 @@ They have kindly agreed to review and help update future contributions for the t * [Hayato Matsuura (doublemarket)](https://github.com/doublemarket) — [2+](https://github.com/jlevy/the-art-of-command-line/commits?author=doublemarket)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Adoublemarket) — _translation maintainer (ja)_ * [Diomidis Spinellis (dspinellis)](https://github.com/dspinellis) — [12+](https://github.com/jlevy/the-art-of-command-line/commits?author=dspinellis)/[5+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Adspinellis) — _section maintainer (Windows)_ * [Vincent Wong (EaterOA)](https://github.com/EaterOA) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=EaterOA)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3AEaterOA) -* [Éric Guirbal (ericguirbal)](https://github.com/ericguirbal) — [25+](https://github.com/jlevy/the-art-of-command-line/commits?author=ericguirbal)/[8+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aericguirbal) — _translation maintainer (fr)_ +* [Éric Guirbal (ericguirbal)](https://github.com/ericguirbal) — [28+](https://github.com/jlevy/the-art-of-command-line/commits?author=ericguirbal)/[10+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aericguirbal) — _translation maintainer (fr)_ * [Fernando Almeida (fernandoalmeida)](https://github.com/fernandoalmeida) — [8+](https://github.com/jlevy/the-art-of-command-line/commits?author=fernandoalmeida)/[2+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Afernandoalmeida) * [Yessou Sami (fnzv)](https://github.com/fnzv) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=fnzv)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Afnzv) * [Francesco Malatesta (francescomalatesta)](https://github.com/francescomalatesta) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=francescomalatesta)/[3+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Afrancescomalatesta) — _translation maintainer (it)_ * [Gaga Pan (gaga5lala)](https://github.com/gaga5lala) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=gaga5lala)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Agaga5lala) -* [Gernot Pointner (gernd)](https://github.com/gernd) — [6+](https://github.com/jlevy/the-art-of-command-line/commits?author=gernd)/[0+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Agernd) — _translator (de)_ +* [Gernot Pointner (gernd)](https://github.com/gernd) — [6+](https://github.com/jlevy/the-art-of-command-line/commits?author=gernd)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Agernd) — _translator (de)_ * [githubashto](https://github.com/githubashto) — _translator (ru)_ -* [Grigory Rechistov (grigory-rechistov)](https://github.com/grigory-rechistov) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=grigory-rechistov)/[0+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Agrigory-rechistov) — _translator (ru)_ +* [Grigory Rechistov (grigory-rechistov)](https://github.com/grigory-rechistov) — _translator (ru)_ * [Konstantin Gribov (grossws)](https://github.com/grossws) — [3+](https://github.com/jlevy/the-art-of-command-line/commits?author=grossws)/[6+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Agrossws) * [Ashhar Hasan (hashhar)](https://github.com/hashhar) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=hashhar)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Ahashhar) * [Beau Hastings (hastinbe)](https://github.com/hastinbe) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=hastinbe)/[4+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Ahastinbe) @@ -63,9 +65,9 @@ They have kindly agreed to review and help update future contributions for the t * [Igor Veksler (iveksl2)](https://github.com/iveksl2) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=iveksl2)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aiveksl2) * [J Alan Brogan (jalanb)](https://github.com/jalanb) — [2+](https://github.com/jlevy/the-art-of-command-line/commits?author=jalanb)/[3+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Ajalanb) * [James Kolce (jameskolce)](https://github.com/jameskolce) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=jameskolce)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Ajameskolce) -* [Joshua Levy (jlevy)](https://github.com/jlevy) — [140+](https://github.com/jlevy/the-art-of-command-line/commits?author=jlevy)/[38+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Ajlevy) — _orignal author and project maintainer_ -* [Jesse Sightler (jsight)](https://github.com/jsight) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=jsight)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Ajsight) -* [Konstantin Mikhaylov (jtraub)](https://github.com/jtraub) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=jtraub)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Ajtraub) +* [Joshua Levy (jlevy)](https://github.com/jlevy) — [142+](https://github.com/jlevy/the-art-of-command-line/commits?author=jlevy)/[41+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Ajlevy) — _orignal author and project maintainer_ +* [Jesse Sightler (jsight)](https://github.com/jsight) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=jsight)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Ajsight) +* [Konstantin Mikhailov (jtraub)](https://github.com/jtraub) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=jtraub)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Ajtraub) * [Jakub Wilk (jwilk)](https://github.com/jwilk) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=jwilk)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Ajwilk) * [Wael Nasreddine (kalbasit)](https://github.com/kalbasit) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=kalbasit)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Akalbasit) * [Colin Chan (kalgynirae)](https://github.com/kalgynirae) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=kalgynirae)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Akalgynirae) @@ -78,35 +80,36 @@ They have kindly agreed to review and help update future contributions for the t * [Dmytro Prokhorenkov (l13t)](https://github.com/l13t) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=l13t)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Al13t) * [Lakshmipathi (Lakshmipathi)](https://github.com/Lakshmipathi) — [10+](https://github.com/jlevy/the-art-of-command-line/commits?author=Lakshmipathi)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3ALakshmipathi) * [Pavel Zhukov (landgraf)](https://github.com/landgraf) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=landgraf)/[0+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Alandgraf) +* [libregeekingkid (libregeekingkid)](https://github.com/libregeekingkid) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=libregeekingkid)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Alibregeekingkid) * [Lampros Mountrakis (lmount)](https://github.com/lmount) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=lmount)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Almount) * [lsrom](https://github.com/lsrom) — [14+](https://github.com/jlevy/the-art-of-command-line/commits?author=lsrom)/[2+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Alsrom) — _translation maintainer (cs)_ * [Luke Yeager (lukeyeager)](https://github.com/lukeyeager) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=lukeyeager)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Alukeyeager) * [TAKAGI Masahiro (m-takagi)](https://github.com/m-takagi) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=m-takagi)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Am-takagi) -* [Not Mark (mark-i-m)](https://github.com/mark-i-m) — [5+](https://github.com/jlevy/the-art-of-command-line/commits?author=mark-i-m)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amark-i-m) +* [Who? Me?! (mark-i-m)](https://github.com/mark-i-m) — [5+](https://github.com/jlevy/the-art-of-command-line/commits?author=mark-i-m)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amark-i-m) * [marocchino](https://github.com/marocchino) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=marocchino)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amarocchino) -* [Matjaž Lipuš (matjaz)](https://github.com/matjaz) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=matjaz)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amatjaz) -* [Mayra Cabrera (mayra-cabrera)](https://github.com/mayra-cabrera) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=mayra-cabrera)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amayra-cabrera) +* [Matjaž Lipuš (matjaz)](https://github.com/matjaz) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=matjaz)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amatjaz) +* [Mayra Cabrera (mayra-cabrera)](https://github.com/mayra-cabrera) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=mayra-cabrera)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amayra-cabrera) * [Michael Barlow (michaelbarlow7)](https://github.com/michaelbarlow7) — [2+](https://github.com/jlevy/the-art-of-command-line/commits?author=michaelbarlow7)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amichaelbarlow7) +* [Mihai Maruseac (mihaimaruseac)](https://github.com/mihaimaruseac) — [8+](https://github.com/jlevy/the-art-of-command-line/commits?author=mihaimaruseac)/[2+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amihaimaruseac) — _translation maintainer (ro)_ * [Jinhui-Lin (mintisan)](https://github.com/mintisan) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=mintisan)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amintisan) * [Crisoforo Gaspar Hernández (mitogh)](https://github.com/mitogh) — [3+](https://github.com/jlevy/the-art-of-command-line/commits?author=mitogh)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amitogh) * [miuc (miuc)](https://github.com/miuc) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=miuc)/[2+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amiuc) * [Michael Kwardakov (mkwardakov)](https://github.com/mkwardakov) — [5+](https://github.com/jlevy/the-art-of-command-line/commits?author=mkwardakov)/[5+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amkwardakov) * [Harry Moreno (morenoh149)](https://github.com/morenoh149) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=morenoh149)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amorenoh149) -* [Dongliang Mu (mudongliang)](https://github.com/mudongliang) — [3+](https://github.com/jlevy/the-art-of-command-line/commits?author=mudongliang)/[8+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amudongliang) +* [Dongliang Mu (mudongliang)](https://github.com/mudongliang) — [3+](https://github.com/jlevy/the-art-of-command-line/commits?author=mudongliang)/[10+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Amudongliang) * [Nilton Vasques (niltonvasques)](https://github.com/niltonvasques) — [24+](https://github.com/jlevy/the-art-of-command-line/commits?author=niltonvasques)/[2+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aniltonvasques) — _translation maintainer (pt)_ * [Oleg Berman (olegberman)](https://github.com/olegberman) — [15+](https://github.com/jlevy/the-art-of-command-line/commits?author=olegberman)/[2+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aolegberman) — _translation maintainer (ru)_ -* [osmero](https://github.com/osmero) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=osmero)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aosmero) — _translator (ru)_ +* [osmero](https://github.com/osmero) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=osmero)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aosmero) — _translator (ru)_ * [Serg Petrov (p12se)](https://github.com/p12se) -* [Peter Kokot (peterkokot)](https://github.com/peterkokot) — [46+](https://github.com/jlevy/the-art-of-command-line/commits?author=peterkokot)/[32+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Apeterkokot) — _translation maintainer (sl)_ +* [Peter Kokot (peterkokot)](https://github.com/peterkokot) — [47+](https://github.com/jlevy/the-art-of-command-line/commits?author=peterkokot)/[33+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Apeterkokot) — _translation maintainer (sl)_ * [Ryan (picasso250)](https://github.com/picasso250) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=picasso250)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Apicasso250) * [Chujie Zeng (Psycho7)](https://github.com/Psycho7) — [19+](https://github.com/jlevy/the-art-of-command-line/commits?author=Psycho7)/[8+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3APsycho7) — _translation maintainer (zh)_ * [Rahul Kavale (rahulkavale)](https://github.com/rahulkavale) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=rahulkavale)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Arahulkavale) -* [Raju Devidas Vindane (rajuvindane)](https://github.com/rajuvindane) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=rajuvindane)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Arajuvindane) * [Rasmus Wriedt Larsen (RasmusWL)](https://github.com/RasmusWL) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=RasmusWL)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3ARasmusWL) * [Riley Shaw (rileyjshaw)](https://github.com/rileyjshaw) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=rileyjshaw)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Arileyjshaw) * [Ryan Delaney (rpdelaney)](https://github.com/rpdelaney) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=rpdelaney)/[2+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Arpdelaney) * [Remi Verchere (rverchere)](https://github.com/rverchere) — _translator (fr)_ -* [S1SYPHOS (S1SYPHOS)](https://github.com/S1SYPHOS) — [7+](https://github.com/jlevy/the-art-of-command-line/commits?author=S1SYPHOS)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3AS1SYPHOS) — _translation maintainer (de)_ +* [Martin Folkers (S1SYPHOS)](https://github.com/S1SYPHOS) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=S1SYPHOS)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3AS1SYPHOS) — _translation maintainer (de)_ * [Saksham Sharma (sakshamsharma)](https://github.com/sakshamsharma) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=sakshamsharma)/[3+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Asakshamsharma) * [Kit Chan (shukitchan)](https://github.com/shukitchan) — [2+](https://github.com/jlevy/the-art-of-command-line/commits?author=shukitchan)/[2+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Ashukitchan) * [Simarpreet Singh (simar7)](https://github.com/simar7) — [0+](https://github.com/jlevy/the-art-of-command-line/commits?author=simar7)/[2+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Asimar7) @@ -120,7 +123,7 @@ They have kindly agreed to review and help update future contributions for the t * [taxusyew](https://github.com/taxusyew) — [1+](https://github.com/jlevy/the-art-of-command-line/commits?author=taxusyew)/[2+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Ataxusyew) * [Thomas Lee (ThomasLee969)](https://github.com/ThomasLee969) — [12+](https://github.com/jlevy/the-art-of-command-line/commits?author=ThomasLee969)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3AThomasLee969) * [Timur (tim-teufel)](https://github.com/tim-teufel) — [4+](https://github.com/jlevy/the-art-of-command-line/commits?author=tim-teufel)/[3+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Atim-teufel) -* [Timothy Qiu (timothyqiu)](https://github.com/timothyqiu) — [2+](https://github.com/jlevy/the-art-of-command-line/commits?author=timothyqiu)/[1+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Atimothyqiu) +* [Timothy Qiu (timothyqiu)](https://github.com/timothyqiu) — [4+](https://github.com/jlevy/the-art-of-command-line/commits?author=timothyqiu)/[2+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Atimothyqiu) * [René Ribaud (uggla)](https://github.com/uggla) — [5+](https://github.com/jlevy/the-art-of-command-line/commits?author=uggla)/[10+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Auggla) * [Sungjin Kang (ujuc)](https://github.com/ujuc) — [6+](https://github.com/jlevy/the-art-of-command-line/commits?author=ujuc)/[0+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3Aujuc) — _translator (ko)_ * [Ungsik Yun (Ungsik-Yun)](https://github.com/Ungsik-Yun) — [15+](https://github.com/jlevy/the-art-of-command-line/commits?author=Ungsik-Yun)/[3+](https://github.com/jlevy/the-art-of-command-line/issues?q=author%3AUngsik-Yun) — _translation maintainer (ko)_ diff --git a/README-cs.md b/README-cs.md index 33cfddf..53515fc 100644 --- a/README-cs.md +++ b/README-cs.md @@ -1,5 +1,5 @@ 🌍 -*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* +*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Indonesia](README-id.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Română](README-ro.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* # Umění příkazové řádky diff --git a/README-de.md b/README-de.md index 6e3d9ba..91e174e 100644 --- a/README-de.md +++ b/README-de.md @@ -1,5 +1,5 @@ 🌍 -*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* +*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Indonesia](README-id.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Română](README-ro.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* # The Art of Command Line diff --git a/README-el.md b/README-el.md index e7b3861..ed51640 100644 --- a/README-el.md +++ b/README-el.md @@ -1,5 +1,5 @@ 🌍 -*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* +*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Indonesia](README-id.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Română](README-ro.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* # Η Τέχνη της Γραμμής Εντολών diff --git a/README-es.md b/README-es.md index fbfd016..d0d8d79 100644 --- a/README-es.md +++ b/README-es.md @@ -1,5 +1,5 @@ 🌍 -*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* +*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Indonesia](README-id.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Română](README-ro.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* # El Arte del Terminal diff --git a/README-fr.md b/README-fr.md index 4e03ca5..a979dba 100644 --- a/README-fr.md +++ b/README-fr.md @@ -1,9 +1,11 @@ 🌍 -*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* +*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Indonesia](README-id.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Română](README-ro.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* # L'art de la ligne de commande -[![Join the chat at https://gitter.im/jlevy/the-art-of-command-line](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jlevy/the-art-of-command-line?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Ask a Question](https://img.shields.io/badge/%3f-Ask%20a%20Question-ff69b4.svg)](https://airtable.com/shrzMhx00YiIVAWJg) + +[![Join the chat at https://gitter.im/jlevy/the-art-of-command-line](https://badges.gitter.im/Join%19Chat.svg)](https://gitter.im/jlevy/the-art-of-command-line?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - [Méta](#méta) - [Notions de base](#notions-de-base) @@ -27,6 +29,7 @@ Cette page n'est pas bien longue, mais si vous pouvez retenir et vous servir de Ce document est le fruit du travail de [nombreux auteurs et traducteurs](AUTHORS.md). Une partie de celui-ci a été [initialement](http://www.quora.com/What-are-some-lesser-known-but-useful-Unix-commands) [publiée](http://www.quora.com/What-are-the-most-useful-Swiss-army-knife-one-liners-on-Unix) sur [Quora](http://www.quora.com/What-are-some-time-saving-tips-that-every-Linux-user-should-know), mais il se trouve maintenant sur GitHub, où des personnes plus compétentes que l'auteur originel ont apporté de nombreuses améliorations. +[**N'hésitez pas à poser des questions**](https://airtable.com/shrzMhx00YiIVAWJg) sur la ligne de commande. [**Merci de contribuer**](/CONTRIBUTING.md) si vous voyez une erreur ou quelque chose qui pourrait être amélioré ! @@ -179,10 +182,15 @@ Un exemple classique consiste à se déplacer temporairement dans un autre répe # continue dans le répertoire original ``` -- Remarquez qu'en Bash il y a de nombreux types d'expansion des variables. -Vérifier l'existence d'une variable : `${name:?error message}`. -Par exemple, si un script en Bash exige un unique argument, il vous suffit d'écrire `input_file=${1:?usage: $0 input_file}`. -L'expansion arithmétique : `i=$(( (i + 1) % 5 ))`. Suites : `{1..10}`. Suppression de sous-chaînes : `${var%suffix}` et `${var#prefix}`. Par exemple, si `var=foo.pdf`, alors `echo ${var%.pdf}.txt` affiche `foo.txt`. +- Notez qu'en Bash, il existe de nombreux types d'expansions de variables. Pour vérifier l'existence d'une variable : `${name:?error message}`. +Par exemple, si un script en Bash exige un unique argument, il suffit d'écrire `input_file=${1:?usage: $0 input_file}`. +Pour utiliser une valeur par défaut si une variable est vide : `$(name:-default}`. +Si vous souhaitez ajouter un paramètre supplémentaire facultatif dans l'exemple précédent, vous pouvez écrire quelque chose comme `output_file=${2:-logfile}`. +Si `$2` est omis et donc vide, `output_file` prendra la valeur `logfile`. +L'évaluation arithmétique : `i=$(( (i+1) % 5)`. +Les listes d'entiers : `{1..10}` +Suppression de préfixes et de suffixes : `${var%suffix}` et `${var#prefix}`. +Par exemple, si `var=foo.pdf`, alors `echo ${var%.pdf}.txt` affiche `foo.txt`. - L'expansion des accolades avec `{`...`}` évite de retaper des textes similaires et automatise les combinaisons d'éléments de listes. C'est utile dans des exemples comme `mv foo.{txt,pdf} some-dir` (qui déplace les deux fichiers), `cp somefile{,.bak}` (équivalent à `cp somefile somefile.bak`) ou `mkdir -p test-{a,b,c}/subtest-{1,2,3}` (qui engendre toutes les combinaisons possibles et crée une arborescence de répertoires). @@ -193,7 +201,16 @@ Par exemple, pour comparer le fichier local `/etc/hosts` avec un fichier distant diff /etc/hosts <(ssh somehost cat /etc/hosts) ``` -- Renseignez-vous à propos des « here documents » avec Bash, comme dans `cat < logfile 2>&1` ou `some-command &>logfile`. Souvent, pour s'assurer qu'une commande ne laisse pas un descripteur de fichier ouvert sur l'entrée standard, l'attachant au terminal dans lequel vous vous trouvez, une bonne pratique consiste à ajouter `` dan `<` dan saluran menggunakan `|`. Ketahui bahwa `>` menimpa hasil keluaran dari sebuah berkas sedangkan `>>` menambahkan keluaran dibagian akhir dari berkas. Pelajari tentang `stdout` dan `stderr`. + +- Pelajari tentang penyebaran berkas dengan `*` (dan mungkin `?` dan `[`...`]`) dan tanda petik dan perbedaan antara petik dua `"` dan petik sati `'`. (Penjelasan lebih lanjut pada penyebaran variabel dibawah.) + +- Biasakan diri dengan pengelolaan tugas pada Bash: `&`, **ctrl-z**, **ctrl-c**, `jobs`, `fg`, `bg`, `kill`, dan lain sebagainya. + +- Ketahui tentang `ssh`, dan dasar autentikasi tanpa kata kunci, melalui `ssh-agent`, `ssh-add`, dan lain sebagainya. + +- Dasar pengelolaan berkas: `ls` dan `ls -l` (pelajari juga maksud setiap kolom pada `ls -l`), `less`, `head`, `tail` dan `tail -f` (atau yang lebih baik, `less +F`), `ln` dan `ln -s` (pelajari perbedaan dan keuntungan menggunakan hard dan soft link), `chown`, `chmod`, `du` (untuk penjelasan singkat penggunaan disk: `du -hs *`). Untuk pengelolaan berkas sistem, `df`, `mount`, `fdisk`, `mkfs`, `lsblk`. Pelajari apa itu inode (`ls -i` atau `df -i`). + +- Dasar pengelolaan jaringan: `ip` atau `ifconfig`, `dig`. + +- Pelejari dan gunakan sistem pengelolaan kontrol versi, seperti `git`. + +- Ketahui regular expression (regex) dengan baik, dan beberapa flags untuk `grep`/`egrep`. Flag `-i`, `-o`, `-v`, `-A`, `-B`, dan `-C` bermanfaat untuk dipelajari. + +- Pelajari cara menggunakan `apt-get`, `yum`, `dnf` atau `pacman` (tergantung distro yang digunakan) untuk melakukan instalasi paket. Dan pastikan anda mempunyai `pip` untuk menginstall alat baris perintah berbasis Python (dibawah ini beberapa lebih mudah diinstall menggunakan `pip`). + + +## Penggunaan sehari-hari + +- Dalam Bash, gunakan **Tab** untuk melengkapi secara otomatis suatu perintah atau daftar perintah yang tersedia dan **ctrl-r** untuk mencari riwayat perintah (setelah ditekan, ketikan kata kunci yang ingin dicari, tekan **ctrl-r** untuk berpindah antara perintah-perintah yang sesuai, tekan **Enter** untuk menjalankan perintah, atau menekan tanda panah kanan di keyboard). + +- Dalam Bash, gunakan **ctrl-w** untuk untuk menghapus kata terakhir, dan **ctrl-u** untuk menghapus semua kata mulai dari baris pertama. Gunakan **alt-b** dan **alt-f** untuk memindahkan kata, **ctrl-a** untuk memindahkan kursor kebaris paling depan, **ctrl-e** untuk memindahkan kursor kebaris paling akhir, **ctrl-k** untuk menghentikan bagian akhir dari baris, **ctrl-l** untuk membersihkan layar tampilan. Lihat `man readline` untuk menampilkan semua kombinasi tombol yang ada dalam Bash. Ada cukup bnyak kombinasi. Contohnya **alt-.** berpindah melalui perintah sebelumnya, dan **alt-*** melebarkan glob. + +- Sebagai alternatif, jika anda lebih sendang menggunakan gaya kombinasi `vi`, gunakan `set -o vi` (dan `set -o emacs` untuk mengembalikan kepengaturan awal). + +- Untuk mengelola perintah yang panjang, setelah melakukan pengaturan pengolah teks (sebagai contoh `export EDITOR=vim`), menekan kombinasi **ctrl-x** **ctrl-e** akan membuka perintah saat ini pada pengolah teks untuk melakukan pengelolaah secara langsung. Atau dalam gaya `vi`, **escape-v**. + +- Untuk melihat perintah terakhir yang digunakan, `history`. Tambahkan `!n` dibagian akhir (dimana `n` merupakan jumlah perintah) untuk dijalankan kembali. Terdapat beberapa penyingkatan yang dapat digunakan, diantaranya yang paling sering digunakan `!$` untuk parameter terakhir dan `!!` untuk perintah terakhir (baca "HISTORY EXPANSION" pada halaman manual `man`). Bagaimanapun, sering digantikan dengan kombinasi **ctrl-r** dan **alt-.**. + +- Pindah ke direktori home dengan `cd`. Akses berkas yang berada dibawah direktori home dengan awalan `~` (misalnya `~/.bashrc`). Dalam skrip `sh` direktori home dinyatakan dalam `$HOME`. + +- Untuk kembali ke direktori sebelumnya: `cd -`. + +- Jika dalam menulis perintah anda berubah fikiran, tekan **alt-#** untuk menambahkan `#` pada awal perintah untuk menjadikannya sebuah komentar (atau **ctrl-a**, **#**, **enter**). Selanjutnya anda dapat mengakses perintah tersebuh dikemudian dengan menggunakan `history`. + +- Gunakan `xargs` (atau `parallel`). Sangat bagus. Anda dapat mengontrol berapa banyak item yang dapat dijalankan per-baris (`-L`) atau menjalankannya secara bersamaan (`-P`). Jika anda tidak yakin hal tersebut akan berjalan dengan baik, gunakan `xargs echo` terlebih dahulu. Atau `I{}` juga sangat bermanfaat. Contohnya: +```bash + find . -name '*.py' | xargs grep some_function + cat hosts | xargs -I{} ssh root@{} hostname +``` + +- `pstree -p` dapat membantu menampilkan daftar proses yang sedang berjalan. + +- Gunakan `pgrep` dan `pkill` untuk mencari proses sinyal berdasarkan nama (`-f` juga cukup membantu). + +- Pelajari jenis sinyal yang dapat dikirimkan ke proses. Contoh, untuk menunda sebuah proses, gunakan `kill -STOP [pid]`. Untuk daftar semua sinyal, lihat `man 7 signal`. + +- Gunakan `nohup` atau `disown` untuk membuat proses tetap berjalan selamanya. + +- Lihat kemana sebuah proses terhubung (listening) melalui `netstat -lntp` atau `ss -plat` (untuk TCP, gunakan `-u` untuk UDP). + +- Lihat juga `lsoft` untuk membuka socket dan berkas. + +- Lihat `uptime` atau `w` untuk mengetahui berapa sistem sudah berjalan (aktif). + +- Gunakan `alias` untuk membuat jalan pintas untuk perintah-perintah yang sering digunakan. Misalnya, `alias ll='ls -latr'` akan menghasilkan alias `ll`. + +- Menyimpan alias, pengaturan shell, dan fungsi yang sering digunakan di `~/.bashrc`, dan [atur shell untuk dibaca ketika login](http://superuser.com/a/183980/7106). Hal tersebut akan membuat pengaturan dapat berjalan disemua sesi. + +- Letakkan pengaturan dari variabel sebagai perintah yang akan dijalankan ketika login di `~/.bash_profile`. Pisahkan konfigurasi yang dibutuhkan untuk menjalankan grafik login dan tugas-tugas `cron`. + +- Singkronkan berkas konfigurasi (seperti `.bashrc` dan `.bash_profile`) pada banyak komputer dengan Git. + +- Pahami bahwa dibutuhkan perhatian lebih ketika variabel dan nama berkas mengandung spasi. Batasi variabel Bash dengan tanda petik, misalnya `"$FOO"`. Sebaiknya gunakan opsi `-0` atau `-print0` untuk membuat karakter null dalam membatasi nama berkas, misalnya `locate -0 pattern | xargs -0 ls -al` atau `find / -print0 -type d | xargs -0 ls -al`. Untuk membuat perulangan nama berkas yang mengandung spasi dalam `for`, atur IFS sebagai baris baru dengan `IFS=$'\n'` . + +- Dalam skrip Bash, gunakan `set -x` (atau lainnya `set -v`, yang mana akan menamilkan raw masukan dalam log, termasuk variabel dan komentar) untuk keperluan debugging. Gunakan mode `strict` kecuali ada alasan lebih baik untuk tidak menggunakan `set -e` untuk membatalkan perintah ketika terjadi kesalahan (kode exit tidak 0). Gunakan `set -u` untuk mendeteksi variabel yang belum ditentukan tapi sudah digunakan. Pertimbangkan `set -o pipefail` juga, untuk kesalahan didalam saluran. Untuk skrip terkait, gunakan `trap` pada EXIT atau ERR. Disarankan untuk memulai dari skrip berikut, dimana akan mendeteksi dan membatalkan perintah ketika terjadi kesalahan tertentu kemudian menampilkannya dalam pesan: +```bash + set -euo pipefail + trap "echo 'Kesalahan: Skrip gagal: harap periksa kembali perintah yang anda masukkan'" ERR +``` + +- Dalam skrip Bash, bagian dalam shell (ditulis didalam tanda kurung) merupakan cara terbaik untuk menggabungkan perintah. Sebuah contoh yang sering digunakan adalah berpindah ke direktori kerja yang lain, contohnya: +```bash + # melakukan sesuatu dalam direktori kerja saat ini + (cd /direktori/kerja/lainnya && suatu-perintah) + # melanjutkan pekerjaan dalam direktori yang sebenarnya +``` + +- Dalam Bash, ada banyak jenis dari pengembangan variabel. Memeriksa ketersediaan variabel: `$(nama_variabel:?pesan kesalahan)`. Sebagai contoh, jika skrip membutuhkan sebuah parameter, cukup menulis `berkas_masukan=$(1:?penggunaan: $0 berkas_masukan)`. Contoh dalam aritmatika: `i=$(( (i + 1) % 5 ))`. Urutan: `{1..10}`. Pemangkasan string: `${var%akhiran}` dan `${var#awalan}`. Sebagai contoh jika `var=foo.pdf`, maka `echo ${var%.pdf}.txt` akan menghasilkan `foo.txt`. + +- Kurung kurawal `{`...`}` dapat mengurangi kesalahan dama mengetik teks yang sama dan membuat kombinasi dari banyak item secara otomatis. Ini sangat membantu misalnya dalam perintah `mv foo.{txt,pdf} suatu-direktori` (memindahkan kedua berkas sekaligus), `cp suatuberkas{,.bak}` (memiliki makna sama dengan `cp suatuberkas suatuberkas.bak`) atau `mkdir -p test-{a,b,c}/subtest-{1,2,3}` (memiliki makna membuat semua kemungkinan kombinasi untuk struktur direktori). + +- Keluaran dari perintah dapat diperlakukan sebagai sebuah berkas dengan `<(suatu perintah)`. Misalnya, membandingkan `/etc/hosts` yang ada pada lokal dengan server: +```sh + diff /etc/hosts <(ssh suatuserver cat /etc/hosts) +``` + +- Ketika menulis skrip disarankan untuk membatasi semua kode dalam kurung kurawal. Jika penutuh kurung kurawal tidak ditemukan, skrip tidak dapat dijalankan karena terjadi kesalahan. Hal ini biasanya terjadi ketika mengunduh skrip dari web, kemungkinan beberapa bagian dari skrip yang telah diunduh sengaja ditulis untuk menghindari eksekusi: +```bash +{ + # Kode disini +} +``` + +- Ketahui tentang "here documents" dalam Bash dengan `cat < berkaslog 2>&1` atau `suatu-perintah &>berkaslog`. Biasanya, untuk memastikan suatu perintah tidak meninggalkan berkas tetap terbuka setelah menerima masukan, coba pada terminal anda saat ini, merupakan hal baik untuk menambahkan `>> 2+3 +5 +``` + +## Mengolah berkas dan data + +- Untuk menemukan berkas berdasarkan nama dalam direktori saat ini, `find . -iname '*sesuatu*'` (atau yang mirip). Untuk mencari berkas dibanyak tempat berdasarkan nama, gunakan `locate sesuatu` (tapi ingat `updatedb` mungkin belum menyimpan berkas terbaru yang dibuat). + +- Untuk pencarian umum berdasarkan isi berkas (lebih dalam dibandingkan dengan `grep -r`), gunakan [`ag`](https://github.com/ggreer/the_silver_searcher). + +- Untuk mengkonversi HTML menjadi teks: `lynx -dump -stdin` + +- Untuk Markdown, HTML, dan semua jenis konversi dokumen, coba [`pandoc`](http://pandoc.org/). + +- Jika anda mengelola XML, `xmlstarlet` adalah pilihan yang paling tua namun terbaik. + +- Untuk JSON, gunakan [`jq`](http://stedolan.github.io/jq/). + +- Untuk YAML, gunakan [`shyaml`](https://github.com/0k/shyaml). + +- Untuk Excel atau berkas CSV, [csvkit](https://github.com/onyxfish/csvkit) menyediakan `in2csv`, `csvcut`, `csvjoin`, `csvgrep`, dan lain sebagainya. + +- Untuk Amazon S3, [`s3cmd`](https://github.com/s3tools/s3cmd) lebih nyaman digunakan dan [`s4cmd`](https://github.com/bloomreach/s4cmd) lebih cepat. Amazon [`aws`](https://github.com/aws/aws-cli) dan yang telah dikembangkan [`saws`](https://github.com/donnemartin/saws) tetap penting untuk pekerjaan yang berhubungan dengan AWS lainnya. + +- Ketahui tentang `sort` dan `uniq`, termasuk opsi `-u` dan `-d` -- lihat Perintah satu baris dibawah. Lihat juga `comm`. + +- Ketahui tentang `cut`, `paste`, dan `join` dalam memanipulasi teks pada berkas. Banyak orang menggunakan `cut` tapi melupakan tentang `join`. + +- Ketahui tentang `wc` untuk menghitung jumlah baris (`-l`), karakter (`-m`), kata (`-w`) dan byte (`-c`). + +- Ketahui tentang `tee` untuk menyalin dari stdin sebuah berkas ke stdout, seperti dalam `ls -al | tee file.txt`. + +- Untuk kalkulasi yang cukup kompleks, termasuk pengelompokan, konversi nilai, dan statistik, pertimbangkan untuk menggunakan [`datamash`](https://www.gnu.org/software/datamash/). + +- Ketahui bahwa locale cukup berdampak pada banyak perintah, termasuk pengurutan (pemeriksaan) dan dan kinerja. Kebanyakan distribusi Linux akan menggunakan `LANG` atau variabel locale lainnya untuk melakukan pengaturan bahasa seperti ID Indonesia. Tapi waspada karena pengurutan akan berubah jika locale juga telah dirubah. Dan ketahui aktifitas i18n dapat membuat banyak perintah *seringkali* menjadi lambat. Dalam kondisi tertentu (seperti beberapa perintah operasi dibawah) anda dapat menghindari i18n dan menggunakan pengurutan tradisional, gunakan `export LC_ALL=C`. + +- Anda dapat menentukan perintah tertentu dengan memberikan awalan saat pemanggilan dengan variabel pengaturan, seperti `TZ=Pacific/Fiji date`. + +- Ketahui mengenai dasar `awk` dan `sed` untuk manipulasi data. Sebagai contoh, menjumlahkan semua nomor yang ada pada kolom ketiga dari sebuah berkas: `awk '{ x += $3 } END { print x }'`. Ini memungkinkan komputasi 3x lebih cepat dan 3x lebih singkat dibandingkan dengan persamaan Python. + +- Untuk mengganti semua string yang cocok, dalam satu atau lebih dari satu berkas: +```sh + perl -pi.bak -e 's/string-lama/string-baru/g' my-files-*.txt +``` + +- Untuk mengganti nama banyak berkas atau mencari dan/atau mengganti dalam berkas, coba [`repren`](https://github.com/jlevy/repren). (Dalam beberapa kasus perintah `rename` memungkinkan untuk mengganti banyak nama sekaligus, namun perlu berhati-hati karena fungsionalitas mungkin tidak akan sama pada distribusi Linux lainnya.) +```sh + # Mengganti nama berkas, direktori, dan isi berkas secara penuh dari foo --> bar: + repren --full --preserve-case --from foo --to bar . + # Mengembalikan backup berkas whatever.bak -> whatever: + repren --renames --from '(.*)\.bak' --to '\1' *.bak + # Sama seperti diatas, menggunakan rename, jika ada yang cocok: + rename 's/\.bak$//' *.bak +``` + +- Sesuai dengan yang ada pada halaman manual, `rsync` adalah perintah untuk menyalin berkas yang cukup cepat dan memiliki banyak fitur. Mampu melakukan singkronisasi antar host yang mana sangat berguna untuk host lokal. Jika keamanan tidak diutamakan, gunakan `rsync` daripada `scp` untuk pemulihan tanpa harus mengulang dari awal. Perintah tersebut merupakan [cara tercepat](https://web.archive.org/web/20130929001850/http://linuxnote.net/jianingy/en/linux/a-fast-way-to-remove-huge-number-of-files.html) untuk menghapus banyak berkas sekaligus: +```sh +mkdir empty && rsync -r --delete empty/ some-dir && rmdir some-dir +``` + +- Gunakan `shuf` untuk mengacak atau memilih baris secara acak dalam sebuah berkas. + +- Ketahui perintah `sort`. Untuk angka, funakan opsi `-n`, atau `-h` untuk menampilkan angka yang mudah dibaca manusia (contoh `du -h`). Ketahui bagaimana cara kerja kunci (`-t` dan `-k`). Terkadang membutuhkan `k1,1` untuk mengurutkan kolom pertama saja; `k1` berarti mengurutkan semua barus. Pengurutan yang stabil (`sort -s`) juga cukup berguna. FContoh, untuk mengurutkan yang pertama berdasarkan kolom 2, yang kedua berdasarkan kolom 1, akan menjadi `soft -k1,1 | sort -s -k2m2`. + +- Jika perlu untuk membuat tab pada terminal dalam Bash (misalnya argumen `-t` untuk mengurutkan), tekan **ctrl-v** **[Tab]** atau dengan menulis `$'\t'` (menulis langsung lebih baik dari copy/paste). + +- Alat yang umum digunakan untuk menambal sumber kode adalah `diff` dan `patch`. Lihat juga `diffstat` untuk hasil berupa statistik dari `diff` dan `sdiff`. Ingat bahwa `diff -r` berlaku pada semua direktori. Gunakan `diff -r tree1 tree2 | diffstat` untuk ringkasan perubahan. Gunakan `vimdiff` untuk membandingkan dan memperbarui berkas. + +- Untuk berkas binari, gunakan `hd`, `hexdump` atau `xxd` untuk menampilkan kode hex yang sederhana dan `bvi` atau `blew` untuk memperbarui berkas biner. + +- Alat lainnya untuk berkas biner, `strings` (dikombinasikan dengan `grep`, dan lainnya) memungkinkan pencarian teks berdasarkan bit-bit. + +- Untuk membandingkan berkas biner (kompresi delta), gunakan `xdelta3`. + +- Untuk mengkonversi sandi penulisan teks, coba `iconv`. Atau `uconv` untuk penggunaan lebih lanjut; telah mendukung hal yang berkaitan dengan Unicode. Sebagai contoh, perintah berikut membuat tulisan kecil dan menghapus semua aksen (dengan mengembangkan atau menghapusnya). +```sh + uconv -f utf-8 -t utf-8 -x '::Any-Lower; ::Any-NFD; [:Nonspacing Mark:] >; ::Any-NFC; ' < input.txt > output.txt +``` +- Untuk memecah berkas menjadi beberapa bagian, lihat `split` (memisahkan berdasarkan ukuran) dan `csplit` (memisahkan berdasarkan pola). + +- Untuk memanipulasi tanggal dan waktu, gunakan `dateadd`, `datediff`, `strptime` etc. dari [`dateutils`](http://www.fresse.org/dateutils/). + +- Gunakan `zless`, `zmore`, `zcat`, dan `zgrep` untuk digunakan pada berkas yang terkompres. + +- Atribut dari sebuah berkas dapat diset melalui `chattr` dan disediakan alternatif untuk level terendah pada hak akses berkas. Sebagai contoh, untuk melindungi ketidak sengajaan pada penghapusan berkas gunakan flag kebal: `sudo chattr +i /direktori/berkas/penting` + +- Gunakan `getfacl` dan `setfacl` untuk menyimpan dan mengembalikan hak akses pada suatu berkas. Contohnya: +```sh + getfacl -R /suatu/path > hakakses.txt + setfacl --restore=hakakses.txt +``` + +## Analisa sistem + +- Untuk analisa web, `curl` dan `curl -I` cukup berguna, atau yang sama lainnya seperti `wget`, atau yang lebih modern [`httpie`](https://github.com/jkbrzt/httpie). + +- Untuk mengetahui status CPU/penyimpanan, perintah klasik `top` (lebih baik lagi `htop`), `iostat`, dan `iotop`. Gunakan `iostat -mxz 15` untuk melihat detil CPU tiap bagian (partition) penyimpanan dan pengetahuan tentang kinerja. + +- Untuk detail koneksi jaringan, gunakan `netstat` dan `ss`. + +- Untuk melihat sekilas yang terjadi pada sistem, `dstat` cukup berguna. Untuk detil secara menyeluruh, gunakan [`glances`](https://github.com/nicolargo/glances). + +- Untuk status memory, jalankan dan perhatikan keluaran dari `free` dan `vmstat`. Dalam kondisi tertentu, hati-hati terhadap "cached" yang dihasilkann oleh kernel Linux, jadi perhatikan sebaik mungkin keluaran dari `free`. + +- Analisa sistem Java sedikit berbeda, tapi ada trik sederhana untuk JVM dari Oracle dan yang lainnya yakni dapat dijalankan perintah `kill -3 ` dan penelusuran (full stack trace) dan beberapa ringkasan utama (termasuk informasi pembangkitan sampah sistem, informasi yang sangat berguna) akan dikeluarkan melalui stderr/logs. JDK seperti `jps`, `jstat`, jstack`, `jmap` cukup berguna. [Perlengkapan SJK](https://github.com/aragozin/jvm-tools) untuk penggunaan lebih lanjut. + +- Gunakan [`mtr`](http://www.bitwizard.nl/mtr/) sebagai pilihan terbaik `traceroute`, untuk menelusuri masalah jaringan. + +- Untuk mengungkapkan kenapa penyimpanan penuh, perintah [`ncdu`](https://dev.yorhel.nl/ncdu) lebih menghemat waktu dibangdingkan `du -sh *`. + +- Untuk mencari socket atau process yang sedang menggunakan bandwidth, coba [`iftop`](http://www.ex-parrot.com/~pdw/iftop/) atau [`nethogs`](https://github.com/raboof/nethogs). + +- Perintah `ab` (paket dari Apache) sangat berguna untuk melihat kinerja dari server web. Untuk test lebih lanjut, gunakan `siege`. + +- Untuk analisa jaringan yang lebih serius, [`wireshark`](https://wireshark.org/), [`tshark`](https://www.wireshark.org/docs/wsug_html_chunked/AppToolstshark.html), atau [`ngrep`](http://ngrep.sourceforge.net/). + +- Ketahui tentang `strace` dan `ltrace`. Perintah tersebut membantu ketika sebuah program gagal, hang, atau crash secara tiba-tiba, atau jika ingin mengetahui kinerja aplikasi secara umum. Catatan gunakan opsi profiling (`-c`), dan kemampuan untuk menertakan proses yang sedang berjalan (`-p`). + +- Ketahui tentang `ldd` untuk memeriksa pustaka berbagi dan sebagainya. + +- Ketahui bagaimana cara terhubung dengan proses yang sedang berjalan dengan `gdb` dan periksa alur stack-nya. + +- Gunakan `/proc` untuk melakukan analisis permasalahan secara live. Contohnya: `/proc/cpuinfo`, `/proc/meminfo`, `/proc/cmdline`, `/proc/xxx/cwd`, `/proc/xxx/exe`, `/proc/xxx/fd/`, `/proc/xxx/smaps` (dimana `xxx` adalah ID proses id atau pid). + +- Untuk mengetahui kesalahan yang terjadi pada proses analisa sebelumnya, gunakan [`sar`](http://sebastien.godard.pagesperso-orange.fr/). Perintah tersebut dapat menampilkan riwayat statistik pada CPU, memory, jaringan, dan lain sebagainya. + +- Untuk analisa kinerja sistem lebih mendalam, periksa `stap` ([SystemTap](https://sourceware.org/systemtap/wiki)), [`perf`](https://en.wikipedia.org/wiki/Perf_(Linux)), dan [`sysdig`](https://github.com/draios/sysdig). + +- Periksa Sistem Operasi yang digunakan dengan `uname` atau `uname -a` (Unix/kernel pada umumnya) atau `lsb_release -a` (distro linux). + +- Gunakan `dmesg` ketika terjadi sesuatu yang tidak disangka (mungkin masalah perangkat kerasa atau driver). + +- Jika anda menghapus sebuah berkas dan tidak dapat meningkatkan kapasitas media penyimpanan sebagaimana hasil pengecekan `du`, periksa kemungkinan berkas tersebut sedang digunakan oleh suatu proses: +`lsof | grep deleted | grep "berkas-yang-sangat-besar"` + + +## Perintah satu baris + +Beberapa contoh untuk menggabungkan perintah sekaligus: + +- Terkadang cukup membantu ketika ingin mencari kesamaan, kesatuan, dan perbedaan dari beberapa berkas melalui `sort`/`uniq`. Misalkan `a` dan `b` adalah berkas yang berbeda. Perintah ini cukup cepat, dan dapat bekerja pada berkas dengan ukuran sampai gigabyte. (Pengurutan tidak dibatasi oleh memory, tapi diperlukan opsi `-T` jika `/tmp` berada dalam partisi root yang kecil.) Lihat juga catatan tentang `LC_ALL` diatas dan opsi yang terdapat pada `sort` (penjelasan lebih jelas dibawah berikut). +```sh + cat a b | sort | uniq > c # c berisi kesatuan antara a dan b + cat a b | sort | uniq -d > c # c berisi persamaan antara a dan b + cat a b b | sort | uniq -u > c # c berisi perbedaan antara a dan b +``` + +- Gunakan `grep . *` untuk menguji isi dari semua berkas dalam sebuah direktori (hasil tiap berisnya berkaitan dengan nama berkas), atau `head -180 *` (setiap berkas memiliki informasi kepala). Hal ini sangat bermanfaat untuk direktori yang berisi berkas konfigurasi seperti `/sys`, `/proc`, `/etc`. + +- Untuk menjumlahkan semua nomor pada kolom ketiga dari sebuah berkas (memungkinkan proses 3x lebih cepat dan skrip 3x lebih pendek dari Python): +```sh + awk '{ x += $3 } END { print x }' suatuberkas +``` + +- Untuk melihat ukuran atau tanggal berkas dalam bentuk struktur pohon, mirip dengan rekursif `ls -l` namun lebih mudah untuk dibaca dari `ls -lR`: +```sh + find . -type f -ls +``` + +- Ketika terdapat sebuah berkas teks seperti log web server, dan nilai tertentu muncul pada beberapa baris, misalnya parameter `acct_id` yang terdapat pada URL. Jika ingin mengetahui berapa banyak akses `acct_id`: +```sh + cat access.log | egrep -o 'acct_id=[0-9]+' | cut -d= -f2 | sort | uniq -c | sort -rn +``` + +- Untuk memantau perubahan secara terus menerus, gunakan `watch`, misalnya perubahan berkas pada sebuah direktori, gunakan `watch -d -n 2 'ls -rtlh | tail` atau pada pengaturan jaringan wifi ketika melakukan perbaikan dengan `watch -d -n 2 ifconfig`. + +- Jalankan fungsi berikut untuk mendapatkan sesuatu yang acak dari dokumen ini (mengolah Markdown dan mengeluarkan sebuah item): +```sh + function taocl() { + curl -s https://raw.githubusercontent.com/jlevy/the-art-of-command-line/master/README.md | + pandoc -f markdown -t html | + xmlstarlet fo --html --dropdtd | + xmlstarlet sel -t -v "(html/body/ul/li[count(p)>0])[$RANDOM mod last()+1]" | + xmlstarlet unesc | fmt -80 + } +``` + +## Tidak penting tapi bermanfaat + +- `expr` : melakukan perhitungan aritmatika atau mengevaluasi regular expression (regex) + +- `m4` : pemroses macro yang sederhana + +- `yes` : menampilkan cukup banyak string + +- `cal` : menampilkan kalender + +- `env` : menjalankan sebuah perintah (berguna dalam skrip) + +- `printenv` : menampilkan variabel environment (berguna dalam analisa dan skrip) + +- `look` : mencari kata dalam bahasa English (atau baris dalam sebuah berkas) diawali dengan sebuah string + +- `cut`, `paste` dan `join`: manipulasi data + +- `fmt`: teks dengan format paragraf + +- `pr`: teks dengan format halaman/kolom + +- `fold`: membatasi baris dari teks + +- `column`: membuat format teks jadi rata, lebar kolom tertentu atau bentuk tabel + +- `expand` dan `unexpand`: konversi antara tab dan spasi + +- `nl`: menambahkan baris baru + +- `seq`: menampilkan angka + +- `bc`: kalkulator + +- `factor`: angka faktorial + +- [`gpg`](https://gnupg.org/): mengenkripsi dan menandatangani berkas + +- `toe`: isi dari tabel terminfo + +- `nc`: analisa jaringan dan aktifitas datanya + +- `socat`: jalur tunda dan penerus jalur tcp (mirip dengan `netcat`) + +- [`slurm`](https://github.com/mattthias/slurm): visualisasi aktifitas jaringan + +- `dd`: memindahkan data antar berkas atau perangkat + +- `file`: identifikasi jenis dari berkas + +- `tree`: menampilkan struktur pohon dari direktori dan subdirektori secara bersarang; mirip `ls` namun dapat rekursif + +- `stat`: informasi berkas + +- `time`: menjadwalkan dan menjalankan sebuah perintah + +- `timeout`: menjalankan sebuah perintah dalam waktu yang telah ditentukan dan melanjutkan kembali dalam waktu yang telah ditentukan pula. + +- `lockfile`: membuat berkas dengan tanda hanya dapat dihapus oleh `rm -f` + +- `logrotate`: menggulirkan, mengkompres serta mengirimkan via email berkas logs + +- `watch`: menjalankan program secara berulang, menampilkan hasil dan/atau memfokuskan pada perubahan + +- `tac`: menmapilkan kebalikan dari berkas + +- `shuf`: memilih baris secara acak dari sebuah berkas + +- `comm`: membandingkan berkas yang terurut berdasarkan baris + +- `pv`: memantau perkembangan data yang melalui sebuah saluran + +- `hd`, `hexdump`, `xxd`, `biew` dan `bvi`: menampilkan atau memperbaiki berkas dalam biner + +- `strings`: mengeluarkan teks dari berkas biner + +- `tr`: konversi atau menipulasi sebuah karakter + +- `iconv` atau `uconv`: konversi kode teks + +- `split` dan `csplit`: membagi berkas + +- `sponge`: membaca semua masukan sebelum menuliskannya, berguna untuk membaca dan menulis pada berkas yang sama, misalnya `grep -v sesuatu nama-berkas | sponge nama-berkas` + +- `units`: konversi dan kalkulasi unit; mengkonversi jarak mil per dua minggu (lihat juga `/usr/share/units/definitions.units`) + +- `apg`: membangkitkan kata kunci acak + +- `xz`: kompresi berkas dengan rasio yang tinggi + +- `ldd`: informasi dynamic library + +- `nm`: simbil dari objek berkas + +- `ab`: patokan untuk web server + +- `strace`: analisa sistem pemanggilan + +- [`mtr`](http://www.bitwizard.nl/mtr/): traceroute yang lebih baik untuk analisa jaringan + +- `cssh`: visual shell dalam jumlah banyak secara bersamaan + +- `rsync`: singkronisasi berkas dan direktori melalui SSH atau berkas sistem dalam satu mesin + +- [`wireshark`](https://wireshark.org/) dan [`tshark`](https://www.wireshark.org/docs/wsug_html_chunked/AppToolstshark.html): penangkap paket dan analisa jaringan + +- [`ngrep`](http://ngrep.sourceforge.net/): grep untuk jaringan + +- `host` dan `dig`: pencarian DNS + +- `lsof`: deskripsi berkas process dan informasi socket + +- `dstat`: berguna untuk statistik sistem + +- [`glances`](https://github.com/nicolargo/glances): tingkat tinggi, informasi singkat banyak subsistem + +- `iostat`: statistik penggunaan penyimpanan + +- `mpstat`: statistik penggunaan CPU + +- `vmstat`: statistik penggunaan memory + +- `htop`: versi terbaru dari top + +- `last`: riwayat login + +- `w`: melihat siapa yang sedang login + +- `id`: informasi identitas pengguna atau grup + +- [`sar`](http://sebastien.godard.pagesperso-orange.fr/): riwayat statistik sistem + +- [`iftop`](http://www.ex-parrot.com/~pdw/iftop/) or [`nethogs`](https://github.com/raboof/nethogs): penggunaan jaringan berdasarkan socket atau process + +- `ss`: statistik socket + +- `dmesg`: pesan ketika boot dan sistem error + +- `sysctl`: melihat dan mengkonfigurasi parameter kernel Linux saat sedang berjalan + +- `hdparm`: manipulasi atau melihat kinerja media SATA/ATA + +- `lsblk`: daftar blok perangkat: berbentuk struktur pohon yang berisi media penyimpanan beserta partisinya + +- `lshw`, `lscpu`, `lspci`, `lsusb`, `dmidecode`: informasi perangkat keras, termasuk CPU, BIOS, RAID, grafis, dan lain sebagainya. + +- `lsmod` and `modinfo`: menampilkan daftar dan detil modul kernel + +- `fortune`, `ddate`, dan `sl`: tergantung bagaimana anda menyebutnya "bermanfaat" + + +## Khusus OS X + +Berikut ini *hanya* berlaku pada OS X. + +- Manajemen paket menggunakan `brew` (homebrew) dan/atau `port` (MacPorts). Dapat digunakan untuk memasang banyak aplikasi OS X untuk menggunakan perintah-perintah diatas. + +- Salin keluaran dari perintah ke aplikasi desktop menggunakan `pbcopy` dan tempel menggunakan `pbpaste`. + +- Untuk mengaktifkan tombol Option pada aplikasi Terminal OS X sebagai tombol alt (seperti menggunakan perintah diatas **alt-b**, **alt-f**, dan lain sebagainya), buka Preferences -> Profiles -> Keyboard dan pilih "Use Option as Meta key". + +- Untuk membuka berkas pada aplikasi desktop, gunakan `open` atau `open -a /Applications/namaaplikasi.app`. + +- Spotlight: Mencari berkas dengan `mdfind` dan menampilkan metadata (seperti info EXIF foto) dengan `mdls`. + +- Berhati-hati karena OS X berbasis pada BSD Unix, dan banyak perintah (seperti `ps`, `ls`, `tail`, `awk`, `sed`) beberapa memiliki varian yang berbeda dengan Linux, yang mana akan berdampak besar pada System V-style Unix dan peralatan GNU lainnya. Perbedaannya dapat diketahui dengan mencari pada halaman manual "BSD General Command Manual". Pada beberapa kasus versi GNU dapat dipasang juga (seperti `gawk` dan `gsed` untuk GNU awk dan sed). Ketika menulis skrip Bash lintas platform, hundari beberapa perintah (seperti mempertimbangkan Python atau `perl`) atau coba kembali dengan hati-hati. + +- Untuk mendapatkan informasi rilis OS X, gunakan `sw_vers`. + +## Hanya Windows + +Berikut ini *hanya* berlaku pada Windows. + +- Pada Windows 10, anda dapat menggunakan [Bash di Ubuntu pada Windows](https://msdn.microsoft.com/commandline/wsl/about), dimana menyediakan lingkungan Bash yang mirip dengan perintah baris pada lingkungan Unix. Sebagai tambahan, memungkinkan program Linux untuk berjalan pada Windows. Namun disisi lain tidak memungkinkan untuk menjalankan aplikasi windows melalui jendela Bash. + +- Akses fasilitas dari Shell Unix pada Microsoft Windows dengan memasang [Cygwin](https://cygwin.com/). Banyak hal telah dijelaskan pada dokumen ini akan bekerja secara normal. + +- Pasang program Unix tambahan dengan paket manajer Cygwin. + +- Gunakan `mintty` sebagai aplikasi perintah baris. + +- Akses clipboard pada Windows pada `/dev/clipboard`. + +- Gunakan `cygstart` untuk membuka berkas melalui aplikasi yang telah terdaftar. + +- Akses registry pada Windows dengan `regtool`. + +- Ingat bahwa `C:\` Windows akan menjadi `/cygdrive/c` pada Cygwin, dan `/` pada Cygwin akan berada di `C:\cygwin` pada Windows. Konversi antara Cygwin dan gaya Windows file path dengan `cygpath`. Hal ini berguna dalam skrip yang menjalankan program Windows. + +- Anda dapat menjalankan skrip sistem administrasi pada Windows dari perintah baris dengan mempelajari dan menggunakan `wmic`. + +- Pilihan lainnya untuk membuat mendapatkan Unix pada Windows adalah [Cash](https://github.com/dthree/cash). Sebagai catatan bahwa hanya tersedia beberapa fasilitas perintah baris Unix yang tersedia dalam lingkungan ini. + +- Sebagai pilihan alternatif untuk mendapatkan alat pengembangan dalam GNU (seperti GCC) pada Windows adalah [MinGW](http://www.mingw.org/) dan paketnya [MSYS](http://www.mingw.org/wiki/msys), dimana menyediakan beberapa fasilitas seperti bash, gawk, make dan grep. MSYS tidak sepenuhnya memiliki semua fasilitas jika dibandingkan dengan Cygwin. Cygwin biasanya berguna untuk membuat port Windows dari Unix. + +## Bacaan lebih lanjut + +- [awesome-shell](https://github.com/alebcay/awesome-shell): Daftar alat dan sumber Shell lainnya. +- [awesome-osx-command-line](https://github.com/herrbischoff/awesome-osx-command-line): Penjelasan lebih dalam perintah baris pada OS X. +- [Strict mode](http://redsymbol.net/articles/unofficial-bash-strict-mode/) untuk menulis skrip Shell yang lebih baik. +- [shellcheck](https://github.com/koalaman/shellcheck): Analisis Shell skrip. Pada dasarnya, lint untuk bash/sh/zsh. +- [Filenames and Pathnames in Shell](http://www.dwheeler.com/essays/filenames-in-shell.html): Cara menangani nama berkas yang baik dan benar pada skrip Shell. +- [Data Science at the Command Line](http://datascienceatthecommandline.com/#tools): Perintah dan alat yang berguna untuk mengolah data sains, dari buku dengan nama yang sama. + +## Penyangkalan + +Dengan pengecualian dari tugas yang sangat kecil, kode ditulis sehingga orang lain dapat membacanya. Dengan kekuatan datang tanggung jawab. Bahkan Anda * dapat * melakukan sesuatu di Bash tidak berarti Anda harus! ;) +Dengan beberapa pengecualian, sebuah kode ditulis sehingga orang lain dapat membacanya. Dengan adanya kekuatan datang pula tanggung jawab. Faktanya anda *dapat* melakukan hal yang tidak seharusnya dalam Bash! ;) + + +## Lisensi + +[![Creative Commons License](https://i.creativecommons.org/l/by-sa/4.0/88x31.png)](http://creativecommons.org/licenses/by-sa/4.0/) + +Hasil kerja ini memiliki lisensi dibatah [Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/). diff --git a/README-it.md b/README-it.md index 40b650f..066f7be 100644 --- a/README-it.md +++ b/README-it.md @@ -1,5 +1,5 @@ 🌍 -*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* +*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Indonesia](README-id.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Română](README-ro.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* # The Art of Command Line (Traduzione Italiana) diff --git a/README-ja.md b/README-ja.md index dda5fd3..c3aaca4 100644 --- a/README-ja.md +++ b/README-ja.md @@ -1,7 +1,5 @@ 🌍 -*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* - -原文のコミット [ee4b00bc396087d27231f60512aeb77b19ce734e](https://github.com/jlevy/the-art-of-command-line/blob/ee4b00bc396087d27231f60512aeb77b19ce734e/README.md) +*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Indonesia](README-id.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Română](README-ro.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* # The Art of Command Line diff --git a/README-ko.md b/README-ko.md index 992233a..6930f94 100644 --- a/README-ko.md +++ b/README-ko.md @@ -1,5 +1,5 @@ 🌍 -*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* +*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Indonesia](README-id.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Română](README-ro.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* # The Art of Command Line diff --git a/README-pt.md b/README-pt.md index 3df275e..18a05c2 100644 --- a/README-pt.md +++ b/README-pt.md @@ -1,5 +1,5 @@ 🌍 -*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* +*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Indonesia](README-id.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Română](README-ro.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* # A arte da linha de comando diff --git a/README-ro.md b/README-ro.md new file mode 100644 index 0000000..aaa6277 --- /dev/null +++ b/README-ro.md @@ -0,0 +1,596 @@ +🌍 +*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Indonesia](README-id.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Română](README-ro.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* + + +# Arta liniei de comandă + +[![Pune o întrebare](https://img.shields.io/badge/%3f-Ask%20a%20Question-ff69b4.svg)](https://airtable.com/shrzMhx00YiIVAWJg) + +[![Alătură-te discuției https://gitter.im/jlevy/the-art-of-command-line](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jlevy/the-art-of-command-line?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + + +- [Meta](#meta) +- [Bazele](#bazele) +- [Folosire zilnică](#folosire-zilnică) +- [Procesarea fișierelor și a datelor](#procesarea-fișierelor-și-a-datelor) +- [Depanarea sistemului](#depanarea-sistemului) +- [Comenzi de o linie](#comenzi-de-o-linie) +- [Obscure dar utile](#obscure-dar-utile) +- [Doar pentru OS X](#doar-pentru-os-x) +- [Doar pentru Windows](#doar-pentru-windows) +- [Mai multe resurse](#mai-multe-resurse) +- [Anunț legal](#anunț-legal) + + +![curl -s 'https://raw.githubusercontent.com/jlevy/the-art-of-command-line/master/README.md' | egrep -o '`\w+`' | tr -d '`' | cowsay -W50](cowsay.png) + +A folosi linia de comandă în mod eficient este o abilitate ignorată și/sau considerată obscură, dar ajută la creșterea flexibilității și productivității ca inginer. Acest ghid reprezintă o selecție de note și sfaturi pe care le-am găsit utile lucrului în Linux. Unele sfaturi sunt elementare, altele sunt foarte specifice, sofisticate sau obscure. Pagina nu este foarte lungă, dar dacă memorați și folosiți lucrurile de aici atunci știți o cantitate semnificativă de informație. + +Această muncă este rezultatul eforturilor [multor autori și translatori](AUTHORS.md). +Multe dintre aceste sfaturi +[au apărut](http://www.quora.com/What-are-some-lesser-known-but-useful-Unix-commands) +[original](http://www.quora.com/What-are-the-most-useful-Swiss-army-knife-one-liners-on-Unix) +pe [Quora](http://www.quora.com/What-are-some-time-saving-tips-that-every-Linux-user-should-know), +și au fost mutate pe GitHub ulterior, unde alți oameni talentați au produs numeroase îmbunătățiri. +[**Vă rugăm întrebați**](https://airtable.com/shrzMhx00YiIVAWJg) dacă aveți nelămuriri legate de linia de comandă. [**Contribuiți**](/CONTRIBUTING.md) dacă identificați o eroare sau ceva ce ar putea fi îmbunătățit! + +## Meta + +Scop: + +- Acest ghid este atât pentru începători cât și pentru avansați. Scopurile sunt *acoperire* (tot ce este important), *specificitate* (oferirea exemplelor concrete pentru cazurilor comune) și *brevitate* (neincluderea lucrurilor neesențiale sau a digresiunilor ce pot fi găsite ușor în alte părți). Fiecare sfat este esențial în câteva situații sau reduce semnificativ timpul necesar efectuării unei cerințe comparativ cu celelalte alternative. +- Ghidul este scris pentru Linux, cu excepția secțiunilor "[Doar pentru OS X](#doar-pentru-os-x)" și "[Doar pentru Windows](#doar-pentru-windows)". Majoritatea sfaturilor din celelalte secțiuni se aplică/pot fi instalate pe alte sisteme Unix sau OS X (chiar și în Cygwin). +- Se pune accent pe Bash interactiv, chiar dacă unele sfaturi sunt aplicabile și altor shell-uri sau pentru Bash-scripting în general. +- Atât comenzile Unix "standard" cât și cele care necesită instalarea de pachete speciale sunt incluse -- cât timp sfaturile sunt destul de importante cât să merite incluziunea. + +Note: + +- Pentru a păstra totul într-o singură pagină, conținutul este inclus implicit doar prin referințe. Suntem siguri că puteți căuta mai multe detalii după ce aveți ideea/comanda după care să căutați. Folosiți `apt-get`, `yum`, `dnf`, `pacman`, `pip` sau `brew` (după caz) pentru a instala programe noi. +- Folosiți [Explainshell](http://explainshell.com/) pentru a obține explicații utile despre ce fac anumite comenzi, opțiuni, etc. + + +## Bazele + +- Învățați folosirea de bază a Bash. De fapt, tastați `man bash` și treceți măcar pe diagonală prin tot conținutul; este ușor de citit și nu este prea lung. Shell-uri alternative pot fi frumoase, dar Bash este puternic și disponibil mereu (a învăța *doar* zsh, etc., chiar dacă e tentant pe laptopul propriu, vă restricționează în anumite situații, cum ar fi în folosirea unor servere existente). + +- Învățați cel puțin un editor de text. Ideal Vim (`vi`), cum nu există un competitor real pentru editarea în terminal (chiar dacă folosiți Emacs, sau un editor modern în majoritatea timpului). + +- Învățați să citiți documentație cu `man` (pentru curioși, `man man` listează secțiunile, de exemplu 1 este pentru comenzi "uzuale", 5 este pentru fișiere/convenții și 8 pentru administrare). Găsiți pagini de manual cu `apropos`. Rețineți că anumite comenzi nu sunt programe executabile ci comenzi interne în Bash și că puteți obține ajutor despre ele cu `help` sau `help -d`. Puteți vedea dacă o comandă este internă, executabilă sau doar un alias prin folosirea `type command`. + +- Învățați despre redirecționarea intrării și ieșirii folosind `>` și `<` și pipe-uri cu `|`. Rețineți că `>` suprascrie fișierul și `>>` adaugă la final. Învățați despre ieșirea standard și ieșirea de eroare standard. + +- Învățați despre expandarea numelor de fișiere cu `*` (și poate `?` și `[`...`]`) și despre folosirea și diferențele dintre `"` și `'`. (Vedeți mai multe în secțiunea despre expandarea variabilelor mai jos). + +- Familiarizați-vă cu managementul job-urilor în Bash: `&`, **ctrl-z**, **ctrl-c**, `jobs`, `fg`, `bg`, `kill`, etc. + +- Învățați `ssh`, și bazele autentificării fără parolă, via `ssh-agent`, `ssh-add`, etc. + +- Managementul de bază al fișierelor: `ls` și `ls -l` (în special, învățați ce reprezintă fiecare coloană din `ls -l`), `less`, `head`, `tail` și `tail -f` (sau, mai bine, `less +F`), `ln` și `ln -s` (aprofundați diferențele și avantajele între link-urile hard și cele soft), `chown`, `chmod`, `du` (scurt sumar de folosire: `du -hs *`). Pentru managementul sistemului de fișiere: `df`, `mount`, `fdisk`, `mkfs`, `lsblk`. Învățați ce este un inode (`ls -i` sau `df -i`). + +- Concepte de bază de rețea: `ip` sau `ifconfig`, `dig`. + +- Învățați și folosiți un sistem de versionare, precum `git`. + +- Învățați expresii regulare foarte bine, precum și diversele opțiuni pentru `grep`/`egrep`. Relevante sunt `-i`, `-o`, `-v`, `-A`, `-B`, și `-C`. + +- Învățați să folosiți `apt-get`, `yum`, `dnf` sau `pacman` (în funcție de distribuție) pentru a găsi și instala pachete. Fiți siguri că aveți `pip` pentru a instala comenzile bazate pe Python (câteva din utilitarele de mai jos sunt mai ușor de instalat cu `pip`). + + +## Folosire zilnică + +- În Bash, folosiți **Tab** pentru a completa argumente sau a lista comenzile disponibile și **ctrl-r** pentru a căuta în istoricul comenzilor (după apăsare, tastați ce căutați și apăsați repetat **ctrl-r** pentru a cicla prin lista de potriviri, apăsați **Enter** pentru a executa comanda găsită sau săgeată dreapta pentru a putea edita linia curentă). + +- În Bash, folosiți **ctrl-w** pentru a șterge ultimul cuvânt și **ctrl-u** pentru a șterge până la începutul liniei. Folosiți **alt-b** și **alt-f** pentru a naviga cuvânt-cu-cuvânt, **ctrl-a** pentru a muta cursorul la începutul liniei, **ctrl-e** pentru a-l muta la final, **ctrl-k** pentru a șterge până la finalul liniei, **ctrl-l** pentru a curăța tot ecranul. Vizualizați `man readline` pentru a vedea toate tastele implicite din Bash. Sunt o mulțime. De exemplu, **alt-.** ciclează prin toate argumentele anterioare și **alt-*** expandează un glob pattern. + + +- Alternativ, dacă doriți să folosiți tastele ca în vi, folosiți `set -o vi` (și `set -o emacs` pentru a vă întoarce). + +- Pentru a edita comenzi lungi, după setarea editorului (de exemplu `export EDITOR=vim`), **ctrl-x** **ctrl-e** va deschide un editor cu comanda curentă pentru editare. În stilul vi puteți folosi **escape-v**. + +- Comenzile recente le găsiți folosind `history`. Dacă folosiți `!n` (unde `n` este numărul comenzii) atunci o veți executa din nou. Sunt mai multe scurtături pe care le puteți folosi, foarte utile fiind `!$` pentru ultimul argument și `!!` pentru ultima comandă (vedeți "HISTORY EXPANSION" în manual). Acestea pot fi înlocuite ușor cu **ctrl-r** și **alt-.**. + +- Navigați către directorul personal cu `cd`. Accesați fișiere relative la acest director cu prefixul `~` (e.g. `~/.bashrc`). În scripturile `sh`, referiți-vă la directorul personal cu `$HOME`. + +- Pentru a ajunge înapoi în directorul anterior: `cd -`. + +- Dacă sunteți în mijlocul editării unei comenzi dar vreți să renunțați, folosiți **alt-#** pentru a adăuga un `#` la început și a o introduce ca un comentariu (alternativ, **ctrl-a**, **#**, **enter**). Vă puteți întoarce la comandă mai târziu, folosind istoria comenzilor. + +- Folosiți `xargs` (sau `parallel`). Este foarte puternic. Puteți controla câte comenzi execută pe o linie (`-L`) și paralelismul (`-L`). Dacă nu sunteți siguri că ați dat comanda corectă, folosiți întâi `xargs echo`. De asemenea, `-I{}` este foarte ultil. Exemple: +```bash + find . -name '*.py' | xargs grep some_function + cat hosts | xargs -I{} ssh root@{} hostname +``` + +- `pstree -p` este o modalitate ușoară de a afișa lista de procese + +- Folosiți `pgrep` și `pkill` pentru a găsi și semnala procesele după nume (`-f` poate fi util). + +- Învățați ce semnale pot fi trimise proceselor. De exemplu, pentru a suspenda un proces puteți folosi `kill -STOP [pid]`. Pentru a obține lista completă, vedeți `man 7 signal`. + +- Folosiți `nohup` sau `disown` dacă doriți să trimiteți un proces în fundal sau să-l mențineți rulând permanent. + +- Verificați ce procese ascultă pe rețea folosind `netstat -lntp` sau `ss -plat` (pentru TCP; adăugați `-u` pentru UDP). + +- Vedeți `lsof` pentru fișiere și socket-uri deschise. + +- Vedeți `uptime` sau `w` pentru a afla cât timp sistemul a fost funcțional. + +- Folosiți `alias` pentru a crea scurtături pentru comenzile folosie des. De exemplu, `alias ll='ls -latr'` creează un nou alias `ll`. + +- Salvați alias-uri, setări shell, și funcții folosite frecvent în `~/.bashrc`, și [instruiți shell-ul de login să-l citească](http://superuser.com/a/183980/7106). Asftel, veți avea aceleași setări în toate terminalele. + +- Salvați setările variabilelor de mediu și comenzile care ar trebui executate la login în `~/.bash_profile`. Configurări separate sunt necesare pentru shell-uri lansate prin logarea în mediul grafic sau din task-uri `cron`. + +- Sincronizați fișierele de configurare (e.g. `.bashrc` and `.bash_profile`) între mai multe calculatoare folosind Git. + +- Tratați cu atenție cazurile când variabilele și fișierele conțin spații. Folosiți ghilimele în acest caz, de exemplu `"$FOO"`. Preferați să folosiți opțiunile `-0` sau `-print0` pentru a folosi caracterul null pentru a delimita fișierele, de exemplu `locate -0 pattern | xargs -0 ls -al` sau `find / -print0 -type d | xargs -0 ls -al`. Pentru a parcurge o listă de fișiere conținând spații într-o buclă for, setați variabile IFS la terminatorul de linie, `IFS=$'\n'`. + +- În scripturile Bash, folosiți `set -x` (sau varianta `set -v`, care produce informație neprocesată, inclusiv variabile neexpandate și comentarii) pentru a depana outputul. Folosiți modurile strice exceptând când aveți un motiv foarte bun împotrivă: folosiți `set -e` pentru a termina execuția în caz de eroare (cod de ieșire nenul). Folosiți `set -u` pentru a detecta variabile nesetate. Considerați folosirea `set -o pipefail` pentru erorile cauzate de folosirea eronată a pipe-urilor. Pentru scripturi mai complicate, folosiți `trap` pentru EXIT sau ERR. Un obicei util este să începeți scriptul într-o modalitate care va permite detecția facilă a erorilor și terminarea execuției cu un mesaj: +```bash + set -euo pipefail + trap "echo 'error: Script failed: see failed command above'" ERR +``` + +- În scripturile Bash, subshell-urile (delimitate de paranteze) sunt un mod convenabil pentru a grupa comenzi. De exemplu, va puteți muta într-un alt director: +```bash + # do something in current dir + (cd /some/other/dir && other-command) + # continue in original dir +``` + +- În Bash, există mai multe variante de expandare a variabilelor. Verifacți dacă o variabilă există: `${name:?error message}`. De exemplu, dacă un script necesită un argument unic, folosiți `input_file=${1:?usage: $0 input_file}`. Folosți o valoare implicită pentru cazul când o variabilă este goală: `${name:-default}`. Pentru parametri opționali în exemplul anterior, folosiți `output_file=${2:-logfile}`. Dacă `$2` este omis (gol), `output_file` va fi setat la `logfile`. Expandare aritmetică: `i=$(( (i + 1) % 5 ))`. Secvențe: `{1..10}`. Tăierea unor secvențe din șiruri: `${var%suffix}` și `${var#prefix}`. De exemplu, dacă `var=foo.pdf`, atunci `echo ${var%.pdf}.txt` va scrie `foo.txt`. + +- Expandarea parantezelor folosind `{`...`}` previne re-tastarea textelor similare, automatizând combinațiile de elemente. Este util în exemple precum `mv foo.{txt,pdf} some-dir` (care mută ambele fișiere), `cp somefile{,.bak}` (care se expandează la `cp somefile somefile.bak`) sau `mkdir -p test-{a,b,c}/subtest-{1,2,3}` (care expandează toate combinațiile posibile și creează arborele de directoare). + +- Outputul unei comenzi poate fi tratat ca un fișier cu `<(some command)`. De exemplu, pentru a compara fișierul `/etc/hosts` local cu unul la distanță: +```sh + diff /etc/hosts <(ssh somehost cat /etc/hosts) +``` + +- Când scrieți cod, puteți prefera să încadrați tot codul în acolade. Dacă acolada de final lipsește, scriptul nu va rula. Este un lucru util, în special pentru scripturile de pe web pentru că previne execuția scripturilor parțial descărcate: +```bash +{ + # Your code here +} +``` + +- Folosiți "here documents", de exemplu `cat <logfile 2>&1` sau `some-command &>logfile`. De regulă, pentru a vă asigura că o comandă nu lasă un fișier deschis, fiind legată de terminalul curent, este o practică bună să adăugați `>> 2+3 +5 +``` + + +## Procesarea fișierelor și a datelor + +- Pentru a localiza un fișier după nume, în directorul curent, `find . -iname '*something*'` (sau similar). Pentru a găsi un fișier oriunde, `locate something` (dar țineți cont de faptul că `updatedb` s-ar putea să nu fi indexat fișierele recente). + +- Pentru a căuta în interiorul fișierelor (mai avansat decât `grep -r`), folosiți [`ag`](https://github.com/ggreer/the_silver_searcher). + +- Pentru a converti HTML la text: `lynx -dump -stdin` + +- Pentru Markdown, HTML, și alte conversii de documente, folosiți [`pandoc`](http://pandoc.org/). + +- Dacă trebuie să folosiți XML, `xmlstarlet` e vechi dar util. + +- Pentru JSON, folosiți [`jq`](http://stedolan.github.io/jq/). + +- Pentru YAML, folosiți [`shyaml`](https://github.com/0k/shyaml). + +- Pentru Excel sau CSV files, [csvkit](https://github.com/onyxfish/csvkit) oferă `in2csv`, `csvcut`, `csvjoin`, `csvgrep`, etc. + +- Pentru Amazon S3, [`s3cmd`](https://github.com/s3tools/s3cmd) este ușor de folosit și [`s4cmd`](https://github.com/bloomreach/s4cmd) este mai rapid. [`aws`](https://github.com/aws/aws-cli) de la Amazon și varianta îmbunătățită [`saws`](https://github.com/donnemartin/saws) sunt esențiale pentru alte task-uri legate de AWS. + +- Învățați `sort` și `uniq`, inclusiv opțiunile `-u` și `-d` pentru `uniq` -- mai multe exemple în secțiunea de comenzi de o linie, mai jos. Vedeți și `comm`. + +- Aflați despre `cut`, `paste`, și `join` pentru a manipula fișiere text. Mulți oameni folosesc `cut` dar uită de `join`. + +- Informați-vă despre `wc` pentru a număra liniile (`-l`), caracterele (`-m`), cuvintele (`-w`) și octeții (`-c`) dintr-un fișier. + +- Folosți `tee` pentru a copia de la intrarea standard (stdin) într-un fișier și la ieșirea standard (stdout) simultan, ca în `ls -al | tee file.txt`. + +- Pentru operații mai complexe, inclusiv grupare, inversare de câmpuri și statistică, considerați folosirea [`datamash`](https://www.gnu.org/software/datamash/). + +- Țineți minte că localizarea (`locale`) influențează foarte multe comenzi în moduri subtile, inclusiv sortare sau performanță. Majoritatea instalărilor Linux setează `LANG` și alte variabile de localizare la o setare precum US English. Sortarea se va schimba dacă schimbați localizare. De asemenea, rutinele de internaționalizare (i18n) pot face comenzile să se execute *mult, mult* mai încet. În unele situații (precum operațiile pe mulțimi de mai jos), puteți ignora rutinele încete de la i18n și folosi sortarea bazată pe octeți, folosind `export LC_ALL=C`. + +- Puteți seta localizarea specifică unei comenzi prin prefixarea acesteia cu variabila de mediu corespunzătoare, ca în `TZ=Pacific/Fiji date`. + +- Pentru procesare de bază a textelor, folosiți `awk` și `sed`. De exemplu, pentru a aduna suma numerelor din coloana a treia a unui fișier `awk '{ x += $3 } END { print x }'` este de 3 ori mai rapid și mai scurt decât codul echivalent în Python. + +- Pentru a înlocui toate aparițiile unui șir, în cel puțin un fișier: +```sh + perl -pi.bak -e 's/old-string/new-string/g' my-files-*.txt +``` + +- Pentru a redenumi fișiere multiple și/sau căuta în fișiere încercați [`repren`](https://github.com/jlevy/repren). (În unele cazuri, comanda `rename` permite redenumiri multiple, dar țineți cont că funcționalitatea ei nu este aceeași în toate distribuțiile Linux) +```sh + # Full rename of filenames, directories, and contents foo -> bar: + repren --full --preserve-case --from foo --to bar . + # Recover backup files whatever.bak -> whatever: + repren --renames --from '(.*)\.bak' --to '\1' *.bak + # Same as above, using rename, if available: + rename 's/\.bak$//' *.bak +``` + +- După cum zice și pagina de manual, `rsync` este un utilitar foarte rapid, eficient și versatil de a copia fișiere. Este cunoscut pentru sincronizarea între calculatoare dar poate fi folosit și local. Dacă setările de securitate permit, folosirea `rsync` în loc de `scp` permite continuarea unui transfer eșuat fără a-l reporni. Este și una dintre cele [mai rapide metode](https://web.archive.org/web/20130929001850/http://linuxnote.net/jianingy/en/linux/a-fast-way-to-remove-huge-number-of-files.html) de a șterge un număr masiv de fișiere: +```sh +mkdir empty && rsync -r --delete empty/ some-dir && rmdir some-dir +``` + +- Folosiți `shuf` pentru a permuta sau selecta linii aleatoare dintr-un fișier. + +- Învățați opțiunile lui `sort`. Pentru numere folosiți `-n`, sau `-h` pentru numere în format human-readable (de exemplu numere produse de `du -h`). Învățați cum funcționează cheile de sortare (`-t` și `-k`). În special, țineți cont că trebuie să scrieți `-k1,1` pentru a sorta doar prima coloană, `-k1` înseamnă sortare după toată linia. Sortarea stabilă (`sort -s`) poate fi utilă. De exemplu, pentru a sorta după câmpul 2 și apoi după 1: `sort -k1,1 | sort -s -k2,2`. + +- Dacă sunteți nevoiți să scrieți un caracter tab în terminal (de exemplu pentru argumentul `-t` al `sort`) apăsați **ctrl-v** **[Tab]** sau scrieți `$'\t'` (ultima versiune e mai bună pentru că permite și copy/paste). + +- Utilitarele standard pentru patch-uirea codului sunt `diff` și `patch`. De asemenea `diffstat` poate fi folosit pentru sumarizarea unui diff și `sdiff` pentru un diff side-by-side. Țineți cont că `diff -r` operează pe directoare întregi. Folosiți `diff -r tree1 tree2 | diffstat` pentru un sumar al modificărilor. Folosiți `vimdiff` pentru a compara și edita fișiere. + +- Pentru fișiere binare, folosiți `hd`, `hexdump` sau `xxd` pentru operații simple și `bvi` sau `biew` pentru editare binară + +- Tot pentru fișiere binare, `strings` (plus `grep`, etc.) permite găsirea bucăților de text. + +- Pentru diff-uri binare (compresie delta), folosiți `xdelta3`. + +- Pentru a converti codificarea textului, folosiți `iconv` sau `uconv` pentru utilizări mai avansate. Ambele suportă același set de Unicode. De exemplu, comanda următoare transformă în minuscule și elimină accentele (prin expandare sau coborâre): +```sh + uconv -f utf-8 -t utf-8 -x '::Any-Lower; ::Any-NFD; [:Nonspacing Mark:] >; ::Any-NFC; ' < input.txt > output.txt +``` + +- Pentru a împărți un text în fragmente, folosiți `split` (după dimensiune) și `csplit` (după un șablon). + +- Folosiți `dateadd`, `datediff`, `strptime` etc. din [`dateutils`](http://www.fresse.org/dateutils/) pentru a manipula expresii legate de timp, dată și oră. + +- Pentru a opera pe fișiere comprimate: `zless`, `zmore`, `zcat`, and `zgrep` + +- Atributele fișierelor pot fi stabilite cu `chattr` și oferă o alternativă de nivel scăzut la permisiunile unui fișier. De exemplu, pentru a vă proteja împotriva ștergerii accidentale puteți folosi flag-ul immutable: `sudo chattr +i /critical/directory/or/file` + +- Folosiți `getfacl` și `setfacl` pentru a salva și restaura permisiunile unui fișier. De exemplu: +```sh + getfacl -R /some/path > permissions.txt + setfacl --restore=permissions.txt +``` + +## Depanarea sistemului + +- Pentru depanarea problemelor legate de internet/web, `curl` și `curl -I` sunt foarte utile, la fel și echivalentele bazate pe `wget` sau pe modernul [`httpie`](https://github.com/jkbrzt/httpie). + +- Pentru a vedea starea curentă a CPU-ului sau discului, instrumentele clasice sunt `top` (mai bine `htop`), `iostat`, și `iotop`. Folosiți `iostat -mxz 15` pentru informații de bază despre CPU și detaliate depsre partițiile fiecărui disc, împreună cu sfaturi pentru îmbunătățirea performanței. + +- Pentru detalii legate de conexiunile la rețea, folosiți `netstat` și `ss`. + +- O vedere de ansamblu a sistemului poate fi obținută folosind `dstat`. Pentru detalii, folosiți [`glances`](https://github.com/nicolargo/glances). + +- Pentru a vedea starea curentă a memoriei, folosiți și analizați rezultatele `free` și `vmstat`. În particular, țineți cont că valoarea "cached" este memorie reținută de Linux ca un spațiu cache pentru fișiere, deci este efectiv spațiu "liber". + +- Depanarea sistemului Java este deosebită dar un truc simplu pe anumite JVM-uri (inclusiv Oracle) este că puteți rula `kill -3 ` și veți obține un stack trace complet și informații despre memoria heap, inclusiv detalii despre garbage collector. Utilitarele `jps`, `jstat`, `jstack`, `jmap` din JDK pot fi utile. [Utilitarele SJK](https://github.com/aragozin/jvm-tools) sunt mai avansate. + +- Folosiți [`mtr`](http://www.bitwizard.nl/mtr/) ca un `traceroute` mai bun pentru a identifica problemele de rețea. + +- Pentru a identifica de ce un disc este plin, [`ncdu`](https://dev.yorhel.nl/ncdu) salvează timp comparativ cu folosirea comenzilor uzuale precum `du -sh *`. + +- Pentru a identifica socket-ul sau procesul care consumă cea mai mare bandă din rețea folosiți [`iftop`](http://www.ex-parrot.com/~pdw/iftop/) sau [`nethogs`](https://github.com/raboof/nethogs). + +- Utilitarul `ab` (vine cu Apache) este util pentru a testa rapid performanța serverului web. Pentru testare mai complexă folosiți `siege`. + +- Pentru depanarea și mai serioasă a rețelei folosiți [`wireshark`](https://wireshark.org/), [`tshark`](https://www.wireshark.org/docs/wsug_html_chunked/AppToolstshark.html), sau [`ngrep`](http://ngrep.sourceforge.net/). + +- Învățați despre `strace` și `ltrace`. Aceste utilitare sunt utile dacă un program eșuează, se blochează sau crapă și nu știți de ce, sau dacă vreți să obțineți detalii generale despre performanță. Evidențiem opțiunea de profiling (`-c`), și abilitatea de atașare la un proces care rulează (`-p`). + +- Folosiți `ldd` pentru a verifica bibliotecile dinamice, etc. + +- Folosiți `gdb` pentru a vă conecta la un proces care rulează și a obține un stack trace. + +- Folosiți `/proc`. Este foarte util în depanarea problemelor pe viu. Exemple: `/proc/cpuinfo`, `/proc/meminfo`, `/proc/cmdline`, `/proc/xxx/cwd`, `/proc/xxx/exe`, `/proc/xxx/fd/`, `/proc/xxx/smaps` (unde `xxx` este id-ul procesului - PID-ul lui). + +- Pentru a depana ceva ce a fost greșit în trecut, [`sar`](http://sebastien.godard.pagesperso-orange.fr/) poate fi foarte util. Arată statistici istorice despre CPU, memorie, rețea, etc. + +- Pentru analize de detaliu pentru performanța sistemului, folosiți `stap` ([SystemTap](https://sourceware.org/systemtap/wiki)), [`perf`](https://en.wikipedia.org/wiki/Perf_(Linux)), și [`sysdig`](https://github.com/draios/sysdig). + +- Verificați ce sistem de operare folosiți cu `uname` sau `uname -a` (detalii generale despre nucleu) sau `lsb_release -a` (Linux distro). + +- Folosiți `dmesg` oricând ceva funcționează total aiurea (probabil din cauza hardware-ului sau a dispozitivelor fizice). + +- Dacă ștergeți un fișier și nu se eliberează cantitatea de spațiu de pe disc la care vă așteptați (conform `du`), verificați să nu cumva aveți fișierul folosit de un proces: +`lsof | grep deleted | grep "filename-of-my-big-file"` + + +## Comenzi de o linie + +Câteva exemple de a construi comenzi complicate din comenzi simple: + +- Este foarte util uneori că puteți trata fișierele ca mulțimi de rânduri și puteți implementa operațiile pe mulțimi -- intersecție, reuniune și diferență -- folosind `sort`/`uniq`. Presupunând că `a` și `b` sunt fișiere text fără linii duplicate, următoarele comenzi sunt foarte rapide și procesează fișiere de dimensiuni gigantice (`sort` nu este limitat de memorie dar este preferabil să folosiți `-T` dacă `/tmp` este pe o partiție mică). De asemenea, nu uitați de nota despre `LC_ALL` (localizare) de mai sus și de opțiunea `-u` (eliminată mai jos pentru claritate): +```sh + cat a b | sort | uniq > c # c is a union b + cat a b | sort | uniq -d > c # c is a intersect b + cat a b b | sort | uniq -u > c # c is set difference a - b +``` + +- Folosiți `grep . *` pentru a examina rapid conținutul fișierelor din director (fiecare linie este împerecheată cu fișierul din care provine) sau `head -100 *` (fiecare fișier are un header). Este un sfat util pentru directoare conținând setări precum `/sys`, `/proc`, `/etc`. + + +- Suma tuturor numerelor din a 3-a coloană a unui fișier (probabil de 3 ori mai rapid și de 3 ori mai puțin cod decât codul Python echivalent): +```sh + awk '{ x += $3 } END { print x }' myfile +``` + +- Pentru a vedea dimensiunile și data fiecărui fișier dintr-un arbore, metoda următoare este ca un `ls -l` recursiv dar cu un output mai clar decât `ls -lR`: +```sh + find . -type f -ls +``` + +- Presupunând că aveți un fișier text, de exemplu un jurnal al unui server web, și o anumită valoare apare pe câteva linii, precum o valoare pentru parametrul `acct_id` prezent în URL, dacă doriți un sumar pentru fiecare valoare a lui `acct_id`: +```sh + cat access.log | egrep -o 'acct_id=[0-9]+' | cut -d= -f2 | sort | uniq -c | sort -rn +``` + +- Pentru a monitoriza schimbările folosiți `watch`. De exemplu, verificați schimbările dintr-un director cu `watch -d -n 2 'ls -rtlh | tail'` sau setările de rețea în timp ce depanați probleme cu conexiunea wireless: `watch -d -n 2 ifconfig`. + +- Folosiți această funcție pentru a obține un sfat aleator din acest document (parsează formatul Markdown și extrage un item): +```sh + function taocl() { + curl -s https://raw.githubusercontent.com/jlevy/the-art-of-command-line/master/README.md | + pandoc -f markdown -t html | + xmlstarlet fo --html --dropdtd | + xmlstarlet sel -t -v "(html/body/ul/li[count(p)>0])[$RANDOM mod last()+1]" | + xmlstarlet unesc | fmt -80 + } +``` + + +## Obscure dar utile + +- `expr`: execută operații aritmetice sau logice și expandează expresii regulate + +- `m4`: procesor simplu de macro-uri + +- `yes`: afișează un șir de un număr infinit de ori + +- `cal`: calendar + +- `env`: execută o comandă (util în scripturi) + +- `printenv`: afișează variabilele de mediu (util pentru depanare și scripturi) + +- `look`: idenfică cuvinte în engleză (sau linii de fișier) care încep cu un șir + +- `cut`, `paste` and `join`: manipulează date + +- `fmt`: formatează paragrafe de text + +- `pr`: formatează textul în paragrafe și coloane + +- `fold`: înfășoară liniile unui text + +- `column`: formatează textul în coloane de lungime fixă, în tabele + +- `expand` și `unexpand`: convertește între tab-uri și spații + +- `nl`: adaugă numere liniilor + +- `seq`: afișează numere + +- `bc`: calculator + +- `factor`: factorizează întregi + +- [`gpg`](https://gnupg.org/): criptează și semnează fișiere + +- `toe`: tabel de informații despre terminal + +- `nc`: depanare rețea și transfer de date + +- `socat`: socket relay și forwarder pentru porturi tcp (similar cu `netcat`) + +- [`slurm`](https://github.com/mattthias/slurm): vizualizează traficul de rețea + +- `dd`: mută datele între fișiere și device-uri + +- `file`: identifică tipul unui fișier + +- `tree`: arată un arbore de directoare și subdirectoare, ca `ls` dar recursiv + +- `stat`: informații despre fișier + +- `time`: execută și cronometrează o comandă + +- `timeout`: execută o comandă până la expirarea unui timp definit, omorând procesul la finalul timpului alocat + +- `lockfile`: creează un fișier semafor care nu poate fi șters decât cu `rm -f` + +- `logrotate`: rotește, comprimă și trimite jurnalele pe mail + +- `watch`: execută o comandă în mod repetat, arătând rezultatele și/sau evidențiind diferențele + +- `tac`: afișează conținutul fișierelor în ordine inversă + +- `shuf`: selectează linii in mod aleator din fișier + +- `comm`: compară fișiere sortate, linie cu linie + +- `pv`: monitorizează progresul datelor într-un pipe + +- `hd`, `hexdump`, `xxd`, `biew` și `bvi`: afișează sau editează fișiere binare + +- `strings`: extrage șiruri din fișiere + +- `tr`: translatează și manipulează caractere + +- `iconv` sau `uconv`: conversie între codificările posibile ale unui text + +- `split` și `csplit`: sparge fișiere în componente + +- `sponge`: citește tot inputul înainte de a-l afișa, util pentru a citi și apoi a scrie în același fișier: `grep -v something some-file | sponge some-file` + +- `units`: conversii între unități de măsură (vedeți și `/usr/share/units/definitions.units`) + +- `apg`: generateză parole aleatoare + +- `xz`: compresor de fișiere foarte eficient + +- `ldd`: informații despre bibliotecile dinamice + +- `nm`: simboluri din fișierele obiect + +- `ab`: benchmarking pentru servere web + +- `strace`: depanare apeluri de sistem + +- [`mtr`](http://www.bitwizard.nl/mtr/): alternativă mai bună pentru `traceroute` pentru depanarea rețelei + +- `cssh`: shell vizual, concurent + +- `rsync`: sincronizează fișiere peste SSH sau local + +- [`wireshark`](https://wireshark.org/) și [`tshark`](https://www.wireshark.org/docs/wsug_html_chunked/AppToolstshark.html): capturează trafic de rețea și depanează rețeaua + +- [`ngrep`](http://ngrep.sourceforge.net/): grep pentru rețea + +- `host` și `dig`: interogări DNS + +- `lsof`: informații despre descriptorii de fișiere și sockeți + +- `dstat`: statistici utile despre sistem + +- [`glances`](https://github.com/nicolargo/glances): statistici utile despre sistem, la nivel înalt + +- `iostat`: statistici despre folosirea discului + +- `mpstat`: statistici despre folosirea CPU + +- `vmstat`: statistici despre folosirea memoriei + +- `htop`: versiune îmbunătățită a `top` + +- `last`: istoria login-urilor + +- `w`: cine este logged-in + +- `id`: informații despre utilizatori/grupuri + +- [`sar`](http://sebastien.godard.pagesperso-orange.fr/): istoria statisticilor despre sistem + +- [`iftop`](http://www.ex-parrot.com/~pdw/iftop/) sau [`nethogs`](https://github.com/raboof/nethogs): utilizarea rețelei de fiecare socket sau proces + +- `ss`: statistici socket + +- `dmesg`: erori de sistem sau de pornirea sistemului + +- `sysctl`: vizualizează și configurează parametrii nucleului Linux + +- `hdparm`: manipulare/performanță pentru discuri SATA/ATA + +- `lsblk`: afișează dispozitivele block: discuri și partiții + +- `lshw`, `lscpu`, `lspci`, `lsusb`, `dmidecode`: informații hardware, incluzând CPU, BIOs, RAID, plăci grafice, dispozitive, etc. + +- `lsmod` și `modinfo`: afișează module de kernel + +- `fortune`, `ddate`, și `sl`: depinde dacă considerați locomotive și citate "utile" (utilitare distractive) + + +## Doar pentru OS X + +Aceste sfaturi sunt relevante *doar* pentru OS X. + +- Managementul pachetelor cu `brew` (Homebrew) și/sau `port` (MacPorts). Aceste comenzi pot fi folosite pentru a instala multe din comenzile de mai sus pe un Mac. + +- Copiați outputul unei comenzi către aplicații desktop cu `pbcopy` și lipiți conținutul de la una cu `pbpaste`. + +- Pentru a mapa tasta Option în OS X Terminal ca o tastă Alt (pentru comenzile de mai sus precum **alt-b**, **alt-f**, etc.), deschideți Preferences -> Profiles -> Keyboard și selectați "Use Option as Meta key" ("Folosește Option ca tastă Meta"). + +- Pentru a deschide un fișier cu o aplicație desktop folosiți`open` sau `open -a /Applications/Whatever.app`. + +- Spotlight: Găsiți fișiere cu `mdfind` și listați meta-date (de exemplu informații EXIF din fotografii) cu `mdls`. + +- Țineți minte că OS X este la bază un BSD Unix, și multe comenzi (de exemplu `ps`, `ls`, `tail`, `awk`, `sed`) au un număr de variațiuni subtile comparativ cu Linux, un fapt influențat de diferențele între System V-style Unix și utilitarele GNU. Puteți vedea diferențele observând dacă pagina de manual are antetul "BSD General Commands Manual" ("Manual de comenzi generale BSD"). În unele cazuri, versiunile GNU pot fi instalate în paralel (precum `gawk` și `gsed` pentru GNU awk și sed). În scrierea de aplicații independente de platformă, evitați aceste comenzi (de exemplu folosiți Python sau `perl`) sau testați cu atenție. + +- Informații despre versiunea OS X se pot obține cu `sw_vers`. + +## Doar pentru Windows + +Aceste sfaturi sunt relevante *doar* pentru Windows. + +- În Windows 10, puteți folosi [Bash în Ubuntu în Windows](https://msdn.microsoft.com/commandline/wsl/about), pentru a obține mediul Bash familiar cu comenzile și utilitățile Unix descrise anterior. Ca bonus, acest lucru permite ca programele Linux să ruleze pe Windows. Pe de altă parte, nu puteți rula programe Windows din prompt-ul Bash. + +- Puteți accesa shell-ul Unix sub Windows prin instalarea [Cygwin](https://cygwin.com/). Multe din lucrurile descrise aici vor funcționa implicit. + +- Programele Unix adiționale se vor instala cu managerul de pachete al lui Cygwin. + +- Folosiți `mintty` ca fereastra de comenzi. + +- Accesați clipboard-ul Windows prin intermediul `dev/clipboard`. + +- Folosiți `cygstart` pentru a deschide un fișier arbitrar cu aplicația corespunzătoare + +- Accesați registrele Windows cu `regtool`. + +- Observați că o cale de tip `C:\` în Windows devine `/cygdrive/c` sub Cygwin, și că root-ul Cygwin, `/`, apare ca `C:\cygwin` pe Windows. Convertiți între căile Cygwin și Windows cu `cygpath`. Acest lucru este util în scripturile care apelează programe Windows. + +- Puteți executa majoritatea task-urilor de administrare a sistemului Windows din linia de comandă prin învățarea și folosirea `wmic`. + +- O altă opțiune de a obține un sistem similar Unix sub Windows este [Cash](https://github.com/dthree/cash). Țineți cont că doar câte utilitare Unix sunt în prezent disponibile în acest mediu. + +- O altă opțiune alternativă este să obțineți instrumentele de dezvoltare GNU (precum GCC) cu [MinGW](http://www.mingw.org/) și pachetul [MSYS](http://www.mingw.org/wiki/msys). Astfel veți obtine utilitare precum `bash`, `gawk`, `make` și `grep`. MSYS nu are toate beneficiile Cygwin dar este util în particular pentru a crea versiuni de Windows pentru instrumentele Unix. + +## Mai multe resurse + +- [awesome-shell](https://github.com/alebcay/awesome-shell): O listă detaliată a instrumentelor și resurselor pentru shell. +- [awesome-osx-command-line](https://github.com/herrbischoff/awesome-osx-command-line): Un ghid mai detaliat pentru folosirea liniei de comandă sub OS X +- [Strict mode](http://redsymbol.net/articles/unofficial-bash-strict-mode/) pentru a scrie scripturi mai bune.. +- [shellcheck](https://github.com/koalaman/shellcheck): Un utilitar pentru analiza statică a scripturilor. În esență, `lint` pentru bash/sh/zsh. +- [Filenames and Pathnames in Shell](http://www.dwheeler.com/essays/filenames-in-shell.html): Detalii complete despre situația tristă în folosirea căilor către fișiere corect în scripturi independente de platformă +- [Data Science at the Command Line](http://datascienceatthecommandline.com/#tools): Mai multe comenzi și utilitare disponibile pentru analiza datelor, după cartea cu același nume. + +## Anunț legal + +Cu excepția unor task-uri foarte mici, codul scris aici este pentru ca alții să-l poate citi. Cu putere vine și responsabilitate. Faptul că *puteți* face ceva în Bash nu înseamnă neapărat că și trebuie să-l faceți ;) + + +## Licență + +[![Creative Commons License](https://i.creativecommons.org/l/by-sa/4.0/88x31.png)](http://creativecommons.org/licenses/by-sa/4.0/) + +Această muncă este licențiată sub [Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/). diff --git a/README-ru.md b/README-ru.md index 91a9251..4a1de95 100644 --- a/README-ru.md +++ b/README-ru.md @@ -1,5 +1,5 @@ 🌍 -*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* +*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Indonesia](README-id.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Română](README-ro.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* # Искусство командной строки @@ -567,7 +567,7 @@ mkdir empty && rsync -r --delete empty/ some-dir && rmdir some-dir ## Дисклеймер -За небольшим исключением, весь код написан так, чтобы другие его смогли прочитать. С большой силой приходит большая ответственность. Из того, что вы *способны* что-то сделать в Баше, вовсе не следует, что это нужно делать! ;) +За небольшим исключением, весь код написан так, чтобы другие его смогли прочитать. С большой силой приходит большая ответственность. Из того, что вы *способны* что-то сделать в Баше, вовсе не означает, что это нужно делать! ;) ## Лицензия diff --git a/README-sl.md b/README-sl.md index 654578c..83d036c 100644 --- a/README-sl.md +++ b/README-sl.md @@ -1,11 +1,14 @@ 🌍 -*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* +*[Čeština](README-cs.md) ∙ [Deutsch](README-de.md) ∙ [Ελληνικά](README-el.md) ∙ [English](README.md) ∙ [Español](README-es.md) ∙ [Français](README-fr.md) ∙ [Indonesia](README-id.md) ∙ [Italiano](README-it.md) ∙ [日本語](README-ja.md) ∙ [한국어](README-ko.md) ∙ [Português](README-pt.md) ∙ [Română](README-ro.md) ∙ [Русский](README-ru.md) ∙ [Slovenščina](README-sl.md) ∙ [Українська](README-uk.md) ∙ [简体中文](README-zh.md) ∙ [繁體中文](README-zh-Hant.md)* # Umetnost ukazne vrstice +[![Vprašajte](https://img.shields.io/badge/%3f-Ask%20a%20Question-ff69b4.svg)](https://airtable.com/shrzMhx00YiIVAWJg) + [![Join the chat at https://gitter.im/jlevy/the-art-of-command-line](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jlevy/the-art-of-command-line?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + - [Meta](#meta) - [Osnove](#osnove) - [Vsakodnevna uporaba](#vsakodnevna-uporaba) @@ -29,7 +32,7 @@ se je [prvotno](http://www.quora.com/What-are-some-lesser-known-but-useful-Unix- [pojavilo](http://www.quora.com/What-are-the-most-useful-Swiss-army-knife-one-liners-on-Unix) na [Quori](http://www.quora.com/What-are-some-time-saving-tips-that-every-Linux-user-should-know), vendar se je premaknilo na GitHub, kjer so ljudje bolj talentirani od prvotnega avtorja naredili številne izboljšave. -[**Prosimo, prispevajte**](/CONTRIBUTING.md), če vidite napako ali nekaj, kar bi lahko bilo boljše! +[**Vprašajte**](https://airtable.com/shrzMhx00YiIVAWJg), če imate vprašanje povezano z ukazno vrstico. [**Prosimo, prispevajte**](/CONTRIBUTING.md), če vidite napako ali nekaj, kar bi lahko bilo boljše! ## Meta @@ -98,7 +101,6 @@ Opombe: cat hosts | xargs -I{} ssh root@{} hostname ``` - - `pstree -p` je priročen prikaz drevesa procesov. - Uporabite `pgrep` in `pkill`, da najdete ali signalizirate procese po imenu (`-f` je v pomoč). @@ -136,7 +138,7 @@ Opombe: # continue in original dir ``` -- V Bash-u bodite pozorni, saj je veliko vrst razširjenih spremenljivk. Preverjanje, če spremenljivka obstaja: `${name:?error message}`. Na primer, če skripta Bash zahteva en argument, samo napišite `input_file=${1:?usage: $0 input_file}`. Aritmetična raširitev: `i=$(( (i + 1) % 5 ))`. Sekvence: `{1..10}`. Obrezovanje nizov: `${var%suffix}` in `${var#prefix}`. Na primer, če je `var=foo.pdf`, potem `echo ${var%.pdf}.txt` izpiše `foo.txt`. +- V Bash-u bodite pozorni, saj je veliko vrst razširjenih spremenljivk. Preverjanje, če spremenljivka obstaja: `${name:?error message}`. Na primer, če skripta Bash zahteva en argument, samo napišite `input_file=${1:?usage: $0 input_file}`. Uporaba privzete vrednosti, če je spremenljivka prazna: `${name:-default}`. Če želite, imeti dodatni (opcijski) parameter dodan k prejšnjemu primeru, lahko uporabite nekaj takega `output_file=${2:-logfile}`. Če je $2 izpuščen in tako prazen, bo `output_file` nastavljen na `logfile`. Aritmetična raširitev: `i=$(( (i + 1) % 5 ))`. Sekvence: `{1..10}`. Obrezovanje nizov: `${var%suffix}` in `${var#prefix}`. Na primer, če je `var=foo.pdf`, potem `echo ${var%.pdf}.txt` izpiše `foo.txt`. - Lupinska razširitev zavitih oklepajev z `{`...`}` lahko pomaga zmanjšati potrebo po ponovnem vpisovanju podobnega teksta in avtomatizira kombiniranje elementov. To je v pomoč v primerih kot je `mv foo.{txt,pdf} some-dir` (ki premakne obe datoteki), `cp somefile{,.bak}` (kar razširi v `cp somefile somefile.bak`) ali `mkdir -p test-{a,b,c}/subtest-{1,2,3}` (kar razširi vse možne kombinacije in ustvari drevo direktorijev). @@ -145,6 +147,13 @@ Opombe: diff /etc/hosts <(ssh somehost cat /etc/hosts) ``` +- Ko pišete skripte, boste morda želeli dati vašo kodo v zavite oklepaje. Če zapirajoči se oklepaj manjka, se vaša skripta ne bo izvršila zaradi sintaktične napake. To je smiselno, ko se vašo skripto prenese iz spleta, saj preprečuje izvrševanje delno prenešene skripte: +```bash +{ + # Vaša koda +} +``` + - Spoznajte t.i. "here" dokumente v Bash-u, kot pri `cat <logfile 2>&1` ali `some-command &>logfile`. Pogosto zagotavlja, da ukaz ne pusti ročaja odprte datoteke za standardni vnos, kar ga veže na terminal v katerem se nahajate, je tudi dobra praksa, da dodate `logfile 2>&1`。通常,为了保证命令不会在标准输入里残留一个打开了的文件句柄导致你当前所在的终端无法操作,添加 `