UNIX Flashcards
origins
created in AT and T bell labs by denis Richie and ken Thomas in C in early 1970’s -
licenses
as state-owned company At and T could not directly sell UNIX so sold licenses to other tech companies to create clones - resulting in compatibility issues
posix
IEEE defined a standard of a portable OS to counter all the different clones created by licenses
shells and terminals
terminal = system for providing i/o to shell
shell = interactive environment for executing UNIX commands - different types, with different programming environments, sh, bash, tcsh
cp
copy
creates a new instance of a file in memory independent of the original
ln
link
creates a new file linking to the original file - changes to one appear in the other - same I values - only in same file system
ln -s
symbolic link
creates a file pointing to the original file - creates problem when original is removed -
permissions
each file and directory has permissions for the owner, the group and every one else - ie drwerwerwe is a directory(specified by the first character) owner can read write and execute (next 3 characters), same with the group and everyone else - for dir’s read allows the dir to be listed, write allows files to be added and removed, and execute allows the files to accessed and the directory entered
chmod
changes user permissions - takes 3 digit number as argument, first specifies user perms, next group, last everyone else - read = 4, write = 2 execute = 1, add numbers for different perms
chown
change owner - super user required
chgrp
change group - super user required
redirect i/o
standard input - read from keyboard
standard output - printed to screen
X < Y - X gets input from Y
X > Y - output of X redirected to Y
X»_space; Y - outut of X appended to end of Y
X 2> Y - X writes errors to Y
X | Y - output of X used as input of Y
shell scripts
shell provides programming environment - shebang = ~!/bin/bash - requires speech marks to stop wild cards being expanded - requires ./scriptname to run script in current dir
environmental variables
variables with special meaning:
$HOME = users home directory
$SHELL = location of the shell being used
$TERM = terminal being used
$PATH = contains list of dirs searched for executables in order
set in ~/.profile and /etc/profile
export - used to set environmental variables
system dirs
/bin - contains essential programs
/usr - contains more system files, should be read only
/var - log files and system file
/etc - config files, i.e passwd
/home - user dirs
/dev - device files, hardrive, terminal etc
user nobody - special user - very low privs - should have no files of own - often used for webserver
setUID - if set on file it always runs with the owners privs