If you use UNIX, you know that it can be a technically challenging environment. And if you're like most users, you have a job to do aside from exploring your operating system -- like analyzing that hot new stock, running another experiment, or typesetting another report.What happens when you have problems? What happens when the system slows to a crawl, when you can't get logged back in after a power failure, or when you've sent a file to the printer three times but have yet to find a printout?Your first choice for handling a problem might be to have the problem never occur. Your second choice might be to have someone else fix it, immediately. However, in the real world, sometimes you will have to investigate the problem and report it, and sometimes you will have to find an answer yourself.When You Can't Find Your UNIX System Administrator, part of our new What You Need to Know series, gives UNIX users tools for solving problems. It offers:
Practical solutions for problems you're likely to encounter in logging in, running programs, sharing files, managing space resources, printing, and so on
Just enough background on what's going on "behind the scenes" so that you can make sense of our suggestions, rather than simply memorizing keystrokes
An explanation of how to present problems to your sys admin so that you're more likely to get quick, accurate support
A list of the site-specific information to which you should have access, and a place to write it down
A quick-ref card summarizing what to try first, second, third for commonly encountered problems
The goal of this book is not to make you a guru in your own right. The goal of this book is to get you back to the job you'd rather be doing.
Chapter 1 What you need to know about solving problems
There’s no magic involved.
For user problems, administrators are more like detectives than like magicians.
Administrators have many responsibilities; user support is only one of them.
Educated users get better help.
Put yourself in your administrator’s shoes.
Gather the facts before you alert your administrator.
Recreate the problem.
Look at the error message.
Try the most obvious answerserrors, troubleshootingobvious answers .
If it used to work, what changed?
Try to identify (and eliminate) as many factors as you can.
Tell the administrator what you tried.
Quick Reference: contacting your administrator
Chapter 2 What you need to know about logging in
If you can’t log in, you can’t do anything else.
Logging in is a series of steps; each must be successful.
If the terminal doesn’t seem to be on, check the power supply.
If the terminal is running, but there is no login prompt, check the cables and brightness control.
If everything is plugged in and connected, reboot and try again.
If you still can’t get the terminal to respond, let your system administrator know.
The computer checks your login name and password.
If your login isn’t accepted, it’s most likely a typing error. Try again.
If you still can’t log in, try another terminal to rule out equipment problems.
Passwords are stored in a database.
Login accounts may be disabled by the system administrator.
You can ask another user to check if your account was disabled in the password database.
If you’ve forgotten your password, you’ll need to ask your system administrator for help.
Quick Reference of login troubleshooting
Chapter 3 What you need to know about running programs
You run programs in UNIX by typing them on the command line.
The error “Command not found” means that the command isn’t in your search path.
Check if the command was misspelled.
Most programs reside in bin directories.
You can run a program using its full pathname.
You can run a program without its full pathname because of your command “search path.”
You can find the directory where a program is installed with the whereis or which command.
Add directories to your search path.
The command might run, but not work correctly.
There may be more than one version of the same command on your system.
When there are two versions of a program, the one executed is the one earliest in your search path.
You can have “aliases” for commands.
The which command tells you what version of a program you are using or whether you have an alias.
If a program isn’t working properly, you could be running a different version of it.
There might also be permission problems.
The TERM environment variable tells programs what type of terminal you use.
If TERM is not set, programs may not run.
If TERM is set wrong, you may get gibberish.
Use the man command to learn how to use a command.
Try the apropos command(or man -k) to find the name of a command.
Quick Reference of troubleshooting techniques
Chapter 4 What you need to know about sharing files
On a UNIX system, your files can be shared with other users.
Security measures make sure that people aren’t reading or editing files that they shouldn’t be.
Sometimes file security gets in the way of what you want to do.
Each UNIX file has its own distinct set of permissions to define who can read, write, or execute the file.
Each file is owned by a particular user.
Each file is assigned to a particular “group” of users.
Use ls -lg to find out to what group a file belongs.
You can find out to what groups a user belongs.
Each file has three separate sets of permissions: for the owner of the file, the group, and everyone else.
If you don’t have read permission, you won’t be able to see the contents of the file.
Just because you can read a file doesn’t mean that you can change it.
Directory permissions refer to the ability to list the files or create new files.
Use ls -l to learn the permissions on a file.
Use ls -ld to see the permissions for a directory.
If you need permissions changed, you can ask the owner of the file or the system administrator.
The owner of a file can extend read and write permission to all users.
The owner of a file can extend read and write permission to just the group.
The owner of a file can change the group that the file belongs to.
You can also remove permissions.
You can change permissions for all files in a directory.
You can “become” another user to gain their privileges.
Only the administrator can legitimately change the ownership of a file.
If you can read a file but can’t write it, you can copy the file and make your changes in the copy.
If you have already made edits when you learn the file is read-only, you can still save your changes.
Sometimes several users have to work on several sets of files at once.
It’s dangerous if two people edit a file at the same time.
There are systems for making sure that two people aren’t editing the same file.
Quick Reference to file sharing
Chapter 5 What you need to know about printing
Printing is a multistep process for the computer.
Print jobs are sent to the printer by a printer daemon.
Printing works differently depending on whether you use System V or BSD UNIX.
Files need to be translated into a format that printers recognize.
On UNIX, most printers use the PostScript standard.
A PostScript file has a unique header.
The lpr or lp command prints PostScript files. Other commands are needed to translate and print other kinds of files.
If a file doesn’t print, the problem might be the PostScript file.
Although most of a PostScript file is incomprehensible, you can sometimes read page counts.
You can control what printer a file goes to, cancel print jobs, or monitor the print queue.
You can use the lpc status or lpstat -t command to identify printers.
On BSD-derived UNIX, printers are defined in /etc/printcap.
Each user is assigned a default printer.
Change the printer you use on the command line or with the PRINTER environment variable.
Check the printer queue to see the status of your print job.
If the printer queue isn’t moving, a large file could be processing.
You can cancel your print job with the lprm or cancel command.
Rebooting will fix a “hung” printer.
Fonts can look wrong if the fonts requested aren’t loaded on a printer.
Quick Reference to printing
Chapter 6 What you need to know about space and time
You share space and time with other users.
Even if your system resources are adequate today, they may not be tomorrow.
Files are stored on disks.
On UNIX, disks are mounted as directories, or filesystems.
Disk space is shared on UNIX systems.
Some filesystems are mounted from remote machines.
You can look at disk names and the space available on each disk.
You can look at how much disk space your files take up.
You can look at the size of your directories and subdirectories.
Commands may create temporary files that also take up disk space.
Clean up your directories occasionally (or when you get a warning).
Don’t forget to check saved mail messages.
Always remove a “core” file.
Look for temporary files that weren’t removed after they were created.
Remove files that you can easily recreate as needed.
If you save files, you can compress them to take up less room.
When you get a message that a disk is full, first find out which filesystem is affected.
You may be able to retrieve deleted files from backups.
UNIX systems multitask by working on each process a little at a time.
When the system gets slow, take an inventory of what you’re doing.
You can use the ps command to see what processes you’re running.
On a UNIX machine, you can run many programs simultaneously.
X users commonly have many programs running at once.
Some programs are more resource intensive than others.
Commands with dynamic displays eat up more time than “snapshot” displays.
X programs are much more resource intensive than character-based programs.
Some single commands actually spawn multiple processes.
Look for unwanted processes.
You can stop processes with the kill command.
Job control makes killing programs a little easier.
Be aware of your resources.
Quick Reference to space and time questions
Chapter 7 What you need to know about everyone else
UNIX is a multiuser system; you can find out what other users are doing.
You can find out who is logged in.
Use who with the more or grep command to find out if a particular user is logged in.
You can find out what other users are doing with ps.
Use grep with ps to see what a single person is doing.
The finger command shows you how long terminals have been idle.
Finger shows when other users last read their email.
You can use the finger command to find out what people are doing on other systems.
You can use finger to find out someone’s login name.
Don’t believe finger when it tells you when someone last logged in.
Some users have a .plan file to tell others what they’re up to.
Linda Mui started working for O'Reilly & Associates in 1986. She was first hired as a production assistant, later became an apprentice system administrator, and now is a writer. Her first writing job was for termcap and terminfo, which she co-authored with John Strang and Tim O'Reilly. She also wrote Pick BASIC, on programming applications for Pick systems. In between writing jobs, Linda works on troff macros and tools for the O'Reilly & Associates production staff. Linda was raised in the Bronx, New York and now lives in Cambridge, Massachusetts. Lately she has been trying to improve herself by learning how to swim, play billiards, and accessorize.
When You Can't Find Your UNIX System Administrator Review
Comments about O'Reilly Media WYNTK: UNIX System Admininistrator:
This book is the best single introduction for clueless users I have read, period.
The biggest problem with UNIX is not a problem with it at all, it's a problem that no one who doesn't think they can understand it ever will. The commands are arbitrary, mistakes are easy, documentation is often faulty ( the man page is for one version of grep, and a different one is in a user's path ), and exercising the system requires a great deal of imagination from the command line.
Of course we have GUIs now, but the bottom line is to really understand 'NIX you need to understand the command line. This book clears the cobwebs away. Everytime I have had some poor soul thrust at me by a manager to unwillingly "learn UNIX", they seem bent on deciding UNIX is too fustrating, complex, or dated to be worth learning. In response have given them this book instead of telling them about man -k. Every one of them then decided they wanted to know more, all of them ended up sysadmins on some level.