This chapter begins with a quick overview of operating systems. You may remember some of the ideas from NET 101. Any operating system should include some key features:
Several common operating systems are mentioned, and the text
hints that different versions of operating systems are used by
devices that have different purposes, such as Windows 7 or Windows
10, which are used for a personal computer, and Windows Server, which is used for a network
server or a web server.
The text also discusses operating systems with regard to running
devices on networks. Most networks operate with clients
(devices that make requests) and servers
(devices that answer or fulfill requests). The operating system
that runs on a client in this kind of network may be different
from an otherwise similar operating system that runs on a server,
as noted in the Windows example above.Servers are allowed to request services from other
devices (other servers), but their main purpose is to provide
services. Here's a spin on that from Linus Sebastian.
Another kind of network is a peer-to-peer network, in which each device may request services from other devices, and may also provide services to other devices. The operating system on each device is more likely to be the same operating system in this kind of network.
On page 5, we are introduced to UNIX. The initial comments in this section, like those in most of the text, apply to both UNIX and Linux. The text informs us that a UNIX operating system can be installed on servers, on clients, on devices that are both clients and servers in a peer-to-peer network, and on standalone workstations. UNIX was invented before Linux, so the historical material starts there.
To understand the creation of UNIX, you need to know a little about Bell Labs. Once upon a time, before the US Government required that it be split up into several pieces (in 1984), the Bell System was a huge telephone/telecommunications company, that included a research and development division called Bell Telephone Laboratories, also known as Bell Labs. They invented a lot of things, including the UNIX operating system. At the time it was created, Bell Labs was not allowed to sell UNIX, so it was given away, mainly to universities who modified it as part of their own research and development programs.
As the text explains, this situation eventually led to two major versions of UNIX. One was controlled by Bell Labs itself, and it was called UNIX System V. Ownership of System V has changed over the years. The second version of UNIX is sometimes called BSD, which stands for Berkeley Software Distribution, because that version was standardized by the University of California, Berkeley.
Each of the two major versions of UNIX has its own history, features, and limits placed on its use. Linux was created as an operating system based on UNIX, but to be made freely available to anyone. It was primarily created at the University of Helsinki by Linus Torvalds, who wanted to call it Freax. It was called Linux by a co-worker who thought that was a better name.
UNIX and Linux, like most operating systems, are based on a
pyramid model shown on page 7.
As noted above, Linux was created as a free operating system, but it has been modified and adapted by several different entities, some of whom are listed on pages 7 and 8. Some versions of Linux are still free, and others are for sale by their owners.
On page 8, the text discusses shells. Once a user has logged in to a UNIX
system, a default shell is started. You can think of a basic shell
as a command line interface to the kernel. The system you use may
have several shells available, and you can start a new one at any
time by typing its name as a command. The text mentions that you
can set a personal choice for a default shell in a configuration
Once you learn to use the commands available in a given shell,
you may want to store command sequences in shell
script files which you can then execute as if they were
programs. A script is also called a batch file. It is a list of
commands that execute one at a time, from the top to the bottom of
the list. (It can be more complicated, but that is the basic
As mentioned above, you need to authenticate to a UNIX system to be granted the rights assigned to your ID. This means that you need a valid user ID and a valid password for that ID. On page 10, the text mentions that there are different rules that may be set for the complexity and length of user IDs and passwords. Make sure you know the rules before choosing either. That same part of the text lists five ways you might connect to a UNIX or Linux system:
In our classroom, we would use a variation on the fourth method, which would be to install Linux on a virtual machine that would be run on each workstation in the lab. The text discusses logging in with a command line interface and with a GUI, which may be implemented through several different methods, such as X Windows or GNOME. These will be discussed in a later chapter. In any case, this year's remote classes will require you to install Linux on virtual machines on your own hardware.
Using a command line interface is the simplest and most common way to use a UNIX/Linux system. Let's take it from the point of logging in. Before typing anything on a UNIX system, a user should be made aware that UNIX/Linux cares more about the case (capitalization) of letters than any other operating system. All commands should be typed exactly as noted, including the use of capitalization. YOU HAVE BEEN WARNED! Some commands will not care, but most care deeply. Linux would see these variant capitalizations as four separate commands, and only one is likely to work.
Just remember that capital letters and lower case letters are different letters to UNIX/Linux, and you have to spell things correctly.
When the system is started, the first thing the user should
notice is the system asking for the user ID. It does so by
presenting the login prompt which may look like this:
The user enters the ID that the system administrator assigned, and presses enter. The system will next ask for the user's password by presenting the password prompt:
The user should enter the current password assigned by the system administrator, or set by the user. A new user should be warned that what is typed at a password prompt is not echoed on the screen. This is normal, and is done as a security measure.
A user may change a password by entering the passwd command. Since this could also be done by someone other than the user, if the user walks away from the workstation for a few minutes, the first thing the passwd program asks for is the current password, with the prompt
This is for the user's security. A user should keep a password private, and not tell it to anyone who might lock them out of the system for a joke or for spite. After entering the Old password, the user is asked for a New password, twice. This is to make sure the user knows what was typed and can repeat it.
When a user finishes a UNIX session, it is proper to log off the system. This can be done in a number of ways. At a UNIX prompt, the user may type the command exit which should end the current shell session. If you were running a shell inside a shell, inside another shell, one exit command would not be enough.
Alternatively, the user may press Ctrl-d,
that is the lower case d while the control key is held down. This
will also end the current shell session. Again, if you have
started a new shell inside your current shell, the exit command
should only terminate the new one, not the outer one. Note: the
two commands above are valid for the Bourne, Korn, and Bash
shells, but not for the C shell. For that shell, use the logout
command. Other variations are listed on page 23.
As noted in the text, the UNIX system has hundreds of commands available to the user. This is confusing to the user who wants to learn them all. Most users do not need to use them all. This course will demonstrate some useful ones.
The date command reports the current date, time, time zone and year to the user. It is issued to the system simply by entering the word date on the command line. This is useful for users who work so long on the system that they forget who and where they are.
If the user has truly forgotten who he/she is, the who command may be helpful. It reports the user IDs of all users on the system at the time the command is given. It also has options which demonstrate the most common way to modify UNIX commands. Most commands follow this syntax:
command [-options] [objects]
The options usually
(but not always) follow a hyphen, and they tell the command
program how to carry out the command. The objects are usually the files
(remember: UNIX thinks everything is a file) that the command is
to be carried out upon. If you are to use a hyphen, do not put a
space between the hyphen and any option letters. The text refers
to the list of objects as
the list of arguments,
which is also correct. Arguments are what you pass to a function
in math and in programming.
If the user types
who am i
the system will respond with the user's ID, terminal number and the date of login. This method uses no hyphen. If the user types
the system will respond with the same information about all users currently on the system. The command may be issued as
which will print column headers on the screen. Another way of using the command is just
which reports a count of current users.
Another command that uses options is the cal command. It activates UNIX's built in calendar program and shows a calendar page for the month and year a user requests. This command, however, does not use hyphens. Enter the command
cal 12 1997
and the system will show you a calendar page for December of 1997. You must use the full four digits for the year, such as 1997. If you enter
cal 12 97
UNIX will assume you want to look at the month of December in the year 97 (no leading digits). Try this command:
cal 9 1752
Hint: In that year, some people's calendars changed. Why and for
whom? The text explains that the cal command can also tell you the
Julian date for a particular day or sequence of days.
On many UNIX systems there are tutorial programs that can be started with the learn command. Working your way through this utility may be useful to you.
The help command is more common than learn. It takes you through help about certain common UNIX commands. It is not, however, universally liked, and may be of less use to you than the man command. This command activates the on-line manual for UNIX. It may be issued by itself on a command line, or you may type the word man followed by a specific command you would like to see the manual pages for.
Sometimes, the man command gives you more information than you actually need at the moment. The whatis command is used to display shorter descriptions of other commands. Note the procedure on the bottom of page 21 that is used to create the database that whatis reads. This database must be created by someone with administrator rights before the whatis command will work properly on some versions of UNIX/Linux.
Another way to handle large files is to use the head command (if you only want to see the first several lines) or the tail command (if you only want to see the last several lines).
The two commands shown here would copy the first 10 lines and last 10 lines of the file specified to the screen. Sometimes you want the information you generate to go to a file instead of the screen. You can do this as well with output redirection. To send the output of the head command in the example above to a file called newfile, we could issue the command like this:
head myfile > newfile
The greater than symbol writes a new file, in this case called newfile. It there were already a newfile, this command would overwrite it. It you wanted to append to the end of an existing file, you could use a double greater than operator.
head myfile >> newfile
If there were already a file called newfile, the output would be written to the end of it. If newfile did not exist yet, it would be created by the command.
The following video demonstrates the head, tail, and more commands. I looked at a lot of them that were dreadful, so enjoy this one for its clarity and brevity.
On page 24, the text discusses the role of the administrator of a
UNIX/Linux system. This role may be called system
or root. Note the
differences in the command lines for the root user and ordinary
users shown on that page.
On page 22, the text discusses a reason to prefer some shells
over other shells. It describes the fact that the Bash shell
supports use of the left and right arrow keys to move your cursor
when you are trying to edit a command line. The discussion
continues for a couple of pages.
On page 25, the text mentions that several commands can be used to read the contents of files stored on a UNIX/Linux system. The cat command means to concatenate, and with only a filename as an argument, it means to concatenate (add) the file to whatever is already on the screen. The command is:
This is fine to put a short file on the screen. Our author mentions that a long one will scroll up the screen too fast to read. In that case, I recommend using the command with two changes:
cat filename | more
This command uses the pipe character (probably the shift of the backslash on your keyboard) to send output of the cat command through the more command, causing the display to pause when the screen is full. You will see a prompt about pressing a key to see the next screen full of text. Much easier to read.
As long as we are at it, this is a slash: /
Related to this use of the cat command is the last discussion on
page 26, which concerns redirection. Redirection of one
type has been discussed above. Itis simply sending or
pulling data in a way that is not the default
way. In the example above, the pipe operator can
be used to capture the output of one function,
and then send that output as the input to
another function. This method does not save the output of the cat
function. The greater than and double greater than symbols send
output to files. There is a difference. A file is
a destination object, and a function is
another program that will do something with the
data flowing to it.