Raspberry Pi (2): Terminal Commands and Navigation

Reference: https://pythonprogramming.net/terminal-navigation-raspberry-pi-tutorials/?completed=/remote-access-raspberry-pi-tutorials/

Code – Use

  1. pwd – print working directory  defacult is /home/pi, also is ~
  2. cd – change directory: cd /home ; cd ~ ; cd / tab (help to fill possible command) ; cd .. (go back one level of directory); cd ../../ (go back two levels of directories)
  3. ls – list contents of directory
  4. mkdir – make directory: mkdir exemple (make example folder)

Test Python

  1. nano test.py
  2. print (‘hi’)
  3. ctrl+x; Y
  4. python test.py

Download from Internet

  1. wget https://www.pythonprogramming.net/static/images/categories/3D-Matplotlib.png
  2. sudo apt-get install git
  3. sudo apt-get autoremove
  4. git clone https://github.com/vinta/awesome-python

Remove file/directory

  1. rm 3D-Matplotlib.png (case sensitive)
  2. rmdir new
  3. rmdir awesome-python
  4. rm -r awesome-python (force removing)

ls

  1. ls -a ; ls -all (show all contents, including hidden contents)
  2. ls -l (contents in list format)
  3. ls -al (combine the above attributes)
  4. flag: – for short hand and — for full word
  5. ls –help

reboot and shut down raspberry pi

  1. sudo reboot
  2. sudo shutdown -h now
  3. sudo shutdown -r now