Command and Switches Flashcards

1
Q

lscpu

display offline and online CPUS

A

-a | –all

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

lscpu

only online CPU info

A

-b | –online

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

lscpu

only offline CPU info

A

-c | –offline

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

lscpu

display the info in a more readable format

A

-e | –extended = [list]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

lscpu

column(s) to include (default is all - examples include ‘cpu’ or ‘node’)

A

[list]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

lscpu

provide info displayed in a comma delimeted form used for logging - used by other apps for reporting

A

-p | –parse

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

lscpi

controls the level of verbosity of the info displayed

A

-v | -vv | -vvv

the second value is v v. not w

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

lscpi

displays the PCI info in a parseable format

A

-m | -mm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

lspci

nicely formatted listing of PCI h/w on system

A

-vmm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

lspci

displays a tree view of the PCI devices on the system (just device slot/port

A

-t

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

lspci

associate the device names with the IDs in a tree view

A

-tvmm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

lsscsi

output is the same as running cat /proc/sci/scsi

A

-c | –classic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

lsscsi

provides additional ‘major/minor’ device numbers behind each detected device

A

-d | –device

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

lsscsi

generice scsi device file name (sg)

A

-g | –generic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

lsscsi

additional info for each device

A

-l | –long

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

lsscsi

print disk size in more readable format

A

-s | –size

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

lsscsi

controls level of verbosity

A

-v | -vv | -vvv

v v not w

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

lsusb

shows specified bus and device number info

A

-s [bus][:][device #]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

lsusb

show only devices with indicated vendore and product ID in hex format

A

-d [vendor]:[product #]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

lsusb

only this user can issue the
-D [device]

A

root

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

lsusb

displays hierarch in tree view

A

-t

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

lsusb

verbose device output

A

-v

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

lsblk

list empty devices as well - turned off by default

A

-a | –all

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

lsblk

print only top level device information

A

-d | –nodeps

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
lsblk exclude the indicated devices - comma separated
-e | --exclude
26
lsblk include info on filesystems
-f | --fs
27
lsblk use ASCII characters for tree view
-i | --ascii
28
lsblk output list format
-l | --list
29
lsblk tree view of disk devices and partitions
shutdown -t
30
sysvinit: shutdown will halt the system - shut it down
shutdown -h
31
sysvinit: shutdown reboot the system
shutdown -r
32
sysvinit: shutdown power off (if ACPI is available)
shutdown -P
33
sysvinit: shutdown cancels shutdown
shutdown -c
34
sysvinit: shutdown broadcasts wall message to logged in users
shutdown -k [message]
35
sysvinit: shutdown indicates when the shutdown takes place in sec, min, specific time or now
shutdown [option]
36
sysvinit: halt does not shutdown only halts
halt -f halt --force
37
sysvinit: halt power off after shutdown if ACPI available
halt -p halt --poweroff
38
sysvinit: halt only LOGS the shutdown but does actually do the shutdown or reboot
halt -w halt --wtmp-only
39
sysvinit: halt displays more information for troubleshooting
halt --verbose
40
GRUB - Legacy: Key Setting determines the menu option that will be started if nothing else is chosen
grub default=[#]
41
GRUB - Legacy: Key Setting the amount of time in seconds that you have to choose another option
grub timeout=[#]
42
GRUB - Legacy: sections (menu list entries) text based description of menu entry
grub title [description]
43
GRUB - Legacy: sections (menu list entries) the hard drive device number and partition of the root drive where the kernel is
grub root[(hd#,#)]
44
GRUB - Legacy: sections (menu list entries) kernel path read options label options passed to it on system start
grub kernel[/boot/vmlinux-# options root=LABEL=/ options]
45
GRUB - Legacy: sections (menu list entries) path to the initial RAM disk image for the chosen menu entry
grub initrd [/boot/initrd#.img]
46
GRUB - Legacy: sections (menu list entries) menu list is edited with this during boot loader display
grub e
47
GRUB - Legacy: sections (menu list entries) Grub command line can be accessed with this at menu
grub c
48
GRUB - Lecacy: reinstall device can be identified by drive path /dev/hda /dev/hd0
grub-install [device]
49
GRUB - Legacy application that will show the GRUB command prompt to explore the environment (finding primary device path and number)
grub
50
GRUB2 used to generate GRUB config file
grub2-mkconfig sometimes grub-mkconfig
51
GRUB2 output to the specified location and file
grub2 -o [/path/grub.cfg]
52
GRUB2 installs GRUB2 to the indicated location drive master boot record full path
grub2-install
53
apt-get read remote repository package listing (refresh)
apt-get update
54
apt-get upgrade the existing system and installed software with any new versions reported as available in configured repositories
apt-get upgrade
55
apt-get install indicated package (not .deb file general pkg name) as well as all its dependencies
apt-get install [packagename]
56
apt-get upgrades all packages on the system one time to the next available version of Ubuntu/Debian in repositories
apt-get dist-upgrade
57
apt-get removes the package's files but any config files and directories will be left alone
apt-get remove [packagename]
58
apt-get removes package(s) files AND any config files and directories associated with it
apt-get purge [packagename]
59
apt-get will only download the .deb package and place it in /var/cache/apt/archives
apt-get -d [packagename] apt-get --download-only [packagename]
60
apt-cache search for packages matching the indicated value
apt-cache search [value]
61
apt-cache show available info about the indicated package
apt-cache show [packagename]
62
apt-cache additional tech info about package dependencies and services
apt-cache showpkg [packagename]
63
dpkg will display package contents
dpkg --info [packagename]
64
dpkg an abbreviated display of the --info option
dpkg --status [packagename]
65
dpkg will install the indicated package name on the system
dpkg -i [packagename] dpkg --install [packagename]
66
dpkg removes the package(s) files but any config files and directories will be left alone
dpkg -r [packagename] dpkg --remove [packagename]
67
dpkg removes the package(s) files AND any config files and directories associated with it
dpkg -P [packagename] dpkg --purge [packagename]
68
dpkg list all files that were installed with the indicated package
dpkg -L [packagename] dpkg --listfile [packagename]
69
dpkg search for indicated installed file within the package database for all mentions of the indicated file or string
dpkg -S [filename] dpkg --search [filename]
70
dpkg allows you to force the removal of a package marked as requiring install
dpkg --force-reinstreq [packagename]
71
dpkg used with -i or --install to force the install of a package with conflicting dependencies **could result in unusable state**
dpkg --force-conflicts [packagename]
72
dpkg some apps will include a tool for configuring the app during install mail servers database servers if you need to rerun that config tool for a package you can do it with this command
dpkg-reconfigure [packagename]
73
YUM will read the configured repositories and local cache and upgrade all installed system apps does NOT do distribution version upgrade
yum update yum upgrade
74
YUM enable a disabled repo for the current transaction only
yum --enablerepo [reponame]
75
YUM installs the package along with all required dependencies
yum install [packagename]
76
YUM when added to install will download the indicated package
yum --downloadonly directory the package downloaded to /var/cache/yum/[architecture]/[version]/base/packages
77
YUM removes package and does NOT remove previously installed dependencies
yum remove [packagename]
78
YUM remove unused dependencies
yum autoremove
79
YUM added to any yum transaction will skip the affirmation step
yum -y
80
yumdownloader download only source RPM
yumdownloader --source
81
yumdownloader display the URL of files without downloading
yumdownloader --urls
82
yumdownloader allows you to indicate the directory to store the package download
yumdownloader --destdir
83
yumdownloader includes any dependencies
yumdlownloader --resolve
84
rpm rebuilds the local RPM database in the /var/lib/rpm directory and only root can do this using sudo
rpm --rebuilddb
85
rpm install removal query accomplished by long or short
package names
86
rpm shows all packages meeting the indicated values that are installed
rpm -q [long/short packagname]
87
rpm detailed info about indicated values that are installed
rpm -qi [long/short packagname]
88
rpm listing of all files installed with package
rpm -ql [long/short packagname]
89
rpm show the appropriate details about a file NOT installed as named
rpm -qip rpm-qlp [package.rpm]
90
rpm display changelog for indicated package and must be used with -q
rpm --changelog [long/short packagename]
91
rpm display all config files for the indicated package
rpm -qc [long/short packagename]
92
rpm show req of indicated rpm files
rpm -qRp [package.rpm]
93
rpm show package that indicated file dependency belongs to
rpm -qf [/path/of/file/to/check]
94
rpm validate using package checksums for indicated package result of 'NOT OK' could mean problem but it might just mean the signature key needs to be imported
rpm -K rpm --checksig [package.rpm]
95
rpm import the indicated keyfile from the package maintainer, renun the validation command once the key is installed
rpm -i rpm --install [package.rpm]
96
rpm during activity, print a 'status" bar using hash '#' character used in conjunction with other options
rpm -h rpm --hash [package.rpm] ie rpm -ivh telnet-0.17-60.el6.x86_64.rpm will install the indicated package with hash status under the command in verbose mode
97
rpm option added during install or removal to force install/removal even if there are conflicts with existing files or packages
rpm --force
98
rpm option added during install that replaces duplicate files
rpm --replacefiles
99
rpm option added during install or removal to force the instal/removal of package without the indicated dependencies this can make system unuseable
rpm --nodeps
99
rpm verify integrity of package will compare current install and config to default install and config
rpm -V [long/short packagename]
100
rpm verify ALL installed packages on the system
rpm -Va
101
rpm verify ALL installed package config files on the system and captured for later comparison
rpm -Vac
102
rpm install or upgrade the indicated package name while removing previous versions if they exist
rpm -U
103
rpm win ONLY upgrade the indicated package if it is already installed, if not installed nothing will be done
rpm -F rpm --upgrade [packagename]
104
rpm erases the indicated package name
rpm -e rpm --erase [short/long packagename] NOTE: if short name is used and multiple matches for that short name are found, an error will be displayed and the long name must be used OR --allmatches must be added to the command (CAUTION
105
set turns option on
set -o [option]
106
set turns option OFF
set +o [option]
107
sort output a default sort of each line - top to bottom on the screen
sort [filename]
108
sort perform the sort at start of the second delimited field
sort -k[#] [filename]
109
sort sort file numerically paying attention to the entire number not just column 0
sort -n [filename]
110
nl will number all lines with data - default
nl [filename]
111
nl will number all lines even if line is empty
nl -ba [filename]
112
wc number of lines
wc -l
113
wc number of words
wc -w
114
wc number of characters (bytes)
wc -c
115
expand converts tabs to # of spaces indicated
expand -t expand --tabs=[#]
116
cut display only column or range of columns from the indicated file name
cut -c [#] [-#] [filename]
117
cut sets the delimiter to use when dealing with fields default - TAB
cut -d[delimiter]
118
cut identify field numbers (id's by delimiter) to display from indicated filename
cut -f [field1[,field2[,field3]]] [filename]
119
join uses the indicated character as the field separator (delimiter)
joing -t [character]
120
uniq print ONLY the unique lines in the file
-u [filename]
121
uniq print an example of each line that is duplicated in a file
-d [filename]
122
uniq to print ALL instances of duplicate lines in a file
-D [filename]
123
head display n number of lines beginning at the bottom of indicated file
head -n [#] [filename]
124
tail display indicated file (default last 10 entries) but will then follow the files output adding additional values to the display as they are written
tail -f [filename]
125
split when the split files are created named them x#
split -a [#]
126
split new files contain the indicacted number of bytes/kilobytes/megabytes
split -b [#] [b/k/m]
127
split new files contain the indicated number of lines of bytes
split - [#]
128
split new files contain indicated number of lines
split -l [#]
129
od display named binary file
od -a
130
od decimal format
od -d
131
od floating point format
od -f
132
od octal format
od -o
133
od hexadecimal format
od -x
134
pr format text data in a file into the indicated number of columns for printing
pr --columns=[#]
135
pr print columns across instead of down and used in conjunction with --columns
pr -a pr --across
136
pr double space the line output
pr -d pr --double-space
137
pr customize the header text replacing the filename with the indicated text
pr -h pr --header=[text]
138
pr omits header from output
pr -t pr --omit-header
139
fmt desired width to break each line at
fmt -[#]
140
fmt split long lines over 50 chars without filling
fmt -s
141
sed most commonly used basic option that substitutes what comes next
sed s/
142
sed the values to search for in the stream
sed [value(s)]/
143
sed values to replace first value(s) with
sed [values(s)]/
144
sed when the command is ended with replaces ALL instances of the first value with the second, if omitted, will only replace first occurrence of first value with second
sed g
145
sed used to chain multiple filters together instead of the ; character
sed -e
146
sed can use a file containing multiple lines of options to perform on the indicated filename
sed -f [scriptlistfile] [filename] sed treats the file as stream and outputs standard output it does not change the file itself
147
sed display only the changed lines (instead of -g that shows all)
sed -pg
148
sed suppresses the printing of 'pattern space' and can prevent lines from appearing multiples times in output
sed -n or sed --quiet
149
sed provide single list or range of line numbers to perform the substitution on
sed [#] [-/,] [#]
150
more prompt space -- continue q -- quit rather than CTL-C or q
more -d
151
more specify the screen size in lines - default is 50 or the size of the terminal (if GUI terminal providing that info)
more -num [#]
152
more clear the screen before starting the first screen display
more -p
153
ls long listing containing permissions owner size date/time stamp
ls -l
154
ls list files including hidden files
ls -a
155
ls list just the directory without list the files init
ls -d
156
ls display the inode numbers for the file or directory
ls -i
157
ls add human readable format to filesizes and details
ls -h
158
cd your home directory's tmp subdirectory
cd ~/tmp
159
cd home directory of the tmp user
cd ~tmp
160
cd reference to current directory
cd .
161
cd moves up one directory
cd ..
162
mkdir make all directories in indicated path if they do not already exist
mkdir -p
163
touch sets the date/time as indicated for the file
touch -t [date] [filename] date/time format - yyyymmddhhmm (y-year, m=month, d=day, h=hour, m=minute)
164
touch applies the indicated date/time in the referencefile to the filename or multiple files
touch -r [referencefile] [filename] used to define a starting point for files without having to remember the value
165
stat display the file system status instead of file status
stat -f stat --file-system
166
stat display the info in terse (short) form
stat -t
167
cp do not follow symbolic links - just copy the link
cp -d
168
cp force overwrite if the file already exists in the destingation
cp -f
169
cp ask before overwriting an existing file
cp -i
170
cp create hard link to the original
cp -l
171
cp create symbolic link to the original
cp -s
172
cp recursively apply any options to other directories and subdirectories in the indicated path
cp -r cp -R
173
cp update copies only if the original is newer than the existing file or create destination file if it does not exist
cp -u
174
cp do not include any files/directories from other filesystems (network shares)
cp -x
175
mv check to see whether the destination already exists and will prompt overwrite
mv -i
176
mv do not overwrite the destination file or directory if it is newer than the original
mv -u
177
mv do not prompt for directory entry change (often default)
mv -f
178
dd used as an input image file like .img or .iso device like /dev/sr0
dd if =[image file or device]
179
rm recursively removes files (and subdirectories if target is directory)
rm -r
180
rm do not prompt for confirmation on deletion
rm -f
181
rm prompt for EVERY file/directory to be removed
rm -i
182
find where to begin the search
find [starting path]
183
find what type of thing to find
find -[options]
184
find what you are trying to find filename directory globbed name
find [value(s)]
185
tar create archive
tar -c required
186
tar display contents of archive
tar -t required
187
tar extract the contents of the archive
tar -x required
188
tar name of the file to create
tar -f
189
tar compress/uncompress with bzip2 - not always available by default but is the best compression method)
tar -j
190
tar compress/uncompress with gzip (available by default and is most commonly used compression method)
tar -z
191
tar verbose messages (this output approximates the output of ls -al as the archive is being created/unarchived/viewed
tar -v
192
cpio runs in copy-out mode by default to stdio or screen
cpio -o cpio --create
193
cpio creates the indicated file instead of using standard output
cpio -O [archivefile]
194
cpio make leading directories if needed
cpio -d cpio --make-directories
195
cpio extracts the content in copy-in mode by default to stdio or the screen
cpio -i cpio --extract
196
cpio use the archive file indicated rather than standard input form a command or redirected file
cpio -I [archivfile]
197
cpio verbose message
cpio -v
198
gzip or gzip2 recursive includes all files and directores
gzip -r
199
xz compress file indicated
xz -z xz --compress
200
xz decompresses the file indicated
xz -d xz -- uncompress xz --decompress