Unix Course: Introduction, Shell Commands – Lecture 1

The inside of Athena Unix

A. Course Outline
   1. Advanced use of the UNIX shell
   2. The internal workings of the mail system
   3. The notes teleconferencing system
   4. Networking
   5. Distributed File Systems
   6. Security
   7. Kernel
   8. The Ingres Database
   9. System Administration

B. UNIX from the system’s point of view
1. Jobs, Programs and Processes

a. What is a program?

A program is a sequence of instructions or commands which tell the computer how to accomplish a given task.  Under UNIX, this can either be a program which has been compiled, or it may just be a sequence of commands that you would normally issue to accomplish the task.  The latter type of program is often called a shell script.

b. What is a process?

A process is an invocation of a program.  If you run finger twice, each time you ran it, a new process was created.

c. Programs and processes encountered when logging in

1. getty
This process sits watching a terminal until someone  types something.  When someone does, it starts a login process.  Getty runs underneath another process                called init.

2. login
 When login is first called, it is given the username which you typed into getty.  It then asks for your password, checks it, and if correct performs the  steps of logging you in.  These include updating the wtmp and utmp files (Who is loged in), starting a shell (or whatever is listed in you /etc/passwd entry), giving your process the correct groups, and setting ones UID correctly.  If the password was incorrect (or if the user ID is invalid), login will  ask for your user id again.

3. init files
Once your shell has started, it reads several files from which it executes commands.  If you are running the cshell, .login and .cshrc are executed.  If you are running the bourne shell, .shrc and .profile are run.
      
d. What is a job?
The definition of job is not very clear.  In many cases you will see the term used instead of process.  Another common use of the term job is as a “session”.  In other words, everything being done by a given user from a given terminal.

 
2. Programs v. System Calls

One distinction which I want to make clear that is very important in understanding UNIX (or any other operating system for that matter) is the difference between a command and a system call.  A command in UNIX is usually a program which does something.  The command, in turn, executes system calls which actually perform the actions. 

D. The Shell

The following commands are built into the shell.  They are different than must Unix command in this respect since command such as cp and rm are actually separate programs.

1. Shell Commands
. alias    – Declare an alias for a command
. bg       – Run a process in background
. cd       – Change directory
. eval     – Evaluate an shell expression
. exit     – Exit the shell (killing it – must not be login shell)
. fg       – Run a process as your foreground process
. history  – Display recently executed commands
. jobs     – List processes which are children of the shell
. kill     – Kill a process
. logout   – Log out
. nice     – Run a command with a higher niceness     
. rehash   – Reinitialize table of commands
. set      – Set a shell variable
. setenv   – Set an environment variable
. source   – Take commands from a file
. stop     – Stop a process
. suspend  – Stop the shell
. umask    – Set default value for protection
. unalias  – Remove an alias
. unset    – Unset a shell variable
. unsetenv – Unset an environment variable

Hacked-up displays – Geneva airport

Today, I attended a business meeting in Geneva, and on the way back, noticed the info panel at the airport was on a bit of a vacation. geneva_airport

TomTom’s hidden all-terrain mode

Sometimes, I feel like a human GPS navigator. And there are probably many more of us out there. Ever get a call from your wife, asking you to direct her to some remote place she is trying to drive to? My solution was to get a TomTom 500 navigator for her birthday. It comes with the maps for Spain in full detail, and a basic map of Europe, with main roads and cities. It can also be used as a Bluetooth handsfree for your mobile phone, so it’s quite a convenient device.

We set about trying it during a trip to visit my mother – since I knew the way, it would be a good sanity check on the navigator’s ability to lower our phone bills. When I told it where we wanted to go, and it told us to turn west instead of east, I started imagining what would happen. After a few minutes of following the navigator’s instructions without even looking out the window, this is where we ended up:

tomtomYes. It wanted us to go up a dirt path that only horses (and fit ones at that) can manage. Take a close look at the full-resolution picture, and judge by yourself.

After turning around, and following the route we always take, we had to turn off the sound for almost half the trip, as it kept insisting that we should “turn around as soon as possible” so we could take the easy-going dirt track.

GPS navigator manufacturers only make the devices, but not the data that’s in them. There are a few companies, such as Navtech and TeleAltlas, who take care of that, and license the use of the data. In this case, it seems that overzealous cartographers had simply taken anything that looked like a road in survey maps, and turned them into navigable paths. The result is my unfortunate experience. The collateral is that my wife doesn’t trust the device, unless it’s for navigating within city limits – thus limiting it’s usefulness, and not limiting my phone bill so much.

Hacked-up displays – Barcelona Metro

I’m going to start a section called Hacked-up displays, or HUDs for short.
barcelona_hudHUDs are public displays, screens and panels which are caught showing something they shouldn’t be, by fault or by hack. There is a classic roadside HUD here, as a good example. I’m posting this phonecam pic of an infoscreen at the Barcelona Metro, which usually shows videos, news and other stuff to bored passengers waiting on the platforms – and with which DirectPlay was not happy.

The rules:

1. Any image of a HUD is allowed, unless it contains foul language and/or explicit images.
2. Pics taken must be submitted with a short explanation of context, or if a hack was involved, a more detailed story of events.
3. Please advise if you want credit or want to remain anonymous. Confidentiality of submissions is guaranteed (thanks Apple!)