-
Notifications
You must be signed in to change notification settings - Fork 8
Review UNIX (and preview the IxE filesystem)
Let's go over a couple of basic commands to help you move around the Linux filesystem. Right now, you are in your home
directory. Directories are basically the UNIX name for a Folder. We will take a look at the file structure for our example "Hello You" project.
To see what is in the directory you can type ls
pi@ixe-05 ~ $ ls
audio helloYou node_modules Public Videos
Desktop ixe-creator-webpage node_tests python_games
Documents ixe-project-base Pictures sketchbook
Downloads Music processingJSTest Templates
All of the listings in the home
directory are other directories. Lets take a look inside one.
pi@ixe-05 ~/helloYou $ ls helloYou
helloYouSketch node_modules package.json public README.md server.js
This shows us what is in the helloYou directory, but our working directory is still the 'home' directory.
To change the working directory, type cd [directory-name]
pi@ixe-05 ~ $ cd helloYou/
pi@ixe-05 ~/helloYou $
The heading of the line (~/helloYou
) tells us what directory we are in.
We can see what is in the helloYou
directory using ls
again.
pi@ixe-05 ~/helloYou $ ls
helloYouSketch node_modules package.json public README.md server.js
Here we see a mix of directories (public
) and files (server.js
). server.js
will be the webserver we will run with node.js. Inside the public
directory are the files we will serve as our webpage.
Lets look in the public
directory and see what is there. (Pro-tip: Use the tab
key to autocomplete listings).
pi@ixe-05 ~/helloYou $ cd public/
pi@ixe-05 ~/helloYou/public $ ls
client.js index.html
We can see two files here, client.js
and index.html
. client.js
will control the interactivity and messaging for our webpage. index.html
is the webpage markup or content of the page.
To move up 1 level in the directory use cd ..
where the ..
means up one level. You can list the files to check you are in the correct directory.
pi@ixe-05 ~/helloYou/public $ cd ..
pi@ixe-05 ~/helloYou $
pi@ixe-05 ~/helloYou $ ls
helloYouSketch node_modules package.json public README.md server.js
Though we often traverse the directory structure by going into and out of directories one level at a time, we can actually jump to any directory if we know the complete path or the path relative to the 'home' directory.
pi@ixe-05 ~/helloYou $ cd sketchbook/blink
pi@ixe-05 ~/sketchbook/blink $ ls
blink.ino build-micro makefile
If you get lost, you can type 'pwd' to get a listing of your absolute path in the directory structure.
pi@ixe-05 ~/sketchbook/blink $ pwd
/home/pi/sketchbook/blink
You can type 'cat [filename]' to look into a text file.
pi@ixe05 ~/sketchbook/blink $ cat blink.ino
// Blink sketch
int led = 10;
void setup(void) {
pinMode(led, OUTPUT);
}
void loop() {
digitalWrite(led, LOW);
delay(1000);
digitalWrite(led, HIGH);
delay(1000);
}
To get back to the home directory no matter where you are in the file structure, you can just type cd
without a path
(the location of the directory you would like to change to) or cd ~
pi@ixe-05 ~/sketchbook/blink $ cd
pi@ixe-05 ~ $
pi@ixe-05 ~ $ ls
audio helloYou node_modules processingJSTest Templates
Desktop ixe-creator-webpage node_tests Public Videos
Documents ixe-project-base oldconffiles python_games
Downloads Music Pictures sketchbook
###8. Super User mode
###9. Halt
It is important that you shut down your IxE properly to avoid damaging the filesystem. To shutdown, use the halt
command.
sudo halt
###10. Other Unix commands Here is a Unix cheatsheet that shows other basic commands worth knowing about.
IxE Workshop
For Novices
Post Novice
0. Logging in as Pi
- Preview the larger IxE image
- [Project Ideas](Project Ideas)
Also [Related Links](Related Links)