Command and Switches Flashcards
lscpu
display offline and online CPUS
-a | –all
lscpu
only online CPU info
-b | –online
lscpu
only offline CPU info
-c | –offline
lscpu
display the info in a more readable format
-e | –extended = [list]
lscpu
column(s) to include (default is all - examples include ‘cpu’ or ‘node’)
[list]
lscpu
provide info displayed in a comma delimeted form used for logging - used by other apps for reporting
-p | –parse
lscpi
controls the level of verbosity of the info displayed
-v | -vv | -vvv
the second value is v v. not w
lscpi
displays the PCI info in a parseable format
-m | -mm
lspci
nicely formatted listing of PCI h/w on system
-vmm
lspci
displays a tree view of the PCI devices on the system (just device slot/port
-t
lspci
associate the device names with the IDs in a tree view
-tvmm
lsscsi
output is the same as running cat /proc/sci/scsi
-c | –classic
lsscsi
provides additional ‘major/minor’ device numbers behind each detected device
-d | –device
lsscsi
generice scsi device file name (sg)
-g | –generic
lsscsi
additional info for each device
-l | –long
lsscsi
print disk size in more readable format
-s | –size
lsscsi
controls level of verbosity
-v | -vv | -vvv
v v not w
lsusb
shows specified bus and device number info
-s [bus][:][device #]
lsusb
show only devices with indicated vendore and product ID in hex format
-d [vendor]:[product #]
lsusb
only this user can issue the
-D [device]
root
lsusb
displays hierarch in tree view
-t
lsusb
verbose device output
-v
lsblk
list empty devices as well - turned off by default
-a | –all
lsblk
print only top level device information
-d | –nodeps
lsblk
exclude the indicated devices - comma separated
-e | –exclude
lsblk
include info on filesystems
-f | –fs
lsblk
use ASCII characters for tree view
-i | –ascii
lsblk
output list format
-l | –list
lsblk
tree view of disk devices and partitions
shutdown -t
sysvinit: shutdown
will halt the system - shut it down
shutdown -h
sysvinit: shutdown
reboot the system
shutdown -r
sysvinit: shutdown
power off (if ACPI is available)
shutdown -P
sysvinit: shutdown
cancels shutdown
shutdown -c
sysvinit: shutdown
broadcasts wall message to logged in users
shutdown -k [message]
sysvinit: shutdown
indicates when the shutdown takes place in sec, min, specific time or now
shutdown [option]
sysvinit: halt
does not shutdown only halts
halt -f
halt –force
sysvinit: halt
power off after shutdown if ACPI available
halt -p
halt –poweroff
sysvinit: halt
only LOGS the shutdown but does actually do the shutdown or reboot
halt -w
halt –wtmp-only
sysvinit: halt
displays more information for troubleshooting
halt –verbose
GRUB - Legacy: Key Setting
determines the menu option that will be started if nothing else is chosen
grub default=[#]
GRUB - Legacy: Key Setting
the amount of time in seconds that you have to choose another option
grub timeout=[#]
GRUB - Legacy: sections (menu list entries)
text based description of menu entry
grub title [description]
GRUB - Legacy: sections (menu list entries)
the hard drive device number and partition of the root drive where the kernel is
grub root[(hd#,#)]
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]
GRUB - Legacy: sections (menu list entries)
path to the initial RAM disk image for the chosen menu entry
grub initrd [/boot/initrd#.img]
GRUB - Legacy: sections (menu list entries)
menu list is edited with this during boot loader display
grub e
GRUB - Legacy: sections (menu list entries)
Grub command line can be accessed with this at menu
grub c
GRUB - Lecacy: reinstall
device can be identified by drive path
/dev/hda
/dev/hd0
grub-install [device]
GRUB - Legacy
application that will show the GRUB command prompt to explore the environment (finding primary device path and number)
grub
GRUB2
used to generate GRUB config file
grub2-mkconfig
sometimes grub-mkconfig
GRUB2
output to the specified location and file
grub2 -o [/path/grub.cfg]
GRUB2
installs GRUB2 to the indicated location
drive master boot record
full path
grub2-install
apt-get
read remote repository package listing (refresh)
apt-get update
apt-get
upgrade the existing system and installed software with any new versions reported as available in configured repositories
apt-get upgrade
apt-get
install indicated package (not .deb file general pkg name) as well as all its dependencies
apt-get install [packagename]
apt-get
upgrades all packages on the system one time to the next available version of Ubuntu/Debian in repositories
apt-get dist-upgrade
apt-get
removes the package’s files but any config files and directories will be left alone
apt-get remove [packagename]
apt-get
removes package(s) files AND any config files and directories associated with it
apt-get purge [packagename]
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]
apt-cache
search for packages matching the indicated value
apt-cache search [value]
apt-cache
show available info about the indicated package
apt-cache show [packagename]
apt-cache
additional tech info about package dependencies and services
apt-cache showpkg [packagename]
dpkg
will display package contents
dpkg –info [packagename]
dpkg
an abbreviated display of the –info option
dpkg –status [packagename]
dpkg
will install the indicated package name on the system
dpkg -i [packagename]
dpkg –install [packagename]
dpkg
removes the package(s) files but any config files and directories will be left alone
dpkg -r [packagename]
dpkg –remove [packagename]
dpkg
removes the package(s) files AND any config files and directories associated with it
dpkg -P [packagename]
dpkg –purge [packagename]
dpkg
list all files that were installed with the indicated package
dpkg -L [packagename]
dpkg –listfile [packagename]
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]
dpkg
allows you to force the removal of a package marked as requiring install
dpkg –force-reinstreq [packagename]
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]
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]
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
YUM
enable a disabled repo for the current transaction only
yum –enablerepo [reponame]
YUM
installs the package along with all required dependencies
yum install [packagename]
YUM
when added to install will download the indicated package
yum –downloadonly
directory the package downloaded to
/var/cache/yum/[architecture]/[version]/base/packages
YUM
removes package and does NOT remove previously installed dependencies
yum remove [packagename]
YUM
remove unused dependencies
yum autoremove
YUM
added to any yum transaction will skip the affirmation step
yum -y
yumdownloader
download only source RPM
yumdownloader –source