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