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

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

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

Hiromichi NOMATA

September 24, 2018
Tweet

More Decks by Hiromichi NOMATA

Other Decks in Education

Transcript

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

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

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

    ɾ ../.. = ਌਌σΟϨΫτϦ ɾ ~ = ϗʔϜσΟϨΫτϦ ɾ * =ύλʔϯϚονɻ೚ҙͷจࣈ ɾ - = ௚લͷσΟϨΫτϦ
  4. ls(LiSt directory contents) ɾ ls: directory಺ͷϑΝΠϧΛදࣔ ɾ ࢠσΟϨΫτϦͷத਎ͷΈදࣔ ɾ ls

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

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

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

    open README.md => ΤσΟλ͕։͘ ɾ open burning => burningσΟϨΫτϦ͕։͘ ɾ open normal/ok.png => ը૾͕։͘
  8. 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σΟϨΫτϦʹίϐʔ
  9. mkdir (MaKe DIRectory) ɾ mkdir: σΟϨΫτϦΛ࡞੒͢ΔίϚϯυ ɾ mkdir adir: adirͱ͍͏໊લͷσΟϨΫτϦΛ࡞੒

    ɾ flyingσΟϨΫτϦΛ࡞੒͠Α͏ ɾ mkdir -p adir/bdir adirΛ࡞੒ޙɺadirͷதʹbdirΛ࡞੒
  10. 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ʹҠಈ͠Α͏
  11. rm (ReMove) ɾ rm: ࡟আͷίϚϯυ ɾ rm a.txt: a.txtΛ࡟আ ɾ

    rm -r bdir: bdirσΟϨΫτϦ͝ͱ࡟আ ɾ .hidden.txt, vtuber.txt, uncategorizedΛ࡟আ͠Α͏