Red Hat Linux Command Line Quick Reference Card
Red Hat Linux Command Line Quick Reference Card
Red Hat Linux Command Line Quick Reference Card
bin - System executable tools, including cp, ls, mount, more, A glob in its most basic form is an * (often called "star" or "splat" when
and others. The bare minimum set of commands needed to spoken) which matches any number of any character. For example, if I
bring up a functional (though not very featureful) system. wanted to list all of the files in my directory with the letters "txt" in them, I
boot - The kernel boot images reside here. When a new could enter:
kernel is installed it will be installed here.
$ ls *txt*
dev - System devices, both physical and virtual. This is a
pseudo-filesystem that provides a file interface to the Or to list the contents of every directory that contains a specific date in
components of the system. Necessary in a Unix system the name:
because in Unix, everything is viewed as a file.
$ ls you
When /home/joe/*07-31*/*
are logged in as a normal, or unprivileged user, your shell
etc - Configuration files reside here. Nearly every configurable
command prompt will likely be a US dollar sign, or $ . If logged in as the
service on your system has a configuration file or configuration Other
rootglobs
user are
yourpossible
prompt too, thea?hash
will be matches
mark,one occurrence
or # of any
. Use the su
directory located in this directory. character.
home - Home directory for users. Each user will have a home
directory with the same name as their username located in this
Next,
commandif weto
need to find
switch fromananoccurrence
unprivilegedof some the root
user tospecific string user.
of text in
directory. one of 5,000 files, we can use grep. The command is followed by the
lib - System libraries live in this directory. A system library is string to match against and a filename, a list of filenames, or glob of files
an archive of program routines that provide user programs a to search for the text string. If it finds the string it will print a line
standard method to access the various functions of the identifying the file and display the line in which the string appears. To
operating system. find the file containing "blue shoes":
mnt - Filesystems that are generally mounted temporarily $ grep 'blue shoes' /home/joe/*.txt
usually go here. This would include floppy drives, CDROM
drives, and other removable media. Some sites place NFS
Finally, to find a file that we know the name of but can't locate amongst
mounts in this directory. our thousands of files, we use find. It takes at least two arguments: the
opt - Locally installed components. This directory is currently directory in which to begin the search, and the name of the file to find:
rarely used on Linux systems.
$ find . -name my-long-lost-file.txt
proc - The Linux kernel creates this filesystem on boot and fills
it with a wide range of files that provide access, either for To look for the file in the current directory and each of its subdirectories.
configuration or for viewing the contents of, many of the system
limits, settings, running processes, and a lot more.
root - The home directory for the root user. Software Installation
sbin - System bin, or the location of most of the system Installation of software under Red Hat Linux is achieved using rpm or
configuration and administration binary executable files. the Red Hat Package Manager. This package manager maintains a
database of all installed packages, their versions, and their
tmp - Temporary files, usually created by programs running on
dependencies. If all software is installed via packages, your system will
your system, reside here. These files are periodically cleaned be easier to maintain and keep up to date. It must be run by the root
from the system, and thus tmp should not be used for storage user.
of anything you don't want to be deleted.
usr - Within this directory is a second tier of directories. The following options are most commonly used:
Generally, user programs reside in one of the subdirectories of
-i install -U upgrade -F freshen -v verbose -h display a progress
meter -e uninstall or erase
/usr. For example, emacs lives in /usr/bin.
Current Working Directory and Dots
The -U option will install the package if a version is not already installed,
The term current working directory refers to the directory you are in
while the -F option only performs upgrades of packages that are already
currently. You may find the working directory using the pwd command.
present on the system.
Note the current directory is not in the path, thus simply typing the name
of an executable in the working directory will not succeed in running it.
For example, to upgrade Squid to the latest version:
To run a file in the working directory, you precede the filename with the
path to the file. Unix provides a shortcut to represent the working # rpm -Uvh squid-2.4STABLE1-i386.rpm
directory: a dot. So to run install.sh:
To upgrade a number of packages from a directory, without installing
$ ./install.sh
any new packages:
Two dots represents the directory above the working directory. # rpm -Fvh /home/joe/RPMS/updates/*.rpm