Upload
derek-graham
View
20
Download
0
Embed Size (px)
Citation preview
HOW DO I UNIX ?DEREK GRAHAM
UNIX
PROJECT GOALS
▸ performance
▸ reliability
▸ multi-user
▸ security
▸ admin abilities
▸ ordinary user abilities
▸ “portable”
TEXT
SO FROM NOW ON…
LINUX == UNIX
SO WHAT ACTUALLY IS AN OPERATING SYSTEM?
AN OPERATING SYSTEM IS…
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
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
QUIZ TIME
WHICH THINGS ARE UNIX?
WHERE IS UNIX
MAJORITY OF WEB SERVERS
▸ Amazon
▸ Flickr
▸ Paypal
▸ Wikipedia
▸ Youtube
DISTROS
DESKTOP AND LAPTOP UNIX
▸ Ubuntu
▸ Fedora
▸ Debian (& Raspbian)
▸ Mint
▸ Elementary
▸ BSD
TEXT
GETTING THINGS DONE
GUIS ARE ALL THE SAME
▸ Web browser
▸ All the “normal” applications
▸ Personal preference
GETTING THINGS DONE
WHERE UNIX SHINES…
▸ command line tools
▸ shell scripting
▸ compose simple programs together to make complicated ones
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
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!
GETTING THINGS DONE
MOVING AROUND
▸ where am i ? - pwd
▸ change directory - cd
▸ what’s in this directory ? ls
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
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 !!!
GETTING THINGS DONE
DOWNLOAD A FILE
▸ wget http://mywebsite.com/mypicture.jpg
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
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
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
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)
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
GETTING THINGS DONE
HELP !!!!!
▸ Man pages are your friend !
▸ man ls
▸ man pwd
▸ q to quit
PRACTICE
RASPBERRY PI
TEXT
PRACTICE
QUESTIONS?