RASPBERRY PI LINUX LESSON: From 1st to 15th
Lesson1: Intro
http://www.toptechboy.com/raspberry-pi/raspberry-pi-linux-lesson-1-introduction-to-the-pi/
Lesson2: Formatting SD Card and Installing Operating System
1, insert sd card into adapter and then PC; use sdFormatter to clear the sd card
2, System download. https://raspberrypi.org/downloads/
Downloads NOOBS
move all files into SD card, and reinsert SD card into Rasp
3, Plug keyboard and mouse into USB mounts of Rasp, connect Rasp with a monitor, and start system with power on
4,Insatll
booting up
Enable boot to
boot in console
reboot
user name pi
passwords raspberry
5, ready to start working
6, shut down (kill it): sudo halt
7, learn how to back up:
win32 disk imager
reinsert SD card to PC
create a new folder for backup
Lesson3:
1, where am I in file system?
2, navigating:
ls
cd ..
cd python_games
3, What's in the root? What's in some folder ?without navigating
ls /
ls /home/pi/python_games
Lesson 4: Creating and Editing Files with Nano Command
1, operating folders : three types:
- current,
- ".." for higher level
- /home/pi/??? for absolute path
mkdir ????
rmdir ???
2, operating files
nano ???.txt and type documents
LESSON 5: Naming Files and Folders
don't use space in your file name!
Case-sensitive in Linux
- underline to replace spaces
- bumpy text: Use upper case first letter starting from the seconde words
- Dash to replace spaces
LESSON 6: Moving, Copying and Deleting Files and Folders
mv ??/xxx.txt ss/xxx.txt
mv ??/xxx.txt ss/yyy.txt (rename at the same time)
cp ??/xxx.txt ss (copy, so we don't need a new name)
cp ??/xxx.txt ss/yyy.txt (but we can still rename the file)
in nano: ctrl+o and yes to save, and ctrl+x to leave
delete one folder, we have to first remove all the files in it, BUUUUUUUT?
But , we can still do it by add -r
LESSON 7: Using the Wildcard
have several files here.
move all dog?.txt to another parallel folder
move every file to another folder
LESSON 8: Sending Linux Command Output to Files
one > will overwrite the content of the file
double > will be write after the former content
LESSON 9: Using the Linux Sort Command
- File1
sort the file
-r means reverse sort
sort and rewrite to other files
- File2
without -n, linux doesnt know you want it to sort by number values
-n -r: number and reverse
- File3
-M: means the month sort. Even tolerate a small typo...
LESSON 10: Safely Shutting Down the Raspberry Pi
http://www.toptechboy.com/raspberry-pi/raspberry-pi-linux-lesson-10-properly-and-safely-shutting-down-the-raspberry-pi/
The simplest way to shutdown the pi is with the command:
$ sudo halt
Instead, if you want to shutdown and then reboot, you can use:
$ sudo reboot
These two commands will take care of things most of the time. If for some reason sudo halt does not work, you can try the following:
$ sudo shutdown -h now
LESSON 11: Fixing Problem with Keyboards in US
make sure here's a lowercase "us"
LESSON 12: More on Linux Path Names
"/" means
LESSON 13: Using the Linux Pipe Command
LESSON 14: Using Linux Tee Command
print result using pipe,
we can write results to files with ">" and ">>"
but what if we would like to both screen print and write results to a file?
examine file content by "cat"
get them both!
another example:
but this operation will overwrite files, what if we want not to overwrite? APPEND!
LESSON 15: Using the Linux Find Command
find . -> search current folder
-name -> search by name
"xxx.ttt" ->
search with wildcard under /home/pi/ :
use "~"