This type of command can be used in a script to automate posting.
To learn more about curl and how you can use it in scripts, you can
read the man page or download a tutorial available online.
TYPE THIS: RESULTS:
[ferro:˜] curl -O http://curl.planetmirror.com/
The httpscripting.html tutorial downloads.
вЂ№ Type the URL of a Web вЂ№ Type echo вЂ“n "URL> " and
DOWNLOAD A BINARY FILE CREATE A SCRIPT FOR
page containing a press Return, then type set
вЃ„ Type curl followed by a PAGES WITH CURL
compressed tar file and press URL = $< and press Return
вЃ„ Start the Pico editor to
В¤ Type -O followed by a create a file named copy_url.
вЂє Type cd ˜/src; curl вЂ“O
Note: On a dial-up connection, this
В¤ Type #!/bin/tcsh and press
may take awhile to download. http://$URL.
в– The specified binary file Л‡ Save your file, and exit
UNIX FOR MAC
ENABLE REMOTE ACCESS
TO YOUR COMPUTER
more information). Alternatively, you can configure the service
ou can allow others to log on to your computer or
to start whenever a request arrives. In this latter case, another
make it possible for you to log on to your Mac OS X
process listens for requests on behalf of the service and starts
system from another system.While Mac OS X systems
it as needed. The decision as to which method to use
make it possible for you to log on to remote systems,
depends on the particular service. Web servers, such as
browse Web sites, and download files, they do not allow
Apache's httpd, are better run all of the time. This provides
others to log on to your system or access files on your
better Web performance. Services such as ftp and telnet
system. If you want to allow this type of access, you have to
that are used only now and then are better run on an as-
enable it by modifying your system's configuration.
needed basis. You configure as-needed access through the
There are two basic ways to provide a network service on
your Mac OS X system. You can start the service вЂ” for
To modify system configuration information in Mac OS X,
example, start up a Web server вЂ” by typing the name of the
you need to be a privileged user. The sudo command,
server process on the command line. These services are
which allows you to run a command as root, works well for
designed to run in the background and continue running until
this purpose if you are allowed access.
you shut your system down or kill them. See Chapter 7 for
ENABLE REMOTE ACCESS TO YOUR COMPUTER
в– Your cursor is positioned
вЃ„ Type sudo vi В¤ Type your password if вЂ№ Type /#ftp and press
/etc/inetd.conf and prompted. Return. at the beginning of the line
press Return. detailing the ftp service.
WORK WITH INTERNET COMMANDS
Whenever you use the sudo command, you
Files responsible for the configuration of a
are prompted to enter your password to
Unix system, Mac OS X included, are always
ensure that you are the user entrusted with
set up so that only the root is able to make
sudo privileges and not someone who has
changes. This is important to system security
just walked up to your unattended Terminal
because it ensures that only trusted users can
window. If you enter another command
modify the configuration of a system. As a
shortly afterwards, you do not have to enter
system manager, you have two choices when
your password again. The sudo command
you need to change a configuration file. You
includes a timer that allows you to work for
can switch users to the root account with the
five minutes before asking for your password
su command; su - sets you up as root with
root's environment. Alternatively, you can
use the sudo command to run the command
You must be set up as a system administrator
that only root can run otherwise.
or listed in the /etc/sudoers file to use sudo.
[ferro:˜] sudo date
On the first call to sudo, the system
[ferro:˜] sudo date
asks you to enter your password.
On the second call, it does not.
в– The inetd process reads
вЂє Type x to remove the # Л‡ Type :wq and press ГЃ Type ps -aux | grep inetd
character below your cursor. Return. and press Return. the /etc/inetd.conf file,
enabling the ftp server.
вЂЎ Type sudo kill -HUP
В° Type ftp localhost and
followed by the process ID
for inetd and press Return. press Return.
в– The ftp service that you
just enabled responds to your
UNIX FOR MAC
INTRODUCTION TO SYSTEM
ou can effectively administer a Mac OS X system by
learning some basic commands. Unix administration
is a complex job, but Mac OS X provides many tools
for making the job manageable.
The basic responsibilities of any Unix system system crashes or if someone mistakenly deletes the
administrator are to keep the system running smoothly wrong files from their account. System administrators
and to ensure that important data and configuration also manage accounts for other users. They establish an
files are preserved. To administer a Mac OS X system, account for each user and ensure that the user can use
you need to understand the fundamentals of file the tools and applications they need.
systems, know how to set up user accounts, recognize
Users in large companies can often rely on help from a
when the system is having problems, and be prepared
user support team. If you are using Mac OS X at home
to manage applications and disk space.
or in your small business, you are probably responsible
System administrators routinely back up the systems for managing the system yourself; in effect, you are your
they manage. This allows them to restore files if the own system administrator.
Critical to the role of a system administrator is the belonging to any user, modify any configuration file,
concept of privilege. In order to install applications and and shut the system down or reboot it from the
modify configuration files, you need to have access to command line.
the root or superuser account or to be a privileged user.
While the privileges assigned to the root user are most
A normal user on a Unix system can only work on files
significant when a Mac OS X system is managed by one
in their home directory.
person and used by many, use of the root account is
The root user has virtually unrestricted access to the important even on systems where root and user are one
system. As a result, the root user can modify files and the same person.
SYSTEM ADMINISTRATION COMMANDS
MANAGE MAC OS X
Mac OS X is not only different from Mac OS 9 and earlier You also need to know the basic file system layout вЂ”
versions of Mac OS, it is also different from other versions where the system stores files вЂ” and you must also know
of Unix. For example, the root user on a Mac OS X system whether you should pay attention to the files you find in
is disabled by default. This means that you cannot simply the /etc directory вЂ” the normal configuration directory
adopt the root identity and run commands that you are on Unix systems.
not allowed to run as a normal user. Instead, you need to
The table below contains a list of some of the most
either preface these commands with the word sudo, or
important Mac OS X commands for system administrators.
you need to activate the root account.
COMMAND MOST COMMON USE COMMAND MOST COMMON USE
Find related commands. Present the manual page for a system
Change the owner and, optionally, Attach a file system to the system.
the group of a file.
Compress a file. Look at routing tables, network
connections, or network statistics.
Edit a cron file. Create a new file system.
crontab -e newfs
List cron jobs. Display network information from
crontab -l nidump
Display free and used disk space. Print tables from NetInfo.
Display disk space usage. Look up DNS information.
Dump a file system to a Change the password for a user.
backup device or a file.
Reboot the system without a Test the connection to a system
disk check. by asking for a reply.
Examine or change DOS Display information on running
partitioning information. processes.
Determine the type of a file. Shut down and reboot the system.
Find files using particular criteria. Shut down a system gracefully.
Check the integrity of a file system. shutdown -r now Shut down and reboot a system
Unzip a file zipped with gzip. Display the strings in a binary file.
Compress a file. Create a file archive or read from one.
Shut down a system immediately. Display statistics on the most demanding
Display or change network interface Update the last changed date on a file
information. or create an empty file.
Send a signal to a process, Unmount a file system which is currently
possibly terminating it. mounted.
Create a symbolic or hard link to a file. Uncompress a file compressed with the
Display a printer queue.
UNIX FOR MAC