Unix Interoperability Concepts |
The UNIX operating system, written primarily in C language, consists of a library of functions that are used to access the system resources. Many interfaces to these functions are available, including C itself, the various shells, and Perl. Almost all UNIX commands and programs are executable files.
The UNIX file system is arranged in a hierarchical tree of directories divided into subdirectories, beginning with the root (/) directory. These directories and subdirectories contain files.
The root directory, which is the parent of all other directories, typically contains some or all of the following directories.
Table B.1 Root Subdirectories
Subdirectory | Description |
---|---|
/bin | Contains the binary files used by programs within /usr. |
/sbin | Contains system administration utilities. |
/usr | Contains most of the operating system files and programs. Typical subdirectories include /bin, /sbin, and /lib. |
/etc | Contains configuration files and directories. The /etc directory contains a number a significant files, including the /etc/shadow/ and the etc/passwd files. |
/var | Contains files whose contents change frequently, such as temporary files, spooled files, and mailbox files. |
/dev | Contains device files. |
/tmp | Contains temporary files. |
/home | Contains users' home directories. |
/lib | Contains shared libraries. |
/boot | Contains static boot files. |
/man | Contains online manual pages. |
Every file and directory has a name. Within a directory, the names of files and subdirectories must be unique among themselves and between each other. Files in different directories can have identical names. Naming is case sensitive; thus, Members, members, and MEMBERS are unique names. File names can have extensions, such as .doc or .c. Files beginning with a period are called invisible because the ls command does not list them by default. Every directory contains two files "." and ".." created by the mkdir command. These represent, respectively, the current working directory and its parent directory. Files are addressed using paths. You can use either the absolute or the relative path when referring to a file. The absolute path shows the path to the file, beginning with root. For example, for the file members in the directory documentation in the home directory for jane, the absolute path is /usr/jane/documentation/members. The relative path shows the path to the file relative to the current working directory. The current working directory is the directory in which you are currently (use the pwd command to see the path of the directory).
You use the cd command to change the current working directory. The following table contains examples of using the cd command.
Table B.2 Various Uses of the cd Command
Command | Description |
---|---|
cd | No argument; changes to the user's home directory. |
cd . | Changes to the current working directory. |
cd .. | Changes to the parent of the current working directory. |
cd ./directoryname | Changes to a specified subdirectory of the current working directory. |
cd ../directoryname | Changes to a specified subdirectory in the parent of the current working directory. |
Each user has a personal, home directory, which is the working directory used by the shell when a user first logs on. In your home directory is a startup file (.profile if you are using Korn or Bourne; .login if you are using C shell). This file contains information that determines such environment settings as the paths that the shell searches to find executable files, the shell prompt you see on your terminal, your terminal type, and your terminal settings, such as the line kill key, which deletes the entire current line, and the erase key.
The kernel, which is the heart of the UNIX system, controls the computer's resources and allocates them among users. It enables users to run programs, which communicate with the kernel through system calls. It controls peripheral devices and provides the file structure used for storage.
The kernel allocates memory, controls processes, manages system resources, runs shell programs, manages multitasking, handles interrupts (signals to terminate running of processes), handles errors, provides input and output services, and manages the file system. The kernel does this by providing an interface between the programs under its control and the system hardware, using the system call interface, which is an application programming interface (API).
Every UNIX system has a special user, called root or superuser, who has unique and powerful privileges associated with system administration. Root can access all files, regardless of access permissions. Root can read, write, or run any file; search any directory; and add or delete a file in any directory. Root can change a user's password without knowing the original password. Root can halt the system and change ownership of files. Because root privileges are so powerful, they can be destructive, intentionally or not. Root privileges should be used carefully.
There are two ways to log on as root: by logging on at the logon prompt with the user name root and the root password; and, while logged on as another user, by typing the command su and the root password.
UNIX, first developed at AT&T Bell Laboratories, has evolved over the years. Berkeley Software Distribution (BSD), which was developed by the Computer Systems Research Group at the University of California, offers enhancements to the Bell Labs operating system, including C Shell and the vi editor. UNIX System V from Bell Labs incorporates BSD features. Solaris, from Sun, provides System V for use on Sparc workstations and 486-based and Pentium-based computers. This operating system runs on multiple and single-CPU-based systems. SunOS in a BSD-based operating system is offered by Sun for use on Sparc workstations but only runs on single-CPU-based systems. Linux is UNIX freeware that is compatible with System V and BSD and is POSIX compliant.
Table B.3 UNIX Implementations Supported by Services for UNIX
UNIX product | Based on |
---|---|
HP-UX (Hewlett-Packard) | System V with some BSD features |
IRIX (Silicon Graphics) | Incorporates functionality from System V R4.1 and R4.2. |
Linux | GNU; Posix compliant; no proprietary source code used. |
Digital UNIX | Compliant with System V R3.2 and R4. |
Solaris (Sun Microsystems) | A renaming of SunOS 4.1.x (BSD with some System V R4 features). Solaris 2.x includes SunOS 5.x, which is derived from System V R4. |
UNIX provides commands to send files to the printer. If no printer is specified, the default printer is assumed. The /etc/printcap file contains a list of printer definitions. The default printer can also be specified using an environment variable (LPDEST for System V and PRINTER for BSD). Table B.4 lists common printer commands for UNIX.
Table B.4 UNIX Print Commands
UNIX command | Based on | Description |
---|---|---|
cancel | System V | Cancels a request to the LP print service. |
lpstat | System V | Prints information about the status of the LP print service. |
lp | System V | Sends a request to the LP print service. |
lpq | BSD | Displays the queue of printer jobs. |
lpr | BSD | Sends a job to the printer (provided with Windows 2000). |
lprm | BSD | Removes a job from the print queue. |
UNIX provides online documentation, which explains commands and procedures, in the form of manual pages. To access a particular man page, type man command_name at the shell prompt.