CS41 - Linux Workstation Administration
David Morgan
Santa Monica College
see syllabus for email address



Administrativa

Syllabus

Grade reports

Course outline

SMC dates/deadlines


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


Information


Linux links

Remote Unix access with telnet

Remote Unix access with ssh

Variations among Unixes

vi - the Visual Editor

Line termination

Using ftp

Fundamental Unix Commands

System calls

File permissions

Filesystem analysis

Cheat sheet - bash shell

Shell script basics

Shell programming:
if and while

Shell programming book

 

SPRING 2019
Section 4098 6:45p - 9:50p Fri Bus 263

This Website (http://homepage.smc.edu/morgan_david) 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.

Thank you - for your interest in the course and the subject. I enjoyed the class. I hope it will prove useful to you. (6/7)

If you want to learn a lot of linux in a little time - I recommend SCaLE 18x (the Southern California Linux Expo) held each March. It's a 4-day educational linux-fest held in Pasadena. It's intense, inexpensive, local. (6/7)

Other courses I teach - are known to you from the main website front page. There, you can see the class-specific pages from recent semesters for a concrete idea of their exact content (particularly see the course outlines).

CS40 - Operating Systems

CS70 - Network Fundamentals and Architecture

CS75 - Network Protocols further depth and variety on the topic beyond CS70 (2hr credit)

CS78 - Secure Server Installation & Administration
In this class, with cooperation from USC/ISI, we will have accounts on the DETER testbed where we will create remote test networks. 

I also teach related courses at UCLA Extension in linux system administration, linux networking, linux shell scripting, and cyber security. They are more costly than those of community college, but are public and available. (6/7).

Grades - Grades are current, to the best of my knowledge. Please call any anomalies to my attention tonight. They include the DETER homework on "Comparative UNIX." I will accept Comparative UNIX through Tuesday, June 11. Beyond that, tonight's test remains to be factored into your final grade average. (6/7)

Final exam date - Friday, June 7, in our classroom at class time. Please bring a scantron. (5/24)

Grades - updated, includes the fork/exec assignment. Grades are current, to the best of my knowledge. Please call any anomalies to my attention tonight. (5/17)

Additional topics - I plan to add to the course outline to give us, for the next (and last) two weeks material about 1) user account management, and 2) backup. Some of the user management material will amount to review and reinforcement of aspects we have covered (mainly when talking about filesystem permissions). The backup material will cover tar and rsync as means to copy data, and ssh as means to confidentially do so across machines on a network. (5/17)

An "important" utility - the GNU hello program. (5/10)

"make" utility's logic in shellscript form - 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}
                done
                break
        fi
      done
      }

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

Homework
do the reading about the care and feeding of software in section 10 of the course outline. Topic for next Friday. (5/10)

Final exam date - Friday, June 7, in our classroom at class time. Please bring a scantron. (5/10)

Grades - check them please. Have I made all the additions or corrections you may have requested? Please call any anomalies, omissions, mistakes to my attention. (5/10)

If you do not have a DETER account, as issued to those students who were in class last Friday, please get one tonight. We can create accounts during the break or after class. (5/10)

Homework
do the "fork/exec/processes" exercise in the homework column of section 8 of the course outline - due on paper in class 5/8.
read - the material about "time" (setting clocks and scheduling jobs) in the reading column of section 9 of the course outline. (5/3)

Grades - updated, link at left entitled "Grade information." Please call any anomalies, omissions, mistakes to my attention. (5/3)

Upcoming Homework - will be (I'll cover preparatory material next week):
do the "fork/exec/processes" exercise in the homework column of section 8 of the course outline. (4/26)

Homework
do the reading about processes in section 8 of the course outline. 
do the reading and activities about the X Window System based gui in section 6 of the course outline.  (For the record, since we already covered this last week.)
 (4/26)

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. You can get them by sftp/scp from the home directory of sputnik.smc.edu's "public" account, password is CS78password. Find them under the same names by which they appear in the slides shown in class: fork1.c, fork2.c,..., fork11.c. If you download these source files and want to compile so you can run them, the command to compile would be, for example:

  gcc  fork1.c  -o  fork1

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

(4/26)

Next topic - will be processes, course outline section 8. You should take a look at the reading there. In particular, a series of 3 video links are there under the heading "Videos of optional interest."  They total about an hour running time. They treat the same topic(s) as I will in class. Watching them may help reinforce your understanding. (4/19)

DETER homework
anticipate
- this exercise on comparison among different flavors of UNIX. This is to be done on DETER, remotely. More information will follow but you can examine the assignment now, early. It will be due by the end of the course. (11/3)

Midterm test 4/26 - Will cover commands, permissions, shell and GUI. Please bring a scantron form 882. The test is closed book. (4/19)

Grades - updated, link at left entitled "Grade information." (4/18)

No class April 12 - SMC's spring break is that week. (4/5)

Relevant article I found recently. It talks about exit status, and the use of commands' exit statuses as the basis for "if" branching. It also talks about using the "test" command and its variants to enable "if" to be responsive to numeric and string comparisons, like "if" in most other languages. (4/5)

Next topics - will be the X Window System (gui) in course outline section 6, and processes, course outline section 8. (4/5)

Grades - updated, link at left entitled "Grade information." Includes mock tech support assignment. (4/5)

Homework - 
do the reading and homework in section 7 of the course outline, the 2 scripts due on sputnik end-of-day Tuesday 4/9
(3/29)

Way beyond our level - but worth your attention. The Advanced Bash-Scripting Guide is an extensive and unique collection (few hundred pages) of contributed, clever examples covering seemingly all the scripting features in the "language." Please be aware of it for the future occasions when you may want to find shell script examples of, just about everything. (3/29)

"if" versus "test" in shell scripting - don't get syntaxes confused. Which is the owner of the square brackets? The "condition" expression in an if statement is a command, and standard command syntax includes no such thing as surrounding square brackets for every command! 

(10/13)

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 of tcpdump for example. Another such command is od. Here is some information about od and other data dump utilities. They can be useful. (3/29)

Grades - posted, link at left entitled "Grade information" (3/29)

Homework
read - do the reading about the shell in section 5. Then do the reading about shell scripting in section 7. (We will come back to section 6, about graphical interfaces.)
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. Please send it dmorgan@dmorgan.us (as opposed to my @smc.edu address). Send it by end-of-day Saturday 3/30 You are the support technician. Here is the request I received:

(3/22)

Topics - tonight's primary topic is how filesystem permissions work; secondary is the vi editor. Thereafter, we launch into a discussion of the shell. (3/15)

What's a "shell?"- it's a program that does something definitive that distinguishes it from programs that aren't shells. Editors, similarly, do something distinctive. Compilers do something distinctive. Browsers do something distinctive. You can tell an editor when you see one; it's clear that it isn't a compiler or a browser, based on what the editor does. Shells are equally well-defined, by their clearly identifiable function and behavior.  A shell is a program that does this:

while true (loop forever)
    ask (prompt) the user, "what software would you like to see run?"

    try to find the software that the user tells you
    if you can't identify it
        tell the user so (error message)
        go back to the top of this loop
    else
        cause that software to run
        wait for it to finish
    endif
endwhile 

If it's a shell, it does this; if it does this, it's a shell. The shell is the thing that handles your commands, so a common synonym for "shell" is "command processor." (3/15)

Role and position of an operating system (3.15)

Homework - due by end-of-day Saturday 3/23, on sputnik in your assignments folder. 
do - next assignment is at the link entitled "permissions" in the homework column of the course outline. The passwords for the accounts involved are all "password.UCLA$" and the server on which to remotely do the assignment is sputnik.smc.edu.
read - the "reading" material in Course outline's first 5 sections.  (3/15)

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. (3/15)

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

This reflects operation of the SysV system initialization method in FreeBSD. FreeBSD has not adopted systemd. It is not expected to do so because systemd uses linux-specific facilities. (3/15)

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

 


Man page "section" categorization:

"Each man page should be categorized in a specific section, denoted by a single
character. The most common sections under Linux, and their human readable
names, are...:

1 User commands that may be started by everyone. 
2 System calls, that is, functions provided by the kernel. 
3 Subroutines, that is, library functions. 
4 Devices, that is, special files in the /dev directory. 
5 File format descriptions, e.g. /etc/passwd. 
6 Games, self-explanatory. 
7 Miscellaneous, e.g. macro packages, conventions. 
8 System administration tools that only root can execute. 
9 Another (Linux specific) place for kernel routine documentation."

from the "Linux Man Page Howto." Take a peek into /usr/share/man on Fedora, wherein all the man pages are actually stored. See also the Sobell textbook, pages 94-91, about the man command, the related info command, and the top sources for getting linux doc and information when you need it. (3/8)

Grades - posted, link at left entitled "Grade reports" (3/8)

Demo to highlight role of a bootloader - I will put into the master boot loader some machine code that prints a string. That's all. The code doesn't boot anything, or load anything. But because we call the code (if any) that sits in the master boot record "bootloader," this is therefore a bootloader in name. Even though not in function. I came upon the idea today from a British student's website. I'll demonstrate it, applying his code to a usb flash drive and booting from that drive to see his string, in class tomorrow night. (3/7)

Homework -
read -
- readings in the "Reading" column of section 1 of the Course Outline with the
 exception of the article on secure boot.
- article Linux System Startup about Unix SysV startup procedure
- article Inside the Linux Boot Process IBM
- Sobell ch 5 "The Linux Utilities" - a catalog of important commands. Read it but skip discussion of the following less important commands: hostname, lpr, uniq, diff, mcopy, gzip/gunzip/bzip, apropos, finger, w, write/talk/mesg. Skip vim tutorial. While reading, I suggest you sit before a linux system and try out the commands and his examples hands-on. (2/22)

Nuts and bolts - a few nuggets I find 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  (2/22)

What SMC's wireless internet access service doesn't do - SMC's web page entitled "Wireless Internet Access at SMC" tells you what their service does not do:

"What network services are available?

"Only web access is allowed (http and https). Campus network ports and the wireless network do not allow access to any non-web services such as telnet, FTP, SMTP, POP, IMAP, etc."

At this early stage in the course do you know what that means? I'm not sure. If you don't, you will soon. But if you try to have the service do anything that it doesn't (clean your socks, chill your beer, connect to a remote machine with ssh...) I hope you won't ask me why it didn't work. (2/21)

Course outline - with approximate weekly topic coverage corresponded to related readings, homework assignments, and in-class slides I will use. 

Accounts will be created for you on the remote server sputnik.smc.edu. See the link near the bottom entitled "Remote Unix system".

Sobell textbook author Mark Sobell has a website

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

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

Homework -
read -  from Sobell textbook-
Sobell ch 1 "Welcome" - read lightly, as casual background and overview
Sobell ch 2 "Installation Overview" - omit RAID and LVM sections. Omit sections on obtaining and burning source data on CDs.
Sobell ch 3 "Step-by-Step Installation" - read it over, up to section on X Window System; omit that and remainder of chapter. Describes installation steps.
view - this video of Marc Sobell, our textbook author, on a 1985 broadcast panel discussion about Unix. 

Bootable flash drives for you - containing a copy of linux similar to that on our classroom laptops, is available for copying to your USB drive. Optionally, if you are interested, bring an 8GB or bigger flash drive to class and we can copy onto it an image of the USB drive I have prepared. It seems to boot on several computers-- probably therefore yours. It's persistent. It contains the utilities and configuration I think useful for teaching. I have not road tested it on any scale but with you as my guinea pigs, it's an offer. It is not required, and I won't formally support things that may not work. No promises. But if you are interested come to class with a flash drive and I think you will leave with a linux environment in which to play. 

Procedures for using class laptops  

A Remote Unix system will be available for your use (acounts not yet created as of today).  

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

 


Eniac - 1946

Milestone in the history of computation

 

Assignments
see course outline

In-class exercises
see course outline