Commands Flashcards
lsblk
list disks and partitions attached to system
What command can be used to display mounted devices and paritions
lsblk
What commands can be used to create or list partitions
fdisk -l <dev>
gdisk -l <dev></dev></dev>
fdisk -l
list partitions
gdisk
likes GPT partitions
su -
switch user to root
uname
identify kernel version
sudo
use root for one specific command
What commands can be used to identify hard ware
lspci
lsusb
usb-devices
-v (verbose)
-k (expanded output)
cat <file></file>
stream contents of file to terminal/shell
What commands can be used to identify USB serial number
lsusb -v
usb-devices
man <command></command>
user manual / information on the command
What commands can be used to identify disk information
lsscsi (does not show partitions)
file -s
fdisk - l </dev/>
What is the order of commands to use to identify a device, partition, and file system
lsblk = mounted devices
fdisk -l <> = partition information
file -s <> = file system
lsscsi
list the scsi partitions
file -s </dev/sdaX>
identify the file system of a device
dmesg
device messages / information about a device received directly from kernel
can contain serial number, model, date/time connected/disconnected
what is the /bin folder
binary folder which contains standard commands like ls, cd, pwd, etc
what is the /boot folder
contains files needed at bool (LILO or GRUB)
what is the /dev folder
files that represent devices on a system (device nodes)
what is the /etc folder
contains administrative configuration files and scrips
what is the /home folder
user home directory
what is the /lib folder
32bit software libraries (program files)
what is the /lib64 folder
64bit software libraries (program filesx64)
what is the /media folder
udisks mount points / standard place to mount system removable media
what is the /mnt folder
temporary mount points for external, remote, removeable file systems
what is the /opt folder
folder for optional software files
what is the /sbin folder
administrative commands (fdisk, ifconfig, etc.)
what is the /usr folder
contains local software, libraries, and user specific installer files
what is the /var folder
contains logs and other variable files
what is the /run directory
contains dynamic run files for system daemons like udev and udisks
mount
manually mount a specific device
example:
mount -t <file> -o <option> <device> <mountpoint></mountpoint></device></option></file>
what command can be used to unmount a mount point
umount
what does the /etc/fstab file contain
file system table of device, mountpoint, file system type, and default options
What is the userspace command to mount / unmount a device
udiskctl mount
udiskctl unmount
-b (specifies block device to mount)
will mount under /run/media
grep < pattern > < filename >
search for occurrences of the pattern within the file name
find <start directory <criteria></criteria>
searches for files based on criteria
what is this find command looking for
find /etc -iname fstab
find, starting in the /etc directory, a filename fstab (case insensitive)
file
categorizes files based on a file signature comparison (to magic files)
ps
list current running processes
strings
prints out readable characters from a file
used to search data files and extract useful strings
chmod
change permissions on a file
chown
change owner (and group) of a file
what information is outputted for ls -l
file type (. - regular file, d-directory, b-block device, c-character device, l-link)
permissions (owner, group, others)
user
group
size in bytes
date modified
filename
What does > do
output to a file (stdout)
What does»_space; do
append to a file
What does 2> do
output error messages (stderr)
bc
basic calculator
Explain the command:
echo “scale =2”; 5/3” | bc
Divide 5/3 with decimal place of 2
Output: 1.66
explain the command:
echo “ibase=16;4C | bc”
calculate the hex to decimal value of 4C
output = 76
What is a base shell arithmetic expansion
echo $((Calculation))
Explain the command:
echo $((0x4c-70))
Calculate the hex to decimal value of 4C (76) and subtract 70
Output = 6
What file stores the history of a bash shell
.bash_history
vi
virtual editor