Upgrade to Pro — share decks privately, control downloads, hide ads and more …

クララと学ぶbash / Learn bash with Clara

クララと学ぶbash / Learn bash with Clara

B433dfef4ca935a7320df9fc96871aeb?s=128

Hiromichi NOMATA

September 24, 2018
Tweet

Transcript

  1. ΫϥϥͱֶͿ bash

  2. γΣϧ ≒ ϑΝΠϥʔ (ίϚϯυϥΠϯ)γΣϧ άϥϑΟΧϧγΣϧ • bashɺzshͳͲ • λʔϛφϧ(ࠇ͍ը໘ʣͰ੍ޚ •

    Explorer, FinderͳͲ • GUI্ͰϚ΢εͰ௚ײతʹૢ࡞
  3. γΣϧΛֶͿཧ༝ ɾWebαʔόʔͷૢ࡞ ≒ γΣϧ αʔόʔʹ͸GUI ؀ڥ͕ͳ͍͜ͱ͕ଟ͍ ɾϓϩάϥϛϯάؔ܎ͷπʔϧ͸CLIલఏ CLI = ίϚϯυϥΠϯɾΠϯλʔϑΣΠε

    ϓϩάϥϜʹύϥϝʔλʔAͱBΛઃఆ࣮ͯ͠ߦ ɾ Linux, Macͷඪ४γΣϧ͸bash
  4. ·ͱΊ ɾ γΣϧʹ͸ ίϚϯυϥΠϯγΣϧ άϥϑΟΧϧγΣϧ ͷ2छྨ͕͋Δ ɾϓϩάϥϛϯάΛ͢Δ্ͰCLIͰͷૢ࡞͸ඞਢ

  5. ΫϥϥͱֶͿ iTerm, Github

  6. iTermͷμ΢ϯϩʔυ λʔϛφϧ: Macඪ४ iTerm: ๛෋ͳΧελϚΠζ߲໨ https://www.iterm2.com/index.html

  7. iTermͷϓϩϑΝΠϧͷมߋ ɾࠇ͍ը໘͔Β޷͖ͳ৭ʹมߋՄೳ ɾઃఆࡁΈͷϑΝΠϧͷΠϯϙʔτ΋Մೳ https://github.com/altercation/solarized/tree/ master/iterm2-colors-solarized

  8. GitHubͱ͸ ɾϓϩάϥϜͷιʔείʔυΛ؅ཧͰ͖ΔαΠτ https://github.com ɾϚείοτ͸Octocat ɾ2018/7ʹMicrosoftʹങऩ͞Εͨ

  9. ιʔείʔυͷμ΢ϯϩʔυ ɾϑΝΠϧΛGitHub͔ΒzipϑΝΠϧΛ μ΢ϯϩʔυ https://github.com/clarawahr/clara-collection

  10. ιʔείʔυͷμ΢ϯϩʔυ ɾղౚͯ͠σεΫτοϓʹҠಈ

  11. ϛογϣϯ ·ͩΧςΰϦʔ෼͚͞Ε͍ͯͳ͍ը૾Λ λʔϛφϧͷૢ࡞͚ͩͰҠಈ͠Α͏ʂ

  12. ΫϥϥͱֶͿ pwd, cd

  13. pwd (ݱࡏͷσΟϨΫτϦΛදࣔ) ɾpwd: print working directory Windows: ϑΥϧμ Unix: σΟϨΫτϦ

    ɾλʔϛφϧىಈ࣌͸ϗʔϜσΟϨΫτϦ OSʹΑͬͯҧ͏͕ɺMacOSͩͱ ϗʔϜσΟϨΫτϦ= /Users/<Ϣʔβʔ໊> ɾύε = σΟϨΫτϦͷ৔ॴΛද͢จࣈྻ
  14. cd (σΟϨΫτϦΛҠಈ) ɾcd: change directory cd <Ҡಈ͍ͨ͠ϑΥϧμ໊> ɾઈରύε = શ෦ࢦఆ

    /Users/clara/Desktop/clara-collection ɾ૬ରύε = ݱࡏͷσΟϨΫτϦΛى఺ʹࢦఆ ./Desktop/clara-collection . = ݱࡏͷσΟϨΫτϦ
  15. cd (σΟϨΫτϦΛҠಈ) ɾ . = ݱࡏͷσΟϨΫτϦ ɾ .. = ਌σΟϨΫτϦ

    ɾ ../.. = ਌਌σΟϨΫτϦ ɾ ~ = ϗʔϜσΟϨΫτϦ ɾ * =ύλʔϯϚονɻ೚ҙͷจࣈ ɾ - = ௚લͷσΟϨΫτϦ
  16. ΫϥϥͱֶͿ ls, cat, open

  17. ls(LiSt directory contents) ɾ ls: directory಺ͷϑΝΠϧΛදࣔ ɾ ࢠσΟϨΫτϦͷத਎ͷΈදࣔ ɾ ls

    -l: ϦετܗࣜͰදࣔ ɾ ls -a: શͯදࣔ ɾ ls -al: ϦετܗࣜͰશͯදࣔ ɾ UnixͰ͸ . ͔Β࢝·ΔϑΝΠϧ͸Ӆ͠ϑΝΠϧ
  18. υοτϑΝΠϧΛ࡞ͬͯΈΔ ɾ touch: ۭϑΝΠϧΛ࡞ΔίϚϯυ ɾ touch .hidden.txt : .hidden.txtΛ࡞੒ ɾ

    lsίϚϯυ͚ͩͩͱ.hidden.txt͸දࣔ͞Εͳ͍ ɾ -aΦϓγϣϯΛ͚ͭΔͱӅ͠ϑΝΠϧ΋දࣔ
  19. cat (conCATenate) ɾ cat: ϑΝΠϧͷ࿈݁ίϚϯυ ɾ த਎Λදࣔ͢Δͷʹ΋࢖༻Մೳ ɾ cat README.md

    ͰREADMEͷத਎Λදࣔ ɾ echo: ೖྗ಺༰Λ͓͏Ήฦ͢͠ΔίϚϯυ ɾ ࢁ͔ͬ͜(>) ͱ૊Έ߹ΘͤΔͱϑΝΠϧॻ͖ग़͠ ɾ echo ‘VTuber’ > vtuber.txt ɾ cat README.md vtuber.txt ɾ ϑΝΠϧΛ࿈݁ͨ͠΋ͷΛදࣔ
  20. open (։͘) ɾ open: ϑΝΠϧɺσΟϨΫτϦΛ։͘(Mac only) ɾ Windowsͩͱexplorer, Linuxͩͱnautilus ɾ

    open README.md => ΤσΟλ͕։͘ ɾ open burning => burningσΟϨΫτϦ͕։͘ ɾ open normal/ok.png => ը૾͕։͘
  21. ΫϥϥͱֶͿ cp, mkdir, mv, rm

  22. cp (CoPy) ɾ cp: ϑΝΠϧΛίϐʔ͢ΔίϚϯυ ɾ cp a.txt b.txt: a.txtͱಉ಺༰Ͱb.txtΛ࡞੒

    ɾ cp a.txt cdir: a.txtͱಉ಺༰Ͱcdir/a.txtΛ࡞੒ ɾ uncategorized/burning_punch.png ΛburningσΟϨΫτϦʹίϐʔ
  23. mkdir (MaKe DIRectory) ɾ mkdir: σΟϨΫτϦΛ࡞੒͢ΔίϚϯυ ɾ mkdir adir: adirͱ͍͏໊લͷσΟϨΫτϦΛ࡞੒

    ɾ flyingσΟϨΫτϦΛ࡞੒͠Α͏ ɾ mkdir -p adir/bdir adirΛ࡞੒ޙɺadirͷதʹbdirΛ࡞੒
  24. mv (MoVe) ɾ mv: ҠಈɺϦωʔϜͷίϚϯυ ɾ mv a.txt b.txt: a.txtͷ໊લΛb.txtʹมߋ

    ɾ mv a/b.txt c: aσΟϨΫτϦͷb.txtΛcσΟϨΫτ ϦʹҠಈ ɾ flying_0.png, flying_1.pngΛ uncategorized͔ΒflyingʹҠಈ͠Α͏
  25. rm (ReMove) ɾ rm: ࡟আͷίϚϯυ ɾ rm a.txt: a.txtΛ࡟আ ɾ

    rm -r bdir: bdirσΟϨΫτϦ͝ͱ࡟আ ɾ .hidden.txt, vtuber.txt, uncategorizedΛ࡟আ͠Α͏
  26. ϛογϣϯୡ੒!! ɾ claraͷը૾ͷΧςΰϦʔ෼͚ʹ੒ޭ ɾ γΣϧૢ࡞: Lv1 ֫ಘ