Lecture Notes Flashcards
scp
Secure copy from one computer to another
ssh
Secure shell
OS Structure
Linux, Mac, and Windows have m-nary tree file structures
Bin folder
Binaries – compiled code
sudo
Super user do, used to execute a command as an admin of the system
~
Tilde expansion
Characters in filename expansion
- 0 or more characters
? - 1 character
- 0 or more characters
When/where was Unix developed?
At Bell Labs in the 1970s’
Who is credited with developing Unix?
Alexander Graham Bell
What language was codeveloped with Unix?
C
Notable C developers
Dennis Ritchie, Ken Thompson, Brian Kernighan, Joe Ossanna
Kernighan
C Bible, written by Ken Thompson and Brian Kernighan
Principles of Unix
- KISS
- Focus – high product cohesion
- Filter – handle info between objects to limit coupling
- Flexibility – allow users to do what they want
Who created Linux?
Linux Torvalds
What was Linux written for?
The 80x86 processor
GNU Definition
GNU’s not Unix
What was intended to be the standard shell for the GNU system?
Bash
What does the Kernel do?
- Protect and manage resources
- Sends messages to the hardware
What does a shell do?
Interact with the Kernel
Notable Shell Distros
Redhat, Fedora, Ubuntu, Bash
What is a distrubution
An OS that includes the Linux kernel and a package management system
What does the $PATH variable provide?
A list of directories to search whenever we try to execute a command
opt
Optional
which
Tells you the path to the executable you are trying to execute
What is nano?
A text editor
Who developed C?
Dennis Ritchie
C Library Types
Static and Shared
Static C Library
Packaged into the executable and included in every instance of the program
Shared C Library
Pulls the library into the program at runtime so multiple programs can use it at the same time
Linux extension for static libraries
.a (stands for archive)
Linux extension for shared libraries
.so (shared object)
What is problematic about shared libraries?
When they are updated, any program that cannot run with the new one will break
What are Bash programs called?
Bash scripts
Notable shells
- sh (Bourne)
- bash (Bourne again shell)
- csh (c shell)
- ksh (Korn shell, created by David Korn)
- zsh (derivative of the csh)
- ssh (secure shell)
What does the ssh provide?
Encryption
What port does ssh execute from?
Port 22
What do ports allow?
Ports allow multiple services to run on the same network
What port does telnet execute from?
Port 23
Link types
Hard link and soft link
Soft Link
File tells you where another file is
Hard link
Alias for a file
What kind of links does ln make by default?
Hard links
ps
Reports a snapshot of the current processes
What does export do for variables?
Export makes env variables available to a child of the original shell
What symbols do each type of quote suppress?
” - everything but $, `, \, !
‘ - everything
Numbers for stdin, stdout, and stderr
stdin - 0
stdout - 1
stderr - 2
What folder is the trashcan?
dev/nulll
Piping (|)
Takes stdout of one command and redirects it as stdin for the next
What does bash & do?
bash & backgrounds the bash process. This allows you to execute commands in the background while continuing to work in the parent shell
fg
Puts a process back in the foreground
CTRL-d
Indicates the end of a file
lpr
Prints files
lpstat
Shows printers
$SHELL
Tells you where the shell is
lprm
Cancels jobs in the the queue
$PS1
Prompt statement 1
sed
Substitutions in ed
grep
Global regular expression print
awk
Used in this class for cut
awk ‘{ print $1 }’ prints the first column
Regex . meaning
Matches any single character
Regex * meaning
0 or more of the previous pattern
Regex [^] meaning
Negates a range
Regex ^ meaning
Anchor to the beginning of a line
Regex $ meaning
Anchor to the end of a line
Regex {n,m} meaning
A range of min,max
Regex + meaning
1 or more of the previous pattern
Regex ? meaning
0 or 1 of the previous pattern
Regex () meaning
Capture groups
$IFS
Internal field separator
$0
Name of the script that is executing
$#
Number of arguments
$$
Process id
$@
Space separated list of parameters
$(cmd)
Command substitution
What value means true in Bash?
0 is true, nonzero is false
$?
Return of the previous command
Numerical vs. String operators
Numerical uses -gt, -lt, -eq, etc. and strings just use the normal operators
set $variable
Sets the list value to the value of $@