Linux Maintenance Flashcards
Search system for root SUID bit set
find / -user root -perm 4000
Or -perm -u+s
How to view all processes Inc background
ps aux
Which command lets you view process by most resources used with updates every 3 seconds
top
NB press ‘H’ while running for interactive commands
3 ways to change priority of process
nice -n <-20..19> PSPATH
renice <-20..19> PSID
Press ‘R’ while running ‘top’
What is the absolute kill signal
kill -9 PID
What is the kill hang up signal
kill -1 PID
What is the kill interrupt signal
kill -2 PID
What is the kill termination (and default) signal
kill -15 PID
What is the kill with core dump signal saved to working directory and called core)
kill -3 PID
How to start a task/process and have it run in the background
PS/CMD &
How do you bring a process back to the foreground
fg PSID
How do you schedule a process
at <7.20pm> <08/08/1888>
at NOW + <5 minutes/hours>
How do you view default environment variables
env
How do you view ALL variables (env,shell,usr,aliases)
set (| more)
How do you make a variable change permanent
export VARIABLE
(after changing the VARIABLE)
How do you view your PATH
echo $PATH
How do you view the content of a variable
Use a $
Eg echo $VARIABLE
How do you add to the PATH
PATH=$PATH:/DIR
How do you archive a group of similar files
tar -cvf OUTPUT.tar FILE FILE
How do you view contents of a .tar
tar -tvf FILE
How do you extract a .tar
tar -xvf FILE
How do you use gzip
gzip FILE.*
Creates a .gz extension
gunzip FILE.*
How do you use ‘compress’
compress FILE.*
Creates a .Z extension
uncompress FILE.*
How do you make an exact copy of a file/dir
dd if=<file/dir> of=<file/dir >
What are two common options for dd
bs=BLOCK IN BYTES
conv=noerror
How do you produce a list of ‘block’ devices
lsblk
How do you view a full list of (drive) devices?
sudo fdisk -l
How would you mount a second hard drive
mount /dev/sdb1 /mnt
How would you mount a flash drive
mount /dev/sdc1 /media
Where are files systems that are mounted at boot time stored?
/etc/fstab
(Short for filesystem table)
How would you unmount a hard drive
umount /dev/sdb1
What command to view basic information and free space on mounted discs/devices
df /PATH
Or no path needed to view all
How would you check for errors in the filesystem?
fsck
unmount first
-p automatically repairs
How do you see all the WAPs in range?
iwlist INTERFACE scan
eg iwlist wlan0 scan
How would you connect to an WAP
nmcli device wifi connect SSID password PASSWORD
What command do you use to ‘tune’ kernel options
sysctl
How do you make sysctl changes (carefully) permanent
Edit /etc/sysctl.conf
How do you find out more information about your OS
uname -a
ps options
-a of all users
-e all processes running on sys
-t all processes run by terminal
-u username and start time
-x run by current user