Appendix A. Command Line Reference


This appendix contains brief summaries of most of the command line tools mentioned throughout this book, and others that might be helpful, listed in alphabetical order. This reference is by no means comprehensive, but should serve as a helpful reminder of what the various commands and command line options do. For more information on any command, the Linux online manual, accessible via man commandname , is a great place to start.


Tip: Keep in mind that the Linux command line is case sensitive; the options -a and -A are not the same thing.

apachectl command

Control the Apache Web server's HTTPd daemon. Note that in Fedora Core 4, this tool is located in /usr/sbin, which is not part of the default PATH.


start

Start the daemon.


stop

Stop the daemon.


restart

Stop and then start the daemon, killing all current sessions. This command is useful for making changes to httpd.conf take effect.


fullstatus


status

Display Apache's current status. fullstatus includes a list of the current requests being serviced; status does not.


graceful

Wait until all current requests are serviced, then restart the daemon.


configtest

Test the Apache configuration files to make sure they're syntactically correct.


at time

Schedule a once-off job at time. Hit CtrlD to exit at.


atq

Display the queue of jobs scheduled with at. Run as root to see all users' scheduled jobs.


atrm job

Remove a job scheduled with at. job is the job ID, as displayed by atq.


cat options file

Print file to the screen.


-n

Print line numbers.


cd directory

Change the working directory to directory; if directory is omitted, the user's home directory is assumed.


cdrecord options dev=device file

Burn data from file to the CD burner or DVD burner specified by device. If file is an ISO image, the files in the image's filesystem will be burnt onto the disk.


-sao

Write the disk in session-at-once (or disk-at-once) mode.


-tao

Write the disk in track-at-once mode.


-multi

Burn a multi-session disk; this allows you to add to the filesystem at a later date.


-eject

Automatically eject the disk once burning is complete.


speed=n

Burn the disk at n-speed.


chgrp group file

Change the group ownership of a file.


-R

Change the group ownership recursively.


-v

Be verbose in describing the ownership changes.


chkconfig option service

Control which services are started and stopped at given runlevels when the computer is booted.

Note that in Fedora Core 4, this tool is located in /sbin, which is not part of the default PATH.


--list

List the services installed on this system, and when they're configured to start.


--add

Add a daemon to be managed by chkconfig.


--del

Remove a daemon from chkconfig's management.


--level level

Configure which services start at given runlevels; level specifies which levels the service starts at. You'll also need to include on or off at the end of the command line. For example, service --level 345 httpd on sets up Apache to start at runlevels 3, 4, and 5.


chmod options mode file

Change file permissions (or mode).

mode comprises the following information:

  • who these permissions apply to: group (g), owner (u), or others (o)

  • whether the permissions are being granted (+) or denied (-)

  • which permissions are being dealt with: write (w), read (r), and/or execute (x)

For example, u+x grants executable permission to the file's owner; g-rw denies users in the file's group read or write access.


-R

Change permissions recursively.


chown user file

Change file ownership.

user can be either a user name, or a user name and a group name in the form user:group. This will cause the owning user and group to be changed.


-R

Change ownership recursively.


-v

Print information about each file regardless of whether or not the ownership has changed.


cp options source destination

Copy a file or directory.


-f

If the copy tries to overwrite a file, force the overwrite, suppressing any prompts for confirmation. The opposite of this is -i, which will confirm every overwrite.


-i

Prompt the user before overwriting any files.


-b

When you copy a file to a location at which a file with the same name exists, -b creates a backup of the old file.


-p

Preserve all information, including file ownership.


-r

Copy the directory and everything it contains.


-u

Only replace files if the modification date of the file being copied is more recent than that of the file in the destination directory. This will ensure that you have the most up-to-date files in the destination directory.


df options

Produce a report of disk usage across filesystems.


-h

Display numbers in a more user-friendly form. For example, 1024 bytes would be displayed as 1k if the -h option were enabled.


-T

Include the type of filesystem in the report.


echo text

Print text to the screen.


exit

Exit from the current shell session. Run this after su to return to the original user, or, in a terminal session, to close the terminal application.


find options expression

Find files.


-L

Follow symbolic links.


-atime ±n

Find files that were accessed more or less than n days ago. -atime +5 finds files that were accessed more than five days ago; -atime -5 finds files that were accessed less than five days ago.


-ctime ±n

Find files that were created more or less than n days ago.


-mtime ±n

Find files that were modified more or less than n days ago.


-name pattern

Find files with names that match pattern.


grep options pattern file(s)

Search files for a regular expression pattern.


-r

Read all files under this directory recursively.


-w

Match on whole words only.


groupadd groupname

Create a group called groupname.


groupdel groupname

Delete the specified group.


htpasswd options filename username password

Add users to an Apache user file. You can specify the password on the command line, or omit it to be prompted for the password.


-c

Create a new password file.


-D

Delete the specified user.


ll options directory

Synonymous with ls -l. See ls for more information.


ln options linktarget link

Create a link to linktarget at link.


-s

Create a symbolic link.


ls options directory

Display a list of files in the specified directory or, if no directory is specified, the working directory.


-a

Show all files, including hidden files.


-l

Show listing in long format. In Fedora Core, ll is a synonym for ls -l.


man command

Read the online manual for command. Use the up and down arrows to move through the manual, and press Q to quit.


mkdir options directory

Create a directory.


-p

Make any required parent directories. For example, mkdir -p ~/foo/bar would create the directories foo and bar. Without the -p option, this would fail.


-m mode

Set permissions for the new directories. mode is defined as for chmod.


mkisofs options directory

Create an ISO disk image containing the files from directory.


-f

Follow symbolic links when creating the image.


-l

Use full-length 31-character file names.


-o filename

Specify the location to which the disk image will be written.


-A name

Name the filesystem. If you burn this ISO image to a CD, this will be the disk's volume label.


mount options device mountpoint

Mount the specified device at the specified mount point. If device is omitted, /etc/fstab will be searched for a device with the specified mount point.


-t type

Specify the filesystem type (ntfs, hfs, ext3, etc.).


-r

Mount the file system in read-only mode.


mv options source destination

Move or rename a file from source to destination. mv foo /var/backup moves the file foo into the directory /var/backup; mv foo bar renames the file foo to bar.


-b

When you're moving a file to a location at which a file with the same name exists, -b will create a backup of the old file.


-i

Prompt the user before overwriting any files.


-u

Only replace files if the modification date of the file being moved is more recent than the file in the destination directory. This will give you the most up-to-date files in the destination directory.


newaliases

Inform the Sendmail daemon that its aliases file has changed.


passwd options username

Set the password for the user username. If username is omitted, the current user is assumed.


-u

Unlock the user's account.


-n days

Set the password's minimum lifetime to days days.


-x days

Set the password's maximum lifetime to days days.


-w days

Specify the number of days in advance of password expiration that the user will start to receive warnings that their password is about to expire.


pwd

Print the current working directory.


rm options filename

Remove a file or directory.


-f

Force the removal of the file, suppressing any prompts for confirmation. The opposite of this is -i, which will confirm the deletion of every file.


-r

Remove a directory recursively.


service name action

Control services or daemons installed on the system. name is the name of the daemon, and action is one of start, stop, restart, or status.

Note that in Fedora Core 4, this tool is located in /sbin, which is not part of the default PATH.


sleep seconds

Pause for seconds seconds.


shutdown options time

Shut down the computer safely. The time argument can be specified in hh:mm format, as a + character followed by a number of minutes, or as the word now.

Note that in Fedora Core 4, this tool is located in /sbin, which is not part of the default PATH.


-r

Reboot the computer after shutdown.


-c

Cancel a shut down. When used, shutdown does not require a time.


ssh options username@servername command

Connect to servername as username via SSH. If command is specified, it will be executed and your SSH session will be ended. If command is omitted, a shell session will be opened to the server.


-L localport:servername:serverport

Set up port forwarding over the SSH connection between localport and serverport on servername.


su user

Switch to user at the command line. If user is omitted, root is assumed.


tail options filename

Display the last few lines of filename.


-n

Display the last n lines. For example, tail -7 filename would display the last seven lines in filename.


-f

Display lines as they're added to the file. Press Ctrl C to exit.


umount mountpoint

Unmount the filesystem mounted at mountpoint.


useradd options username

Create a user called username.


-G groupname

Add the new user to the group groupname.


-c fullname

Create the user with the full name fullname. If this name contains spaces, it should be surrounded by quotation marks; for example, useradd -c "Robert Jones" rj would create the user "rj" with the full name "Robert Jones."


userdel options username

Delete the specified user.


-r

Delete the user's home directory and any local email for that user.


vncpasswd

Set the password required to connect to a VNC server.


vncserver

Start the VNC server daemon.


wget options url

Download a file from a URL via HTTP, HTTPS, or FTP.


-c

Resume the download of a partially downloaded file.


--http-user=user


--http-password=password

This command allows you to specify a username and password for basic HTTP authentication.


yum options command

Manage installed RPM packages.


-y

Automatically answer "yes" to all questions.


install package

Install the latest available version of package.


update package

Install any available updates to package. If package isn't specified, yum will update all the packages installed and managed by yum.


check-update package

Check for an update to package. If package isn't specified, yum will check for updates to all packages installed and managed by yum.


remove package

Remove the installation of package and the packages that depend on it.


info package

Display a description of package.


clean

Clean yum's cache of RPM headers.


search text

Search the packages managed by yum for the string text.




Run Your Own Web Server Using Linux & Apache
Run Your Own Web Server Using Linux & Apache
ISBN: 0975240226
EAN: 2147483647
Year: 2006
Pages: 92

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net