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

Linux Introduction (for Raspberry Pi Course)

Linux Introduction (for Raspberry Pi Course)

Tzu-ping Chung

August 19, 2015
Tweet

More Decks by Tzu-ping Chung

Other Decks in Programming

Transcript

  1. Agenda • Introduction • The shell • Git • Linux

    topics • Writing code • Python basics • Python in shell • Extensions
  2. Me • Call me TP • https://uranusjr.com • Python, C++,

    OS X, iOS, Web • Tutorials and courses • Speaker • Django Girls Taipei

  3. Shell • Core — Shell — User • Command line

    interface • Bash (Bourne-Again Shell)
  4. $  man  cp   ...   -­‐R,  -­‐r,  -­‐-­‐recursive  

           copy  directories  recursively
  5. $  rm  ~/table   $  rm  -­‐r  ~/bedroom   $

     rm  -­‐r  ~/living-­‐room   敮嫅։
  6. The File System • The root directory • Other partitions

    are “mounted” • Things have their places • Names are case-sensitive
  7. / ├── bin ├── dev ├── etc ├── home │

    └── pi ├── lib ├── media ├── opt ├── root ├── tmp ├── usr └── var
  8. $  groups   pi  adm  dialout  cdrom  sudo  audio  

    video  plugdev  games  users  netdev   gpio  i2c  spi  input
  9. $  groups  pi   pi  :  pi  adm  dialout  cdrom

     sudo   audio  video  plugdev  games  users   netdev  input  spi  i2c  gpio
  10. $  cd  /var   $  ls  -­‐l   total  102436

      drwxr-­‐xr-­‐x  8  root  root    Aug  16  05:17  log   drwxrwsr-­‐x  2  root  mail    May    6  22:12  mail   -­‐rw-­‐-­‐-­‐-­‐-­‐-­‐-­‐  1  root  root    May    6  23:29  swap   drwxrwxrwt  2  root  root    Jan  11    2015  tmp
  11. $  cd  /var   $  ls  -­‐l   total  102436

      drwxr-­‐xr-­‐x  8  root  root    Aug  16  05:17  log   drwxrwsr-­‐x  2  root  mail    May    6  22:12  mail   -­‐rw-­‐-­‐-­‐-­‐-­‐-­‐-­‐  1  root  root    May    6  23:29  swap   drwxrwxrwt  2  root  root    Jan  11    2015  tmp
  12. / ├── bin ├── dev ├── etc ├── home │

    └── pi ├── lib ├── media ├── opt ├── root ├── tmp ├── usr └── var Superuser’s home directory!
  13. $  groups  pi   pi  :  pi  adm  dialout  cdrom

     sudo   audio  video  plugdev  games  users   netdev  input  spi  i2c  gpio
  14. $  cd  ~   $  git  clone  https://github.com/raspberrypi-­‐ tw/workshop.git  

    $  cd  workshop/gpio-­‐tutorial-­‐03/02_2-­‐ led_blink/led_blink.py   $  ls   led.py
  15. HJUDMPOF 䭡頺♧⦐(JU墂呪䏨 HJUBEE墂呪 䪾墂呪⸈Ⰵ墂呪䏨 HJUBEE〳⟃♧妄⸈Ⰵ鿈墂呪 HJUDPNNJUN鏽鎹 ⸈Ⰵ♧⦐晝劥 HJUTUBUVT 叆溏湡⵹涸墂呪䏨朜䢀 HJUEJ

    叆溏湡⵹墂呪䏨ㄤ♳⦐晝劥⛓꟦涸䊴殯 HJUMPH 叆溏晝劥鎹ꏗ HJUQVTI 㼟劥㖒墂呪䏨♳⫄荛黇畮 HJUQVMM 刿倞劥㖒Ⰹ㺂
  16. Boot Sequence • Load the kernel (details omitted) • Prepare

    the system • Start services • Run custom startup hooks • User log in
  17. Boot Sequence • Load the kernel (details omitted) • Prepare

    the system • Start services • Run custom startup hooks • User log in
  18. $  ls  -­‐d  /etc/rc*   /etc/rc0.d    /etc/rc1.d    /etc/rc2.d

      /etc/rc3.d    /etc/rc4.d    /etc/rc5.d   /etc/rc6.d    /etc/rc.local    /etc/rcS.d
  19. $  ls  -­‐d  /etc/rc*   /etc/rc0.d    /etc/rc1.d    /etc/rc2.d

      /etc/rc3.d    /etc/rc4.d    /etc/rc5.d   /etc/rc6.d    /etc/rc.local    /etc/rcS.d
  20. $  ls  -­‐A  ~   .bashrc      .bash_logout  

       .bash_profile   .profile   $  ls  -­‐d  /etc/profile*     /etc/profile    /etc/profile.d
  21. Summary • Startup • Run levels • Single-user and multi-user

    mode • Login shells and non-login shells
  22. 倰ぢ꒳ 獵⹛康垦 1H6Q 1H%O )PNF &OE 獵⹛康垦 ^O 㶸墂 ^R

    Ꟛ㉬墂呪 ^X 鷎ⴀ剚鑉㉏僽や⮭㶸墂呪 ^W 䵃㼦 ^K 䭡頺♧遤俒㶶 ^U 顦♳⛓⵹䭡頺涸俒㶶