By Æleen Frisch
Book Price: $54.95 USD
£38.95 GBP
PDF Price: $43.99
Cover | Table of Contents | Colophon
|
Then: early 1980s
|
Now: early 2000s
|
|---|---|
|
Adding new users.
|
I still do it, but it's automated, and I only have
to add a user once for the entire network. Converting to LDAP did
take a lot of time, though.
|
|
Adding toner to electrostatic plotters.
|
Printers need a lot less attention—just clearing the occasional
paper jam—but I still get my hands dirty changing those inkjet
tanks.
|
# kill -9 `ps aux | awk '$1=="chavez" {print $2}'
$ write chavez
You've got a lot of identical processes running on dalton.
Any problem I can help with?
^Dsu while logged in to another user
account. The su command may be used to change
one's current account to that of a different user
after entering the proper password. It takes the username
corresponding to the desired account as its argument;
root is the default when no argument is
provided.
su
command (without arguments), the system
prompts you for the root password. If you type
the password correctly, you'll get the normal root
account prompt (by default, a number sign: #), indicating that you
have successfully become superuser and that the rules normally
restricting file access and command execution do not apply. For
example:
$ su Password: Not echoed #
exit
or Ctrl-D. You may suspend the shell and place it in the background
with the suspend command; you can return to it
later using fg.
su, the new shell inherits the
environment from your current shell environment rather than creating
the environment that root would get after
logging in. However, you can simulate an actual
root login session with the following command
form:
$ su -
write
is one way to do so:
$ write username[tty]
write to
a user who is logged in more than once, the tty
argument may be used to select the appropriate terminal or window.
You can find out where a user is logged in using the
who command.
write command is executed, communication is
established between your terminal and the user's
terminal: lines that you type on your terminal will be transmitted to
him. End your message with a CTRL-D. Thus, to send a message to user
harvey for which no reply is needed, execute a
command like this:
$ write harvey The file you needed has been restored. Additional lines of message text ^D
write may also be used over a network by appending
a hostname to the username. For example, the command below initiates
a message to user chavez on the host named
hamlet:
$ write chavez@hamlet
rwho command may be used to
list all users on the local subnet (it requires a remote who daemon
be running on the remote system).
talk command is a more sophisticated version
of write. It formats the messages between two
users in two separate spaces on the screen. The recipient is notified
that someone is calling her, and she must issue her own
talk command to begin communication. Figure 1-1 illustrates the use of
plod and was written
by Hal
Pomeranz (see http://bullwinkle.deer-run.com/~hal/plod/).
While there are similar utilities with a GUI interface (e.g.,
gtt and karm, from the Gnome
and KDE window manager packages, respectively), I prefer this simpler
one that doesn't require a graphical environment.
plod works by maintaining a log file containing
time stamped entries that you provide; the files'
default location is ~/.logdir/yyyymm, where
yyyy and mm indicate the
current year and month, respectively. plod log
files can optionally be encrypted.
$ plod [text]
-C,
-P, and -E options to display
them, either as continuous output, piped through a paging command
like more (although less is the
default), or via an editor (vi is the default).
You can specify a different paging program or editor with the
PAGER and EDITOR
environment variables (respectively).
-G option to search
plod log files; it differs from
grep in that matching entries are displayed in
their entirety. By default, searches are not case sensitive, but you
can use -g to make them so.
$ plod -g hp-ux
-----
05/11/2001, 22:56 --
Starting to configure the new HP-UX box.
-----
05/11/2001, 23:44 --
Finished configuring the new HP-UX box.
plodls are executed as a single process.
A compound command containing pipes will execute one process per pipe
segment. For Unix systems, managing CPU resources must be done in
large part by controlling processes, because the resource allocation
and batch execution facilities available with other multitasking
operating systems are underdeveloped or missing.
diff command on two very large files, you will be
unable to run another command until it finishes (or you kill it with
CTRL-C).
$ cd /dev; ls -l *mouse
crw-rw-r-- 1 root root 10, 10 Jan 19 03:36 adbmouse
crw-rw-r-- 1 root root 10, 4 Jan 19 03:35 amigamouse
crw-rw-r-- 1 root root 10, 5 Jan 19 03:35 atarimouse
crw-rw-r-- 1 root root 10, 8 Jan 19 03:35 smouse
crw-rw-r-- 1 root root 10, 6 Jan 19 03:35 sunmouse
crw-rw-r-- 1 root root 13, 32 Jan 19 03:36 usbmouse
mknod command,
and it takes the desired device name and major and minor numbers as
its arguments. Many systems provide a script named
MAKEDEV (located in /dev),
which is an easy-to-use interface to cron subsystem, the syslog facility, strategies
for handling the many system log files, and management software
packages. We'll close the chapter with a list of
Internet software sources.
man
command are familiar:
getting help for a command, specifying a specific section, using
-k (or apropos) to search for
entries for a specific topic, and so on.
man features that I
didn't discover until I'd been
working on Unix systems for years (I'd obviously
never bothered to run man man). The first is that
you can request multiple manual pages within a single
man command:
$ man umount fsck newfsman
command are familiar:
getting help for a command, specifying a specific section, using
-k (or apropos) to search for
entries for a specific topic, and so on.
man features that I
didn't discover until I'd been
working on Unix systems for years (I'd obviously
never bothered to run man man). The first is that
you can request multiple manual pages within a single
man command:
$ man umount fsck newfs
man presents the pages as separate files to the
display program, and you can move among them using its normal method
(for example, with :n in more).
man also
has a -a option, which retrieves the specified
manual page(s) from every section of the manual. For example, the
first command below displays the introductory manual page for every
section for which one is available, and the second command displays
the manual pages for both the chown command and
system call:
$ man -a intro $ man -a chown
man command to search multiple
man directory trees by setting the MANPATH
environment variable to the colon-separated list of desired
directories.
man command searches the various manual page
sections in a predefined order: commands first, followed by system
calls and library functions, and then the other sections (i.e., 1, 6,
8, 2, 3, 4, 5, and 7 for BSD-based schemes). The first manual page
matching the one specified on the command line is displayed. In some
cases, a different order might make more sense. Many operating
systems allow this ordering scheme to be customized via the
cron is a Unix facility that allows you to
schedule programs for periodic execution. For example, you can use
cron to call a particular remote site every hour
to exchange email, to clean up editor backup files every night, to
back up and then truncate system log files once a month, or to
perform any number of other tasks. Using cron,
administrative functions are performed without any explicit action by
the system administrator (or any other user).
cron is useful for
running commands and scripts according to a preset schedule.
cron can send the resulting output to a log file,
as a mail or terminal message, or to a different host for centralized
logging. The cron command starts the
crond daemon, which has no options. It is normally
started automatically by one of the system initialization scripts.
cron facility on the various Unix systems we are
considering. We will cover each of them in the course of thissection.
|
Component
|
Location and information
|
|---|---|
|
crontab files
|
Usual: /var/spool/cron/crontabs
FreeBSD: /var/cron/tabs,
/etc/crontab
Linux: /var/spool/cron (Red Hat),
/var/spool/cron/tabs |
init process, which in turn
starts system processes (daemons) and initializes all active
subsystems. When everything is ready, the system begins accepting
user logins.
shutdown command to accomplish
all of this. Generally, shutdown sends a series of
timed messages to all users who are logged on, warning them that the
system is going down; after sending the last of these messages, it
logs all users off the system and places the system in single-user
mode.
shutdown
command. The System V version
is used by Solaris and HP-UX (the latter slightly modified from the
standard), and the BSD version is used under AIX, FreeBSD, Linux,
Solaris (in
ifconfig
command ("if" for interface) is
used to set the basic characteristics of the network adapter, the
most important of which is associating an IP address with the
interface. Here are some typical commands:
ping command. Be sure to use IP addresses instead
of hostnames so you are not dependent on DNS.
nslookup (see Section 8.1).
telnet to a remote host. If this fails, be sure
that inetd is running, that the
telnet daemon is enabled, and that the remote host
from which you are attempting to connect is allowed to do so
(inetd is discussed in Chapter 8).
ping command. ping is a simple
utility that will tell you whether the connection is working and the
basic setup is correct. It takes a remote hostname or IP address as
its argument:
$ ping hamlet PING hamlet: 56 data bytes 64 bytes from 192.0.9.3: icmp_seq=0. time=0. ms 64 bytes from 192.0.9.3: icmp_seq=1. time=0. ms 64 bytes from 192.0.9.3: icmp_seq=4. time=0. ms ... ^C ----hamlet PING Statistics---- 8 packets transmitted, 8 packets received, 0% packet loss round-trip (ms) min/avg/max = 0/0/0