Introduction to Linux/Unix
David Morgan
U. C. L. A. Extension - X417.31
see syllabus for email address

Administrative links


Grade reports

Course outline

DETER net testbed
  get/use an account
  news report (pbs)

Informational links

Remote Unix access with ssh

Variations among Unixes

Fedora vs Enterprise

vi - the Visual Editor

Line termination

Fundamental Unix Commands

System calls

"data dump" programs

Shell scripting:
Shell script basics

Shell programming:
if and while

Shell scripting links

Cheat sheet - bash shell

Filesystem analysis

Files vs devices

File permissions

FALL 2018
Mondays 6:30pm-10:00pm
UCLA Extension Lindbrook Center

10920 Lindbrook Drive

This Website ( will be used extensively to communicate with you. Announcements, grade reports, and assignments will be posted here. The site can be viewed from an internet-connected browser anywhere. You are responsible for awareness of the information posted here.

Course outline - with topic coverage by week. All corresponing readings, , homework assignments, and in-class slides I will use are here. You can preview or review the slide lessons at any time, or view them while I am presenting them in class.

Syllabus - containing my email address, specification of required textbook, recommendation of other useful books, and some policy information.

Thank you - for your interest in linux and this course. I enjoyed our time together. (12/10)

Related linux/unix classes - that may interest you (and that I teach). This class qualifies you for any of them.

 System Administration  - continuation of my introductory course with system administration focus
 Advanced Linux/Unix: Networking - networking, emphasizing the linux platform commands to "do" it
 Shell scripting - further depth into the subject and the practice
 Advanced Linux/Unix: Security - theory and practice

Schedule: the courses tend to be offered every other quarter. There may be variations but this is the general expectation. If you are interested please "stay tuned" to the class schedule as UCLA Extension publishes it. Or if you email me I can let you know what we are putting in the pipeline. None of these is scheduled for Winter, but I expect one or more in Spring.
System administration -  summer 18 (from 6/27)
Networking -  not yet scheduled, but possibly Summer 18 or Fall18
Scripting - spring 18 (from 4/3)
Security - summer 18 (from 6/26)


System administration - see website from most recent quarter and course outline
Networking - see website from most recent quarter and course outline
Shell scripting - see website from most recent quarter and course outline
Security - website from most recent quarter. This course was taught for the first time recently, derived from extensive materials I have compiled from teaching security elsewhere, is lab-heavy. (3/19)

An "important" utility - the GNU hello program. (3/19)

"make" utility's logic in shellscript form - as a point of interest. I came across it recently.

      makecmd() {
      # read the Makefile's rule, storing the target and dependency list separately
      # check each dependency for greater recency than the target
      # till you find one that's newer, if any
      # if you do, go through the list of commands executing each,
      # then truncate the dependency comparisions (to rebuild, you only need to do so once)
      read target colon sources      

      for src in $sources; do
        if [ $src -nt $target ]; then
                while read cmd; do
                        eval ${cmd#\t}

 from Learning the bash shell, Newham and Rosenblatt, O'Reilly, p. 183 (12/10)

Final - is a take-home exam. It is multiple-choice. Submit your answers to all the questions following these preparation and submittal instructions (you will use ftp to deposit your answer file in your "assignments" subdirectory on "" machine; create it if it isn't already there; here's how. See posting entitled "Remote Unix system" at the bottom of this page.). Please name your file "final.txt". I will grade these using an automated script, so the format of the answer is critical to intelligibility, as is the case (lower) of the filename. -due on by end-of-day Monday, December 17 (one week after last class meeting).
Here are a few give-away answers to questions that we did not cover explicitly or to my satisfaction. Please be sure to enter these free, correct answers in your "final.txt" file and you will get the credit for them.
Special questions -
 question 2 (c)
 question 4 (c)
 question 6 (d)
 question 50 (d)
Please answer all the other questions normally, according to their printed numbers. (12/10)

Final - will be a take-home exam., multiple-choice. Will be posted soon, and due one week after the last class meeting. (12/3)

Homework -
do - the exercise in course outline topic 8 entitled "fork/exec/processes"  due in class to-be-determined Monday, December 3.
read - the readings and 
view - the videos
  about fork() and exec() in linux, in couse outline section 8 Reading column
anticipate next topics
- readings in sections 9 (devices/filesystems) and 10 (software installation/maintenance)
re-examine - the graphic below headed "Devices, etc." It gives important underlying understandings about what filesystems are and where they fit into the bigger picture.  (11/12)  (11/26)

Our xfs filesystem discovery in Winter 2016 class - we learned that the classroom machines (CentOS image) had the xfs filesystem, not ext2, on their root partitions. And that the inode of the root directory is not necessarily number 2, as in ext2. Instead we observed that ls reported 128. Is that meaningful? If you insert a USB flash drive formatted with vfat (i.e., fat32), ls will report inode numbers for the drive's root directory and other files. vfat however, unlike, ext2, does not have/record/implement/know inodes. Are those reported inode numbers meaningful? How seriously should we take the reported inode numbers for filesystems other than ext? Here's some information about xfs. (11/20)

And here's my dangerous script for successively creating vfat, ext2, and xfs filesystems on a flash drive, mounting it, and querying what the inode number is for the created filesystem's root directory.

mkfs has a -t option to specify the type of filesystem it should make. For example, you could give it " -t ext2 " or " -t fat ". According the your choice, there are specialized binaries that make the filesystem and mkfs calls the right one for the job, for example mkfs.ext2 or mkfs.fat. Get a rough idea of what filesystems mkfs can create for you, by looking for such specialized binaries with the command

  locate mkfs | grep bin


DETER homework - 
- this exercise on comparison among different flavors of UNIX. This is to be done on DETER, remotely, using the DETER accounts issued to you in class. (If you did not get one, send me an email address and that will enable me to create one for you.)
I've scheduled "reservations" for our class at DETER during the period from now through sometime shortly after our course ends. You can do it at your convenience any time during this interval.
additional instructions:
Important project name adjustment: you need to make an adjustment. Our project is known to DETER by the name UCLALin. The instructions don't know that, they think it's SMC-CS41. Wherever you see the latter in any instruction, please substitute the former.
when to work - now through the end of the course
what to turn in - as the product of this assignment, answer the 7 multiple-choice questions at the end of the exercise write-up. Please submit answers to them onto the remote Unix machine using these preparation and submittal instructions. Please name your file "comparisons.txt".  - due in your assignments subdirectory on server by December 17 (one week AFTER CLASS END DATE) (11/26)

Remaining meetings -
 Monday 26 Nov 2018
 Monday 03 Dec 2018
 Monday 10 Dec 2018

Grades - have been published at the link entitled "Grade reports," at left. Includes the two shell scripts. (11/12)

Homework -  
do - the 2 shell scripting programs from course outline topic 7 due on unexgate server by end-of-day Sunday, November 4 November 11.
read  - readings from course outline, in order of class coverage
topic 6 - about the X Window System based graphical interface, then
topic 8 - about processes (10/22)

Next topic:
Demonstration programs for unix process mechanism "fork/exec"
- If you wish to examine or experiment, here is the series of 11 programs used in my slides demonstrating the workings of fork and exec. Source code files for these programs reside on the server. Individually, they are there under the same names by which they appear in the slides shown in class: fork1.c, fork2.c,..., fork11.c. Collectively, the same files are consolidated in They sit in /home/public. You can use them either on the server, logging in to your account there to do so and copying them into your home directory. Alternatively, you can transfer them by scp/sftp, as user "public," to a linux computer of your choice elsewhere and work with them there instead [if you wish to do this, email me for the password of account "public]. The related slides are at links, lower left, entitled "Processes" and "Homemade shell". If you download these source files you will want to compile so you can run them. The command to compile would be, for example:

  gcc  fork1.c  -o  fork1

and then to run"


The summary of the point of these programs is:

Version Purpose
fork1 shows fork, demonstrates that 2 processes result
fork2 shows PIDs (process id numbers) of these processes, and that they're distinct
fork3 shows fork's return value to the child copy (zero) and its return value to the parent copy (child's PID)
fork4 shows how to code differentiated behavior via an "if" structure conditioned on fork's return value
fork5 incorporates an exec call in the child
fork6 introduces exit call in child and wait call in parent, to give orderly discipline to their relative timing
fork7 gets the name of the program to be exec'd from the user via the command line
fork8 interactively gets the name of the program to be exec'd by prompting user
fork9 puts the activity inside a loop to extend it to second, third, fourth,... commands
fork10 shows a zombie process
fork11 shows an adopted child, init process as its step-parent after being pre-deceased by its original parent


Grades - have been published at the link entitled "Grade reports," at left. Includes the tech support request assignment. (10/29)

Grades - have been published at the link entitled "Grade reports," at left. Includes the permissions assignment. (10/22)

Homework -
- topic 4 readings about the vi editor
- readings from course outline topics 5 and 7, about the shell and shell scripting. The textbook's chapters 9 and 27 are about the shell. Chapter 9 talks about the interactive features of bash while 27 focuses on the programming constructs and other features more likely to be found in scripts. 
do - I got a de facto request for tech support for our lab. Your homework is to compose an email response to it, explaining what went wrong and how to make it go right, and send the response to me via email. Please title the email "linux support" and I will use an email filter to capture incoming messages by that name. Send it by end-of-day Tuesday October 23 Sunday October 28 .  You are the support technician. Here is the request I received:


A pretty good linux book that was brought to my attention by a former student. (10/15)

Homework -
- topic 3 readings about the permissions mechanism of the ext2/3/4 filesystem
do - exercise in topic 3 " Homework" column at link entitled "permissions"
(the password for all the accounts under which you are asked to log in is given in class). 
Will be due (on the remote server) end of day Tuesday, October 16. (10/8)

Homework - 
read - generally, your homework is to continually follow along and do the reading week by week as we cover the course outline. Currently that would amount to doing the readings for the first 3 course outline section, except the part on bootloaders (glance at it).
read - the description of the mechanics of using the remote unix server at the link below entitled "Remote unix server." Read all the other information posted in this column. It is foundation information for beginning the course.
do - the  "Linux commands" exercise in course outline topic 1. It will result in a file by the name "fundamentals" in the "assignments" subdirectory of your home directory. I grade it with a script hard-coded for that name and location so make sure it has the right name and is in the right place so my script doesn't overlook it. Due to be on remote server by end-of-day Tuesday, October 9 (one day following our next class meeting)
anticipate - the upcoming exercise at the "permissions" homework column link in course outline topic 3. (10/1)

systemd's Windows equivalents -  Different platform, same concept. In Windows also, you can launch and terminate a service whenever you want, what systemctl calls "start" and "stop," and you can set one to launch or not as part of system boot, what systemctl calls "enable" and "disable". (10/1)

Data dump program category - in class you will see me use xxd sometimes, to legibly display the bytes from some source in all their precise binary glory-- maybe a master boot record I obtained from the hard disk using the dd command, or a data stream snatched from the network interface card by Wireshark or tcpdump for example. Another such command is od. Here is some information about od and other data dump utilities. They can be useful; you should be able to use them at basic level and understand their output. (10/1)

Nuts and bolts - some tidbits worth more than their weight
 - filename completion 
 - command recall with ctrl-r's incremental reverse search of history
 - "the root directory" versus "the directory root"
 - virtual terminals with ctrl-alt-Fn keystrokes
 - clear screen shortcut keystroke (bash shell): ctrl-L  (10/1)

Take-away from presentation on bootup, initialization, and service management:




How to access your individual account on the class Remote Unix system.

Handout - explaining use of the computers in our classroom.

Dump of a GPT header, part of the GUID partition scheme. This newer technology contrasts with the old, original, MBR-based scheme.

Devices, etc. - understanding distinctions among these entities is fundamental to understanding what you are partitioning when you partition, what you are formatting when you format, what you are mounting when you mount, what you are encrypting when you encrypt. People often confuse them.

Western Digital manufactures hard disks
Given a hard disk, grub manufactures a partition table
Given a partition table , fdisk manufactures a partition
Given a partition, mkfs manufactures a filesystem
Given a filesystem, vi manufactures a file 

Apple's launchd - the inspiration for systemd. You can see the strong parallels between this article's description of launchd and our discussion of systemd.

FreeBSD startup - I logged in. Note the greeting I got.

This reflects operation of the SysV system initialization method in FreeBSD.

Homework - see course outline, topic 1. Do the reading and homework shown there, except let's defer the "Linux commands" portion of the homework till next week pending explanation of basic commands, and the assignment, in class. You may wish nevertheless to read over "Linux commands" in anticipation. 

Replacing BIOS - including replacement for the MBR disk scheme. Necessitated to enable support of drives over 2TB. Dubbed "extensible firmware interface." Here's a relevant article.

Information sources about linux - see the latter several slides in the presentation at the link "Intro/installation" 

Sobell textbook author Mark Sobell has a website

Cheat sheet - for the bash shell, compiled by a student from the bash man page (help file). 

1985 roundtable discussion - will Unix become the next MS-DOS?
listen to our textbook author Sobell, Gary Kildall who originated the CP/M operating system for early microcomputers, and others discuss the evolution and statusof Unix as of 1985. 

Request - please don't change the passwords on the "root" or "student" accounts of the classroom workstations. 

Using ssh (secure shell). ssh is an important tool you will use for interacting with remote computers. For that you will need an ssh client. There are a number of ssh client alternatives.

Running linux at home.
Bootable Fedora 23 on USB for you to burn - I made a suitable, persistent image recently. If you bring an 8GB or larger USB flash drive to class (empty of anything you care about) we can burn my image to your drive for you to boot from in the future.
<<-- if anybody wants this tell me so that I bring the needed source machine-->>

Milestones in the history of computation

Tommy Flowers

Colossus - 1944



Eniac - 1946