-
What does the Applications menu contain?
Libre Office, gedit, terminal, writer, sheets
-
What does the Places menu contain?
Home folder, filesystem, network shares
-
What does the System menu contain?
Encryption & Keys, Printer spool, terminal, user preferences
-
Cat
concatenates multiple files and displays the results on screen. Displays a text file
-
Cd
change directory to a specified path
-
Hostname
Resolve a DNS entry to its IP address
-
Ls
List files and folders in a directory path
-
Passwd
change the password for a specified user
-
Pwd
shows the current working directory
-
Uname
shows the name of the OS that is running
-
Who
shows all users logged on to the current terminal session
-
Whoami
Shows the current logged on user
-
Illustrate the command that would list all files in the directory that begin with sofa
Ls –l sofa*
-
The command that lists all files in the directory that have .txt as an extension
Ls –l *.txt
-
The command that would list all files in the directory that contain .from. as part of the filename
Ls –l *.from.*
-
Pipe
Outputs one command as input to another command. Useful for showing how many search results are found. Ex: find . –name *.txt | wc –l
-
Redirection
Redirects output to a file instead of the terminal window. Useful for logging purposes. Ex: ls –l > file1.txt > - create file, overwrite if exists. >> - create file, append if exists
-
What command would you use to change permissions to files and directories?
Chmod
-
What are u, g, and o permissions
- U – Owner Permissions
- G – Group Permissions
- O – World Permissions
-
Using 3 different approaches, how would you set permissions for text3.txt such that owner has read/write access, group has read only, and other has none?
- Chmod u+r, u+w, u-x, g+r, g-w, g-x, o-r, o-w, o-x /home/foxr/text3.txt
- Chmod u=rw, g=r, o= text3.txt /home/foxr/text3.txt
- Chmod 640 /home/foxr/text3.txt
-
What command would you use to verify that permissions for text3.txt are set correctly?
Ls –l /home/foxr/text3.txt
-
What is accomplished by the following command? Find /usr/sbin –name user*
Find all files starting with user starting in /usr/sbin
-
What is accomplished by the following command? find ~ -anewer ~/DUMMY-DIRECTORY/file1.txt
Find all files starting in the user’s home directory that were accessed more recently than ~/DUMMY-DIRECTORY/file1.txt
-
What is accomplished by the following command? find ~ -size +100c –size -200c
Find all files starting in the user’s home directory that are larger than 100 bytes and smaller than 200 bytes
-
-
Hostname
Resolve a DNS entry to an IP address
-
Passwd
Change the password for a specified user
-
Mv
move a file/directory from one place to another
-
Uname
shows the name of the OS that is running
-
PID
Process ID. Unique number given to a process. ID’s are sequential
-
PR
Priority. The importance each process is given to the system. High priority = high importance.
-
NI
Nicesness. How “nice” a process is in relation to other processes. More nice = lower priority.
-
%CPU
Amount of CPU a process is using
-
%MEM
Amount of RAM a process is using
-
Describe briefly the niceness value of a process’s priority
Niceness refers to how willing a process is in letting others use its resources. A high nice value means the process is willing to give other processes priority over it, meaning the process has a high priority. A low niceness means the process is “greedy” and has a high priority not willing to share its resources.
-
Nice – n -15 find ~ -name *.txt > found_files &
- Start the find process with a niceness of -15 and run in the background
- Will find all files starting in the user’s home directory that end in .txt and will go through each subdirectory. The results are stored in found_files.
-
Nice –n 15 ./myscript < inputfile > outputfile &
- Start myscript process with a niceness of 15 and run it in the background
- Will run a script passing in the contents of inputfile and storing the output of the script in outputfile.
-
Renice –n 5 18311
Reassign a nice value of 5 to the process whos PID is 18311. Run in foreground.
-
Renice –n 19 –u foxr zappaf
Reassign a nice value of 19 to all processes owned by the users foxr and zappaf
-
Renice –n -10 –p 23813 24113 26729
Reassign a nice value of -10 to the processes that have PID’s of 23813, 24113, and 26729
-
Open a file in vi
Vi file or :o file
-
Save a file in vi
:w filename
-
-
Describe the concept of “regular expressions” and include at least two examples
- Regular expressions are search patterns that can be used to find strings that match a given expression. Generally, they will match the first part of the string that contains the pattern, even if there are multiple occurrences.
- Ex: ^[0-9]{5} will find all string that begin with at least 5 numbers [[:space:]][A-Z]{2}[[:space]][0-9]{5}$ will find all strings that contain a space, followed by 2 capital letters, followed by another space, followed by 5 numbers and ends the string. ^IL^60004
-
#!/bin/bash
show what shell we are using
-
read –p “Enter three numbers: “ X Y Z
Display the message and store the user input into X, Y, and Z
-
If [ $X –gt $Y ]
If the value stored in X is greater than the value stored in Y
-
-
If [ $X – gt $Z ]
If the value stored in X is greater than the value stored in Z
-
Then Largest=$X
Then assign Largest to be the value stored in X
-
Else Largest=$Z
Then assign Largest to be the value stored in Z
-
Fi
End the indented if block
-
Elif [ $Y –gt &Z ]
Else if the value stored in Y is greater than the value stored in Z
-
Then Largest=$Y
Then assign Largest to be the value stored in Y
-
Else Largest=$Z
Else assign Largest to be the value stored in Z
-
Fi
End the large if block
-
Passwd username
will change the password of username. If no name is specified, root’s password will be changed.
-
Private group
group that belongs only to the user that created it
-
-
Useradd -d
Specify the home directory of the new account
-
Useradd -e
Expiration date of the new account
-
Useradd -G
list of supplementary groups of the new account
-
Useradd -s
login shell of the new account
-
Useradd -M
Don’t create home directory
-
Useradd -D
alter defaults (no parameters displays defaults)
-
Groupadd groupname
–g GID
-
Suzie Creamcheese, creamcheeses, default login shell /bin/tcsh
Useradd –m –c “Suzie Creamcheese” –s /bin/tcsh creamcheeses
-
Eric Cartman, cartmane, groups cit371 and informatics, UID of 1001
Useradd –m –c “Eric Cartman” –G cit371,informatics –u 1001 cartmane
-
Userdel username
–r deletes everything
-
/etc/password
shows all user accounts
-
/etc/group
shows all info about groups
-
/etc/shadow
shows hashed password info
-
chage –l username
shows password info
-
chage –M
maximum number of days between password change
-
chage –W
number of days of warning before password expires
-
chage –E
Password expiration date
-
chage –I
inactivity period (account will be locked after password has expired if it hasn’t been changed in this time)
-
Passwd username
change the password of username
-
Passwd username –l
lock user account
-
Passwd username –u
unlock user account
-
Defaults for useradd
are stored in /etc/login.defs
-
useradd –D
change defaults (no parameters show defaults)
-
/etc/sudoers
modifies the sudo command
-
username machine=command
Lets username run a specified command on machine (usually localhost)
-
Df
reports disk file space usage (in 1K blocks)
-
-
Df –h
shows the size of partitions in human-readable context (GB, MB, TB, etc.)
-
Df –k
shows 1K blocks total, used, and available
-
Df –i
Shows number of inodes that are used by each filesystem
-
/etc/fstab
shows mounted devices at boot time
-
/etc/mtab
shows what is currently mounted
-
-
-
tempfs
stores temporary files, stored in RAM
-
sysfs
virtual file system that stores info about kernel subsystems, hardware devices, and device driver files
-
devpts
provides an interface to terminal devices
-
telinit 1
change to runlevel1
-
umount directory
unmounts directory
-
mount device mountpoint
will mount device as mountpoint
-
mount /dev/sda5 /home
will mount /dev/sda5 as /home/
-
-a
will mount all partitions specified in /etc/fstab
-
stat
shows information about a file or files
-
stat –f dev
will show the file mount point
-
stat –c
allows you to specify codes
-
stat –c %n
print filename
-
stat –c %A
human readable format
-
-
-
stat –c %s
total size in bytes
-
stat –c %Z
time of last change since epoch
-
-
swapon
turns on swap space
-
-
-
swapoff –a
disable all swap spaces
-
/boot
used to store files needed to boot system
-
vmlinuz
name of Linux kernel executable
-
Grub
bootloader for Linux
-
/proc
- directory for running processes by PID
- cmdline tells you path the process is located, can be called/accessed
- key-users: users that are able to use the process
-
/bin
used by both sys admins and users
-
/usr/bin
primary directory of executable commands on the system
-
/usr/local
used when installing software locally. Protected from being overwritten during system updates/installs
-
sticky bit
controls activities of world-writable directories
-
t instead of x
in the world permissions
-
chmod 1### or chmod +t
Useful for ensuring users cannot accidentally erase other user’s work in a shared folder
-
Tar –cf name path
will create a new tar file called name consisting of everything in path
-
Tar –tf name
will display table of contents of name
-
Tar –z
automatic compression
-
dmesg
shows all messages captured during bootup
-
write-back
data written to cache every time a change occurs, but only written to memory under certain conditions or specified intervals
-
uncacheable
memory cannot be stored for future use
-
DMA
Direct Memory Access: Allows certain hardware systems to access RAM independently of CPU
-
IRQ
Interrupt Request: Hardware signal sent to CPU that temporarily stops a running program and allows interrupt handler to run instead
-
-
Rootfs
- special tempfs image used in initram. Init will overwrite rootfs with mounted / file system
- Mounted physically at /dev/sda1
-
Init
responsible for establishing user environment after hardware has been initialized and file system mounted
-
/etc/inittab
startup script
-
id:runlevel:initdefault
start the machine using the specified runlevel value
-
runlevel 0
halt (Do NOT set initdefault to this)
-
runlevel 1
single user mode
-
runlevel 2
multiuser, without NFS (same as 3, if you do not have networking)
-
runlevel 3
full multiuser mode
-
-
-
runlevel 6
reboot (Do NOT set initdefault to this)
-
rc.sysinit
initializes system functions
-
Rc.conf
- For I in /etc/rc$runlevel.d/K*
- for I in /etc/rc$runlevel.d/S*
-
runlevel.d
- variable for runlevel value
- processes are executed(K)/stopped(S) at their respective runlevels
-
chkconfig
shows which runlevel a service is running
-
chkconfig servicename off
will turn off servicename
-
chconfig sshd off –level 2
will turn off runlevel2 for sshd
-
chkconfig httpd on --level 5
will turn on runlevel5 for httpd
-
Enabled
Automatically Start
-
Disabled
Automatically Stop
-
/sbin/service name status
- name – name of service
- status – particular action
- start – start the service
- stop – stop the service
- restart – restart the service
- status – show the status of the service
-
/etc configuration files
cron uses anacrontab
-
cron.daily
processes run daily
-
cron.weekly
processes run weekly
-
cron.monthly
processes run monthly
-
config
Specifies parameters of variables that are used when running
-
rules
parameters that are passed when running
-
chkconfig 2345 11 88 (/etc/init.d/auditd)
- 2345 – default run levels for the service
- 11,88 – S(stop,11) and K(run,88) symbolic links. Order which service will be started and stopped in the respective runlevels
-
rsyslog
system logger, logs activity to log files
-
rsyslog.conf
configuration file for rsyslog daemon
-
Daemon.*
specify all daemon activity should be logged
-
/var/log/daemons
activity should be logged here
-
-
-
/etc/sysconfig/network-scripts
scripts for network service
-
ifdown interface
shuts down network interface
-
ifdown interface eth0
shuts down eth0, lo still works
-
ifdown interface lo
shuts down all network communication
-
ifup interface
brings up network interface
-
ifcfg-eth0
configuration file for eth0
-
BOOTPRO=method
DHCP or STATIC depending on addressing
-
ONBOOT=yes/no
specify whether interface starts on boot time
-
HWADDR
MAC address of hardware interface
-
Ifcfg-lo
configuration file for lo
-
-
-
-
BROADCAST
network broadcast address
-
/etc/resolv.conf
- DNS zone name file
- machine will look here for name servers
-
/etc/hosts
modifies localhost name server
-
route
shows IP routing table
-
ip route show table local
shows entire local routing table
-
ip route flush table local
flushes entire local routing table
-
ip neigh show
shows computer’s ARP address
-
Address Resolution Protocol
address computer sends to gateway
-
-
Arp –d ipaddr
removes ARP address for ipaddr
-
Iptables
firewall rule file (/etc/sysconfig/iptables)
-
Iptables SAVE_ON_STOP
specifies whether rules are saved when service is stopped or not
-
Iptables STATUS_LINENUMBERS
shows line numbers in output or not
-
Iptables –A
- append rule to a rule chain
- INPUT – incoming traffic
- OUTPUT – outgoing traffic
- FORWARD – port forwarding
-
Iptables -m
- allows rules to match based on connection state
- --state
- ESTABLISHED – connection is already established
- RELATED – connection is new, but related to another connection already permitted
- NEW – connection has not yet been seen
- INVALID – Traffic could not be identified
-
Iptables –j
- Jump to specified target
- ACCEPT – accept packet and stop processing rules in current chain
- REJECT- reject packet and notify sender, stop processing rules in current chain
- DROP – silently ignore packet (don’t notify sender), stop processing
- LOG – Log packet, continue processing
|
|