A quick introduction to the history of unix, where to find unix now, some common command line command and how to link commands together to solve problems.
14. SO WHAT ACTUALLY IS AN OPERATING SYSTEM?
AN OPERATING SYSTEM IS
the invisible software that tells the hardware what to do
understands keyboard and mouse
draws on the screen
reads and writes to disk
reads and write to network
decides which program runs when
decides how programs work together
15. SO WHAT ACTUALLY IS AN OPERATING SYSTEM?
IT ISNT
anything you can see
anything you can touch
a command line
the windows on your screen
50. GETTING THINGS DONE
GUIS ARE ALL THE SAME
Web browser
Email
All the normal applications
Personal preference
51. GETTING THINGS DONE
WHERE UNIX SHINES
command line tools
shell scripting
compose simple programs together to make complicated
ones
52. GETTING THINGS DONE
COMMAND LINE PHILOSOPHY
A program should do one thing and do it well
A programs output will be the input to another program
A program should use text streams for input and output
Text is the universal interface
Dont clutter output with extra information
53. GETTING THINGS DONE
GOTCHAS
case is important
windows paths use
unix paths use /
why do web addresses use / ?
commands can be dif鍖cult to remember
arguments can be worse!
56. GETTING THINGS DONE
FILES
print a 鍖le to screen - cat <鍖lename>
copy 鍖le - cp <from> <to>
move 鍖le - mv <from> <to>
鍖nd a 鍖le - 鍖nd . -name *.txt
search inside 鍖les - grep hello *.txt
manipulate text - sed
57. GETTING THINGS DONE
DIRECTORIES
create a directory - mkdir <directory>
delete empty directory - rmdir <directory>
permanently delete !!! - rm <鍖le or directory>
there is no recycle bin !!!
59. GETTING THINGS DONE
REDIRECTING WITH < > AND I
chain simple utilities together in interesting ways
stdin is the command line
stdout is the screen
ls . stdin is . stdout is the screen
ls . > list.txt stdout is now a 鍖le
ls -l | grep hello stdout goes to input of grep
very fast - unix handles plumbing between programs
60. GETTING THINGS DONE
SEARCH FOR FILES
ls lists 鍖les
grep searches text and prints results
sort orders the results
ls -l | grep hello | sort -r
61. GETTING THINGS DONE
HOW MANY TIMES DOES A WORD APPEAR IN A FILE?
wget https://www.gutenberg.org/鍖les/102/102-0.txt
cat 102-0.txt | grep -c Wilson
62. GETTING THINGS DONE
WHAT IS THE MOST POPULAR WORD IN A BOOK?
cat 102-0.txt | (type out the content of the 鍖le )
tr -cs A-Za-z 'n' | (put each word on a new line)
tr A-Z a-z | (convert everything to lower case)
sort | (sort alphabetically)
uniq -c | (remove duplicates but count how many there were)
sort -rn (sort in descending order)
head -n 1 (take the 鍖rst item from the list)
64. GETTING THINGS DONE
SECURITY AND SUDO
Files are not executable by default
Unix has a lot of power if you need it
Users do not have super powers
You need to be an admin to use super powers
Super User DO