Exercise: you have 2 minutes to go around the room and identify all networked devices, or those that have the capacity to be networked.
This assumes you have a ready-to-go SD card with Raspbian cloned onto it. If not, see here for how to set one up.
The most direct way to interact with the computer.
... a shared language across many machines. You are talking to the computer and it is talking straight back to you. You ask and the computer responds. You can take the output of one program and make it the input of the next program. It allows you to automate the operating system (rather than the computer turning you into a proletarian clicking machine). The command line is far from going away. As computers get smaller, the command line interaction becomes a dominant model. 1
As the Critical Engineering Group describes it:
You learn to interact with vastly more devices than before, whether it’s a web server, Internet applicance, Wifi router, autonomous robot, Raspberry Pi, macOS or Linux laptop.
A computer doesn't need to have a screen, keyboard or even be on the same continent to be interacted with - the case for a growing family of devices comprising the so-called Internet of Things.
Rather, by developing an ability to talk to computers - with them talking back - any UNIX or UNIX-like machine can be made a drone, performing automated tasks on their owner's behalf.Using only the Command Line, learn how to:
- Use tiny computers without screens or keyboards
- Walk through a computer's files, reading contents
- Install, uninstall, start and stop programs
- Create, rename, copy and remove files and folders
- Command remote computers over encrypted channels
- Write powerful and portable scripts
- Chat privately with friends on servers
- Implement automation, make remote machines slaves
- Shutdown or reboot computers over the network
- Capture images and video from cameras
- Stream, encode and post-process audio and video
- Create and edit text files on remote machines
- Log key-presses, sensor data and other events
- Filter, process and stream program output
- Customise and localise your CLI environment
- Manage users and permissions
- Archive and encrypt files and folders
- Send email, serve files and web-pages
- Securely move data across networks
- Enable and disable hardware and devices
- Scare friends and family
We don't have time for all of that, but it's certainly doable within a term or two. But here are the
sudo raspi-config to finish setting up your Raspberry. Make up your own hostname (=the name of the system as it appears on the network) to be able to identify your device on the network; enable remote access via ssh, change your password, set boot options, etc. This is also where you can set the locale and keyboard to Germany.Start up your terminal and type pwd.
This command asks the shell to "print working directory".
The shell should give you some output, like /home/pi.
That's where we are right now!
The string /home/pi is a file path representing our current location in the file system, just like navigating the folders in Apple's Finder.app, or Windows Explorer, etc.
Typically, on Unix systems the / is the root directory.
All other directories are organized below it.
ls (listing)ls -a (-a is a flag, it adds an option to the command, in this case to show all files including hidden ones)ls --help (you can use --help with almost any command!)cd Desktop (change directory)cd ..tab complete and up arrow for command history!!ctrl+shift+C / ctrl+shift+VLet's make a test directory to play in:
mkdir testcd testNow lets create a file in it:
touch helloworld.txtnano helloworld.txt (nano is a simple text editor that lets you create and edit text files. Exit and save with CTRL-X, confirm with Y)lscat helloworld.txt (cat displays one or more files in the terminal)Play with it:
mkdir newcp helloworld.txt new/helloworld.txt ("copy")cd newmkdir new2mv helloworld.txt new2/helloworld2.txt ("move" changes location and/or name, be careful!)cd new2rm -i helloworld2.txt ("remove", be careful there is no recycle bin!)A good way to get familiar with the commandline is with some fun and games! These demos install little toy programs (note: demos based on Ubuntu. Only available on Linux.)
Train:
sudo apt-get install sl (sudo gives you super rights, apt-get install coolnewsoftware installs new software, in this case something called "coolnewsoftware" slWise cow:
sudo apt-get install cowsaycowsay "Hello world!"cowthink "Grass?"sudo apt-get install fortunefortunefortune | cowsay (pipes | send output to another command)cowsay -lfortune | cowsay -f dragonClassic games:
sudo apt-get install bsdgamestetris-bsd (see full list)Or watch Star Wars: telnet towel.blinkenlights.nl. You'll probably have to install telnet first, see above: sudo apt-get ...
ifconfig gives you info about your network setup. Ignore most of the resulting text. The second line from the top shows your IP address in the 'inet addr:' entry. It's string of 4 numbers separated by a dot. At KHM they are typically starting with 172.17.***.*** or 172.18.***.***ssh pi@172.1*.*** (Enter the complete IP address of your Raspberry.) ssh pi@172.1*.*** (ask for the correct IP address). If they’ve enabled SSH access you have full control of their machine.Ideas for next week: