<<

. 37
( 69 .)



>>

Unix does not care how many extensions a file has.




COMPRESS LARGE FILES




› Type the name of the › Type the name of the
COMPRESS A FILE WITH GZIP UNCOMPRESS A GZIPPED FILE
original file followed by .gz original file.
„ Type gzip followed by „ Type gunzip followed by
and then press Return.
– The listing shows that the
a space. a space.
– The listing shows that the file is uncompressed.
¤ Type the name of a file, ¤ Type the name of a
file is compressed.
and press Return. gzipped file, and press
Return.
‹ Type ls -l followed by a
‹ Type ls -l followed by a
space.
space.
176
11
SYSTEM ADMINISTRATION COMMANDS


Most software that you download from FTP sites is compressed to
reduce both the storage space requirements on the server and
the time required to download the file. You can determine the
type of compression used by looking at the file extensions. Files
that end in .Z have been compressed with the compress command,
while those that end in .gz have been compressed with gzip. You
may also see file endings such as .zip, .tar.Z, and .tgz.

FILE EXTENSION DESCRIPTION BENEFIT
ZIP Files ending in .zip are ZIP files. Many systems have zip and unzip commands
and can both create and extract from these files.
TAR Files ending in .tar are tape These files are not compressed
archive or TAR files. but contain a number of files that you can
individually or collectively extract with the tar
-xf command.
TARZ/TGZ Files ending in .tar.Z or .tgz To extract the contents of one of these files, you
are TAR files that have also must first uncompress it. This leaves you with a
been compressed with the TAR file. You then use the tar -xf command
compress command. to extract the contents.




› Type the name of the › Type the name of the
COMPRESS A FILE UNCOMPRESS A
WITH COMPRESS COMPRESSED FILE
original file followed by .Z original file, and press
„ Type compress followed „ Type uncompress
and then press Return. Return.
by a space. followed by a space.
– The listing shows that the – The listing shows that the
¤ Type the name of a file, ¤ Type the name of a
file is compressed. file is uncompressed.
and press Return. compressed file, and press
Return.
‹ Type ls -l followed by a
‹ Type ls -l followed by a
space.
space. 177
UNIX FOR MAC

USING NETINFO
account in the /etc/passwd file, you are not likely to find it.

Y
ou can explore and modify the contents of your
The system does not use these files; it uses NetInfo.
NetInfo database. NetInfo is a service that replaces
Therefore, learning to browse the NetInfo information base
the simply formatted text files that were once used
and make changes is essential for understanding and
exclusively in Unix to store information about systems,
monitoring your system.
users, and so on. The early Unix systems stored all user
information in the /etc/passwd file, and information about
The most important NetInfo commands are nidump,
the local system and other systems in /etc/hosts. Along with
niload, and niutil. The nidump command displays the
some additional files, also stored in /etc, the records in
NetInfo contents. The command nidump passwd .
these files determined who could log on and what services
displays the passwd entries that were stored in the
the system could support.
/etc/passwd file on older Unix systems.
In the past, new lines were added to the /etc/passwd file
You can use the niload command to load new contents
as new user logons were created. New hosts were added to
into NetInfo, and the niutil command for various read
the /etc/hosts file so that the systems could communicate.
and write processes. NetInfo refers to the types of
Today, we use network information and lookup services
information that it contains as formats. There are also
such as NetInfo, NIS, and LDAP on many systems to replace
nifind, nigrep, and nireport commands. Read about
the simple text files.
these by entering a man command; for example, man
nigrep.
NetInfo is a lookup service or database that contains many
types of system information. In fact, if you look for your
USING NETINFO




– The nidump command ‹ Type . and press Return.
LIST NETINFO FORMATS DUMP INFORMATION
FROM NETINFO
displays a usage statement
„ Type nidump and press – The contents of that format
„ Type nidump followed by
along with a list of the
Return. are displayed.
formats that it can a space.
dump for you.
¤ Type the name of a format
followed by a space.




178
11
SYSTEM ADMINISTRATION COMMANDS




NetInfo uses terminology that is different from that
While the nidump and niload commands are
of the system. For example, not only does NetInfo
relatively straightforward, the niutil command
maintain formats in place of files, but it also has
has a number of options, each of which is like a
directories in place of records and properties in
separate command. These options include
place of fields. If you use the niutil command to
-create, -destroy, -createprop,
create a new user record, you can use the niutil
-appendprop, -mergeprop, -insertval,
-create command, which creates a new directory.
-destroyprop, -destroyval, -renameprop,
You can then set the values associated with the full
-read, and -list.
name of the user, their Home directory, and so on,
Although NetInfo works well, you should
by using the niutil -createprop command.
consider making your changes with a carefully
written and well-tested script, and not attempt
to enter all of the necessary netutil commands
manually. Read the man pages for niload,
nidump, and netutil to learn more about how
you can use these commands.




› Type > followed by a › Type the name of the file
BACK UP NETINFO RELOAD NETINFO
INFORMATION IN A FILE FROM YOUR FILE
space, a filename, and then into which you dumped the
„ Type nidump followed by „ Type sudo niload followed
press Return. contents of the format, and
press Return.
a space. by a space.
– The nidump command
– The system reloads
¤ Type the name of a format ¤ Type the name of a format
dumps the contents of that
format into your file. the dumped data back
followed by a space. followed by a space.
into NetInfo, including the
ˇ Type sudo niutil “destroy .
‹ Type . followed by a ‹ Type . followed by a account information for zoe.
/users/zoe and press Return.
space. space, and then < followed
by a space.
– The user zoe is removed
179
from NetInfo.
UNIX FOR MAC


INSTALL DEVELOPER TOOLS
performance of your system. Do not be alarmed if your

Y
ou can load a variety of software development tools
system slows down during this part of the installation
onto your Mac OS X system. The Developer Tools CD
process; this is not uncommon. The installation process may
that ships with the OS contains a complete set of
take longer than you think it should. Be patient and allow it
development tools. This includes a number of standard
to complete.
programming languages, utilities, and libraries along with
software management tools and debuggers. There are
To make your system easier to manage, you should install
compilers that allow you to turn your source code into
the developer tools on the same disk as your Mac OS X
programs your system can run from scratch, debuggers ”
installation, if possible. You can load the developer tools
special tools that help you to locate errors in your code,
from the CD in roughly half an hour. If you are operating on
and tools to help you analyze performance.
a local area network, you can make the developer tools
available on one system and install them on other systems
You can load all of the tools available on the Developer
over the network.
Tools CD at once, or you can open the Packages folder and
select any of six individual packages that you want to install.
The README.html file is a good starting point to help you
These are BSDSDK, DevDocumentation, DevExamples,
find the documentation that you need to get started. You
DevPBW0, DevSDK, and DevTools.
can keep your developer tools current by periodically
looking for updates at www.apple.com.
During the installation of the developer tools, the installer
goes through a number of phases, including an optimization
phase in which the installer attempts to improve the overall

INSTALL DEVELOPER TOOLS




– The Developer Tools
„ Insert the Developer Tools ¤ Double-click the icon that ‹ Double-click the
CD-ROM into your drive. appears on your desktop window opens. Developer.mpkg icon.
– The tools CD icon appears
on your screen.




180
12
INSTALL UNIX APPLICATIONS

The developer tools include the gcc 3.1 compiler. This GNU C
compiler compiles code written in C, C++, Objective-C, and
Objective-C++. Developers on other Unix systems ” Linux,
Solaris, FreeBSD, and others, use this same compiler
extensively. In fact, gcc is used to compile Mac OS X. This
particular version of the compiler has been enhanced to
compile faster, and produce more efficient executables.
If you load the entire contents of the Developer Tools CD, you
will also install Project Builder, Interface Builder, AppleScript
Studio, New BSD SDK, gdb debugger, Thread Viewer, and
Sampler along with the associated documentation. Project
Builder is Apple™s integrated developer environment and
assists with development tasks from editing and searching
through building and debugging.
If you are a seasoned developer, you will appreciate all the
tools that are packaged in this tool kit. If you are a new
developer, you will probably appreciate all the documentation
and sample code that will help you get off to a productive
start. Many other features of Mac OS X, such as fine-grained
multithreading, make this operating system an extremely
versatile development environment.

<<

. 37
( 69 .)



>>