By Shelley Powers, Jerry Peek, Tim O'Reilly, Mike Loukides
Book Price: $69.95 USD
£49.95 GBP
PDF Price: $55.99
Cover | Table of Contents | Colophon
|) represents
pipe
and means "take the output of the program on the
left and feed it into the program on the right."
$ in the prompt. The C shell uses
% (but tcsh users often use
>).
#.
% grep yourloginname /etc/passwd % ypmatch yourloginname passwd
shelleyp:*:1006:1006:Shelley Powers:/usr/home/shelleyp:/usr/local/bin/bash
bash-2.04$ tr '\015' '\012' < file.mac > file.unix
tr '\015' '\012'
bash-2.04$ chmod +x mac2unix
bash-2.04$ mac2unix < file.mac > file.unix
for
Section 35.21, $x
Section 35.9
for x
do
echo "Converting $x"
tr '\015' '\012' < "$x" > "tmp.$x"
mv "tmp.$x" "$x"
donePID TTY STAT TIME COMMAND 18034 tty2 S 0:00 -zsh 18059 ? S 0:01 ssh-agent 18088 tty2 S 0:00 sh /usr/X11R6/bin/startx 18096 tty2 S 0:00 xinit /etc/X11/xinit/xinitrc -- :0 -auth /home/jpeek/ 18101 tty2 S 0:00 /usr/bin/gnome-session 18123 tty2 S 0:33 enlightenment -clientId default2 18127 tty2 S 0:01 magicdev --sm-client-id=default12 18141 tty2 S 0:03 panel --sm-client-id default8 18145 tty2 S 0:01 gmc --sm-client-id default10 18166 ? S 1:20 gnomepager_applet --activate-goad-server gnomepager_a 18172 tty2 S 0:01 gnome-terminal 18174 tty2 S 0:00 gnome-pty-helper 18175 pts/0 S 0:00 zsh 18202 tty2 S 0:49 gnome-terminal 18203 tty2 S 0:00 gnome-pty-helper 18204 pts/1 S 0:01 zsh 18427 pts/1 T 0:00 man zshjp 18428 pts/1 T 0:00 sh -c /bin/gunzip -c /home/jpeek/.man/cat1/zshjp.1.gz 18430 pts/1 T 0:03 /usr/bin/less -is 18914 pts/1 T 0:02 vi upt3_changes.html 1263 pts/1 T 0:00 vi urls.html 1511 pts/1 T 0:00 less coding 3363 pts/1 S 0:00 vi 1007.sgm 4844 tty2 S 0:24 /usr/lib/netscape/netscape-communicator -irix-session 4860 tty2 S 0:00 (dns helper) 5055 pts/1 R 0:00 ps x
/). However, you
should avoid filenames containing most punctuation marks and all
nonprinting characters. To be safe, limit your filenames to the
following characters:
.*). The
ls command, which lists your files, ignores files
whose names begin with a period unless you give it a special option
(ls -a (Section 8.9)). Special configuration files are often
"hidden" in directories by
beginning their names with a period.
|
Extension
|
Description
|
|---|---|
|
.a
|
Archive file (library)
|
|
.c
|
C program source file
|
|
.f
|
FORTRAN program source file
|
|
.F
|
FORTRAN program source file to preprocess
|
|
.gz
|
gzip
ped file
(Section 15.6)
|
* (an asterisk), but we'll start
with something simpler: ? (a question mark). When
it appears in a filename, the ? matches any single
character. For example, letter? refers to any
filename that begins with letter and has exactly
one character after that. This would include
letterA, letter1, as well
as filenames with a nonprinting character as their last letter, such
as letter^C.
* wildcard matches any character or group of
zero or more characters. For example, *.txt
matches all files whose names end with .txt;
c* matches all files whose names start with
c; c*b* matches names
starting with c and containing at least one
b; and so on.
* and ? wildcards are
sufficient for 90 percent of the situations that you will find.
However, there are some situations that they can't
handle. For example, you may want to list files whose names end with
.txt, mail, or
let. There's no way to do this
with a single *; it won't let you
exclude the files you don't want. In this situation,
use a separate * with each filename ending:
*.txt *mail *let
program.n, where
n is a single-digit number. Use the
filename:
program.[0123456789]
[
character-list
cd with no pathname; the shell will assume you
mean your home directory.
cd
/usr/bin). You can find out your current directory by
giving the pwd ("print working
directory") command.
cat textfile, you are asking Unix
to locate the file textfile within the directory
/home/mike. This is equivalent to the absolute
path /home/mike/textfile. If you give the
command cat notes/textfile, you are asking Unix to
locate the file textfile within the directory
notes, within the current directory
/home/mike.
.. (dot
dot) to refer to the parent of the current working directory. For
example, if your current directory is
/home/mike, ./textfile is
the same as textfile, which is the same as
/home/mike/textfile. The relative path
../gina/textfile is the same as
/home/gina/textfile; .. moves
up one level from /home/mike (to
/home) and then searches for the directory
gina and the file textfile.
~ (tilde) or the
environment variables $HOME or
$LOGDIR, to refer to your home directory. In most
shells, http://www.xdarwin.org) and OroborOSX
(available at the Apple web site at http://www.apple.com).