Switches Flashcards
type -a
returns all of the places that contain an executable named file
uname -a
show all information
history -c
clear the history
man -k
search man pages for a topic; requires the whatis database to work
man -k ““system information””
man #
select the section in the man page to open
man 5 passwd
xargs -d
specify the delimiter
defaults to space
cat -E
display a “”$”” at the end of each line
–show-ends
cat -n
adds line numbers to the beginning of every line.
–number
cat -b
adds line numbers to the beginning of every line that contains text
–number-nonblank
cat -s
compresses groups of blank lines down to a single blank line
–squeeze-blank
cat -T
displays tab characters as ““∧I””
–show-tabs
cat -v
displays most control and other special characters using carat ( ∧ ) and M- notations.
–show-nonprinting
join -t CHAR
use CHAR as input and output field separator
join -i
ignore differences in case when comparing fields
–ignore-case
expand -t NUMBER
have tabs NUMBER characters apart; not 8
–tabs=NUMBER
sort -f
ignore case
–ignore-case; (fold)
sort -M
sort by three-letter month abbreviation ( JAN through DEC )
–month-sort
sort -n
compare according to string numerical value
–numeric-sort
sort -r
reverse the result of comparisons
–reverse
sort -k KEYDEF
sort via a key; KEYDEF gives location and type
–key=KEYDEF
(KEYDEF can be two numbered fields separated by commas; to sort on multiple fields.)
E.G. sort -k 3 listing1.1.txt
split -b NUMBER
put NUMBER bytes per output file
–bytes=NUMBER
split -C NUMBER
put at most NUMBER bytes of records per output file
–line-bytes=NUMBER
split -l NUMBER
put NUMBER lines/records per output file
–lines=NUMBER
tr -t
first truncate SET1 to length of SET2
–truncate-set1
tr -d
delete characters in SET1; do not translate
–delete
unexpand -t LIST
use comma separated LIST of tab positions (enables -a)
–tabs=LIST
fmt -w NUMBER
maximum line width (default of 75 columns)
–width=NUMBER
nl -b STYLE
use STYLE for numbering body lines
–body-numbering=STYLE
STYLE is:
t (The default behavior is to number lines that aren’t empty. You can make this default explicit by using a style code of t .)
a (This style code causes all lines to be numbered; including empty lines.)
n (This style code causes all line numbers to be omitted; which may be desirable for headers or footers.)
pREGEXP (This option causes only lines that match the specified regular expression ( REGEXP ) to be numbered.)
nl -h STYLE
use STYLE for numbering header lines
–header-numbering=STYLE
STYLE is: t (The default behavior is to number lines that aren’t empty. You can make this default explicit by using a style code of t .) a (This style code causes all lines to be numbered; including empty lines.) n (This style code causes all line numbers to be omitted; which may be desirable for headers or footers.)
pREGEXP (This option causes only lines that match the specified regular expression ( REGEXP ) to be numbered.)
nl -f STYLE
use STYLE for numbering footer lines
–footer-numbering=STYLE
STYLE is: t (The default behavior is to number lines that aren’t empty. You can make this default explicit by using a style code of t .) a (This style code causes all lines to be numbered; including empty lines.) n (This style code causes all line numbers to be omitted; which may be desirable for headers or footers.)
pREGEXP (This option causes only lines that match the specified regular expression ( REGEXP ) to be numbered.)
nl -d CC
use CC for logical page delimiters
–section-delimiter=CC
nl -n FORMAT
insert line numbers according to FORMAT --number-format=FORMAT format is: ln (left justified; no leading zeros); rn (right justified; no leading zeros); rz (right justified with leading zeros).
pr -NUMBER
output COLUMN columns and print columns down; unless -a is used
–columns=NUMBER
default is 80
pr -d
double space the output
–double-space
pr -f
use form feeds instead of newlines to separate pages (by a 3-line page header with -F or a 5-line header and trailer without -F)
- -form-feed
- F
pr -l NUMBER
set the page length to PAGE_LENGTH (66) lines (default number of lines of text 56; and with -F 63). implies -t if PAGE_LENGTH <= 10
–length=NUMBER
pr -h STRING
use a centered STRING instead of filename in page header; -h “””” prints a blank line; don’t use -h””””
–header=STRING
pr -t
omit page headers and trailers; implied if PAGE_LENGTH <= 10
–omit-header
pr -o
offset each line with MARGIN (zero) spaces; do not affect -w or -W; MARGIN will be added to PAGE_WIDTH
–indent=NUMBER
pr -w NUMBER
set page width to NUMBER (72) characters for multiple text-column output only; -s[char] turns off (72)
–width=NUMBER
head -c NUMBER
print the first NUM bytes of each file; with the leading ‘-‘; print all but the last NUM bytes of each file
–bytes=[-]NUMBER
head -n NUMBER
print the first NUM lines instead of the first 10; with the leading ‘-‘; print all but the last NUM lines of each file
–lines=[-]NUMBER
tail -c NUMBER
output the last NUMBER bytes; or use -c +NUMBER to output starting with byte NUMBER of each file
–bytes=[+]NUMBER
tail -n NUMBER
output the last NUM lines; instead of the last 10; or use -n +NUM to output starting with line NUM
–lines=[+]NUMBER
tail -f
output appended data as the file grows;
–follow[={name|descriptor}]
tail –pid=NUMBER
with -f; terminate after process ID; PID dies
cut -b LIST
select only these bytes
–bytes=LIST
LIST can be a single number (such as 4 ); a closed range of numbers (such as 2-4 ); or an open range of numbers (such as -4 or 4- ).
cut -c LIST
select only these characters
–characters=LIST
LIST can be a single number (such as 4 ); a closed range of numbers (such as 2-4 ); or an open range of numbers (such as -4 or 4- ).
cut -f LIST
select only these fields; also print any line that contains no delimiter character; unless the -s option is specified
–fields=LIST
LIST can be a single number (such as 4 ); a closed range of numbers (such as 2-4 ); or an open range of numbers (such as -4 or 4- ).
cut -d STRING
use DELIM instead of TAB for field delimiter
–delimiter=STRING
cut -s
do not print lines not containing delimiters
–only-delimited
wc -l
print the newline counts
–lines
wc -w
print the word counts
–words
wc -c
print the byte counts
–bytes
wc -m
print the character counts
–chars
wc -L
print the maximum display width
–max-line-length
grep -c
Suppress normal output; instead print a count of matching lines for each input file. With the -v; –invert-match option (see below); count non-matching lines.
–count
grep -f STRING
Obtain patterns from file STRING; one per line. If this option is used multiple times or is combined with the -e (–regexp) option; search for all patterns given. The empty file contains zero patterns; and therefore matches nothing.
–file=STRING
grep -i
Ignore case distinctions; so that characters that differ only in case match each other.
–ignore-case
grep -r
Read all files under each directory; recursively; following symbolic links only if they are on the command line. Note that if no file operand is given; grep searches the working directory. This is equivalent to the -d recurse option.
–recursive
or use rgrep
grep -F
Interpret PATTERN as a list of fixed strings (instead of regular expressions); separated by newlines; any of which is to be matched.
–fixed-strings
or use fgrep
grep -E
Interpret PATTERN as an extended regular expression (ERE; see below).
–extended-regexp
or use egrep
sed =
Display the current line number
sed a\text
Append text to the file.
sed i\text
Insert text into the file
sed r filename
Append text from filename into the file
sed c\text
Replace the selected range of lines with the provided text
sed s/regexp/replacement/[g]
Replace text that matches the regular expression ( regexp ) with replacement
sed w filename
Write the current pattern space to the specified file.
sed q
Immediately quit the script; but print the current pattern space.
sed Q
Immediately quit the script.
rpm –root STRING
Modifies the Linux system having a root directory located at dir . This option can be used to maintain one Linux installation discrete from another one (say; during OS installation or emergency maintenance).
rpm –force
Forces installation of a package even when it means overwriting existing files or packages.
used with: -i ; -U ; -F
rpm -h
Displays a series of hash marks ( # ) to indicate the progress of the operation.
–hash
used with: -i ; -U ; -F
rpm -v
Used in conjunction with the -h option to produce a uniform number of hash marks for each package.
used with: -i ; -U ; -F
rpm –nodeps
Specifies that no dependency checks be performed. Installs or removes the package even if it relies on a package or file that’s not present or is required by a package that’s not being uninstalled.
used wih: -i ; -U ; -F ; -e
rpm –test
Checks for dependencies; conflicts; and other problems without actually installing the package.
used with: -i ; -U ; -F
rpm –prefix STRING
Sets the installation directory to STRING (works only for some packages).
used with: -i ; -U ; -F
rpm -a
Queries or verifies all packages.
–all
used with: -q ; -V
rpm -f STRING
Queries or verifies the package that owns file
–file STRING
used with: -q ; -V
rpm -p STRING
Queries the uninstalled RPM STRING
used with -q
rpm -i
Displays package information; including the package maintainer; a short description; and so on
used with -q
rpm -R
Displays the packages and files on which this one depends
–requires
used with -q
rpm -l
Displays the files contained in the package.
–list
used with -q
rpm -i
Installs a package; system must not contain a package of the same name
rpm -U
Installs a new package or upgrades an existing one
rpm -F
Upgrades a package only if an earlier version already exists
–freshen
rpm -q
Queries a package—finds whether a package is installed; what files it contains; and so on
rpm -v
Verifies a package—checks that its files are present and unchanged since installation
–verify
rpm -e
Uninstalls a package
rpm -b
Builds a binary package; given source code and configuration files; moved to the rpmbuild program with RPM version 4.2
rpm –rebuild
Builds a binary package; given a source RPM file; moved to the rpmbuild program with RPM version 4.2
rpm –rebuilddb
Rebuilds the RPM database to fix errors
cpio -i
extract an archive
cpio –make-directories
create directories
yum install
Installs one or more packages by package name. Also installs dependencies of the specified package or packages.
yum update
Updates the specified package or packages to the latest available version. If no packages are specified; yum updates every installed package.
yum check-update
Checks to see whether updates are available. If they are; yum displays their names; versions; and repository area ( updates or extras ; for instance).
yum upgrade
Works like update with the –obsoletes flag set; which handles obsolete packages in a way that’s superior when performing a distribution version upgrade
yum remove
Deletes a package from the system; similar to rpm -e ; but yum also removes depended-on packages
or erase
yum list
Displays information about a package; such as the installed version and whether an update is available
yum provides
Displays information about packages that provide a specified program or feature. For instance; typing yum provides samba lists all the Samba-related packages; including every available update. Note that the output can be copious.
or whatprovides
yum search
Searches package names; summaries; packagers; and descriptions for a specified keyword. This is useful if you don’t know a package’s name but can think of a word that’s likely to appear in one of these fields but not in these fields for other packages
yum info
Displays information about a package; similar to the rpm -qi command
yum clean
Cleans up the Yum cache directory. Running this command from time to time is advisable; lest downloaded packages chew up too much disk space.
yum shell
Enters the Yum shell mode; in which you can enter multiple Yum commands one after another
yum resolvedep
Displays packages matching the specified dependency.
yum localinstall
Installs the specified local RPM files; using your Yum repositories to resolve dependencies
yum localupdate
Updates the system using the specified local RPM files; using your Yum repositories to resolve dependencies. Packages other than those updated by local files and their dependencies are not updated
yum deplist
Displays dependencies of the specified package.
dpkg -i
Installs a package
–install
dpkg –configure
Reconfigures an installed package: runs the post-installation script to set site-specific options
dpkg -r
Removes a package but leaves configuration files intact
–remove
dpkg -P
Removes a package; including configuration files
–purge
dpkg –get-selections
Displays currently installed packages
dpkg -p
Displays information about an installed package
–print-avail
dpkg -I
Displays information about an uninstalled package file
–info
dpkg -l STRING
Lists all installed packages whose names match pattern
–list pattern
dpkg -L
Lists the installed files associated with a package
–listfiles
dpkg -S STRING
Locates the package(s) that own the file(s) specified by pattern
–search pattern
dpkg -c
pattern -C or –audit Searches for partially installed packages and suggests what to do with them
–audit
dpkg –root=STRING
Modifies the Linux system using a root directory located at STRING . Can be used to maintain one Linux installation discrete from another one; say during OS installation or emergency maintenance.
used with: all
dpkg -B
Disables packages that rely on one that is being removed.
–auto-deconfigure
used with -r
dpkg –force-things
Overrides defaults that would ordinarily cause dpkg to abort. Consult the dpkg man page for details of what (specified by things ) this option does.
used with: assorted
dpkg –ignore-depends=package
ignores dependency information for the specified package
used with: -i; -r
dpkg –no-act
Checks for dependencies; conflicts; and other problems without actually installing or removing the package
used with: -i; -r
dpkg –recursive
Installs all packages that match the package-name wildcard in the specified directory and all subdirectories
used with: -i
dpkg -G
Doesn’t install the package if a newer version of the same package is already installed.
used with: -i
dpkg -E
Doesn’t install the package if the same version of the package is already installed.
–skip-same-version
used with: -i
apt-cache showpkg
displays information about the packages listed on the command line.
eg: apt-cache showpkg samba
apt-cache stats
You can learn how many packages you’ve installed; how many dependencies are recorded; and various other statistics about the package database
apt-cache unmet
Find Unmet Dependencies
apt-cache depends
Display Dependencies
apt-cache pkgnames
Locate All Packages
If you include a second parameter; as in apt-cache pkgnames sa ; the program returns only those packages that begin with the specified string.
apt-get -d
Downloads package files but doesn’t install them.
–download-only
used with: upgrade ; dselect- upgrade ; install ; source
apt-get -f
Attempts to fix a system on which dependencies are unsatisfied.
–fix-broken
used with: install ; remove
apt-get -m
Ignores all package files that can’t be retrieved (because of network errors; missing files; or the like)
–ignore-missing ; or –fix-missing
used with: upgrade ; dselect- upgrade ; install ; remove ; source
apt-get -q
Omits some progress indicator information. May be doubled (for instance; -qq ) to produce still less progress information
–quiet
used with: all
apt-get -s
Performs a simulation of the action without actually modifying; installing; or removing files
–simulate ; –just- print ; –dry-run ; – recon ; or –no-act
used with: all
apt-get -y
Produces a ““yes’’ response to any yes/no prompt in installation scripts.
–yes ; or –assume- yes
used with: all
apt-get -b
Compiles a source package after retrieving it.
–compile; or –build
used with: source
apt-get –no-upgrade
auses apt-get to not upgrade a package if an older version is already installed.
used with: install
apt-get update
Obtains updated information about packages available from the installation sources listed in /etc/apt/sources.list .
apt-get upgrade
Upgrades all installed packages to the newest versions available; based on locally stored information about available packages.
apt-get dselect-upgrade
Performs any changes in package status (installation; removal; and so on) left undone after running dselect .
apt-get dist-upgrade
Similar to upgrade ; but performs ``smart’’ conflict resolution to avoid upgrading a package if doing so would break a dependency.
apt-get install
Installs a package by package name (not by package filename); obtaining the package from the source that contains the most up-to-date version.
apt-get remove
Removes a specified package by package name
apt-get source
Retrieves the newest available source package file by package filename using information about available packages and installation archives listed in /etc/apt/sources.list
apt-get check
Checks the package database for consistency and broken package installations
apt-get clean
Performs housekeeping to help clear out information about retrieved files from the Debian package database. If you don’t use dselect for package management; run this from time to time in order to save disk space.
apt-get autoclean
Similar to clean ; but removes information only about packages that can no longer be downloaded.
aptitude install STRING
install package STRING
aptitude install STRING-
uninstall package STRING
also remove STRING
aptitude remove STRING
uninstall package STRING
also install STRING-
aptitude full-upgrade
less conservative about removing packages in the upgrade process; and so it is more likely to complete its tasks. However; it may break software in the process.
aptitude safe-upgrade
conservative about removing packages or installing new ones and so may fail
aptitude search
earches the database for packages matching the specified name
aptitude autoclean
removes already-downloaded packages that are no longer available
aptitude clean
removes all downloaded packages
aptitude help
displays a complete list of options.
alien –to-deb
converts to debian
alien –to-rpm
converts to rpm
alien –to-tgz
converts to tgz
ldconfig -v
Display Verbose Information
ldconfig -N
causes ldconfig not to perform its primary duty of updating the library cache. It will; though; update symbolic links to libraries; which is a secondary duty of this program.
ldconfig -n
causes ldconfig to update the links contained in the directories specified on the command line. The system won’t examine the directories specified in /etc/ld.so.conf or the trusted directories ( /lib and /usr/lib )
ldconfig -X
the opposite of -N ; it causes ldconfig to update the cache but not manage links.
ldconfig -f STRING
change the configuration file from /etc/ld.so.conf to STRING
ldconfig -C STRING
change the cache file that ldconfig creates to STRING
ldconfig -r STRING
tells ldconfig to treat dir as if it were the root ( / ) directory. This option is helpful when you’re recovering a badly corrupted system or installing a new OS
ldconfig -p
Causes ldconfig to display the current cache—all of the library directories and the libraries they contain
uname -a
display all information
uname -n
displays the system’s node name; that is; its network hostname.
–nodename
uname -s
displays the kernel name; which is Linux on a Linux system
–kernel-name
uname -v
find the kernel version
–kernel-version
uname -r
The actual kernel version number
–kernel-release
uname -m
returns information about your machine. This is likely to be a CPU code; such as i686 or x86_64 .
–machine
uname -p
may return information about your CPU; such as the manufacturer; model; and clock speed; in practice; it returns unknown on many systems
–processor
uname -i
theoretically returns hardware platform information; this option often returns unknown
–hardware-platform
uname -o
returns the OS name—normally GNU/Linux for a Linux system
–operating-system
ps –help
Display Help
ps -A
Display All Processes
also -e
ps -e
Display All Processes
also -A
ps x
Lift the BSD-style ““must have a tty”” restriction;
displays all processes owned by the user who gives the command
ps -u STRING
display processes owned by user STRING
–User user
also U STRING
STRING may be a user name or uid