Wednesday, August 15, 2012

Raspberry PI – Learning LINUX

A reader commented: “The good and bad is that it uses Linux and various languages that look fairly cryptic to me.”

Yes, there is a bit of learning curve with Linux, but if you liked the old DOS command world, Linux is learnable. That is what I like about the rPI, there seems to be lots of support for it and if 100's of Ks of them get out there, there will be lots of howtos and examples.

You can read a lot about LINUX here (and in the links from there):

All LINUX versions (aka distributions or distro's) include at least a command line interface (like good old DOS) and some include a Graphical User Inerface or GUI - the rPI has both.

Most *nix commands are very short: ls, cat, cp, etc. because it started when an ASR-33 was the console of choice! Test - who are these guys:

All Linux configuration stuff is done via flat text files. With a GUI, there are sometimes tools to change the config setting with buttons, etc., but you can do anything on Linux from the command line. When DEC started doing popular OS's for schools, etc like OS-8, TOPS-10, RSTS, etc. the commands were made more human readable like copy, type, etc. Then Bill Gates (who learned to program on TOPS-10) just copied the DEC commands 1:1 with DOS.

When you get the rPI up at the command prompt "$", here are some things to try.

This command will display a refreshing screen with all the running processes (ctrl+C to get out)

  $ top

This command will display commands "apropos" to what you want to do

  $ apropos memory

This will display free memory

  $ free

If you want more detail on any command (enter to go one line down, space to go a page, q to quit)

  $ man free

If you want to edit a file

  $ nano file.txt

If you want to see the contents of a file

  $ cat file.txt

cat is short for Concatenate, the command can be use to Concatenate files, but with one argument just Concatenates a single file to standard output, which is the screen. Every command does a lot of things... it's the UNIX way

Note how you can string Linux commands together, you can even feed output of one to the next. For example

  $ ps -A | grep apache

The ps command will show all running processes with the -A switch The "|" pipes the output of the command to the grep pattern search, which searches the output for the pattern "apache" The result is that it will show you the process detail of all the web server processes A Process is just a program that is running in the background, with no I/O to a terminal.

   $ sudo (any command) 

gives the next command root privs, the "pi" user does not normally have the ability to accidentally or on purpose change system files. This is one of the things that makes Linux a lot more secure and safe than Windoze

Here is a tutorial of more commands:

Ignore the part about "Starting an Xterminal session" in the intro, when you boot the rpi you are already at the command line.

I spent MANY hours working with UNIX (and other) systems at the command line, only it they used to cost $100's and filled a room. Now the rPI costs $25 and is the size of the credit card. I am amazed!

Eric Pierce VA3EP - See the Disclaimer in the Introduction

© Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", 1952-2099. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", with appropriate and specific direction to the original content.

No comments:

Post a Comment