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.
13. SO WHAT ACTUALLY IS AN OPERATING SYSTEM?
AN OPERATING SYSTEM IS…
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 ISN’T…
▸ 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 program’s output will be the input to another program
▸ A program should use text streams for input and output
▸ Text is the universal interface
▸ Don’t 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 difficult to remember
▸ arguments can be worse!
54.
55. GETTING THINGS DONE
MOVING AROUND
▸ where am i ? - pwd
▸ change directory - cd
▸ what’s in this directory ? ls
56. GETTING THINGS DONE
FILES
▸ print a file to screen - cat <filename>
▸ copy file - cp <from> <to>
▸ move file - mv <from> <to>
▸ find a file - find . -name “*.txt”
▸ search inside files - grep ‘hello’ *.txt
▸ manipulate text - sed
57. GETTING THINGS DONE
DIRECTORIES
▸ create a directory - mkdir <directory>
▸ delete empty directory - rmdir <directory>
▸ permanently delete !!! - rm <file 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 file
▸ 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 files
▸ 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/files/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 file )
▸ 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 first item from the list)
63.
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