how do i unix

70
HOW DO I UNIX ? DEREK GRAHAM

Upload: derek-graham

Post on 12-Apr-2017

15 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: How Do I Unix

HOW DO I UNIX ?DEREK GRAHAM

Page 2: How Do I Unix
Page 3: How Do I Unix
Page 4: How Do I Unix

UNIX

PROJECT GOALS

▸ performance

▸ reliability

▸ multi-user

▸ security

▸ admin abilities

▸ ordinary user abilities

▸ “portable”

Page 5: How Do I Unix
Page 6: How Do I Unix
Page 7: How Do I Unix

TEXT

Page 8: How Do I Unix
Page 9: How Do I Unix
Page 10: How Do I Unix
Page 11: How Do I Unix
Page 12: How Do I Unix

SO FROM NOW ON…

LINUX == UNIX

Page 13: How Do I Unix

SO WHAT ACTUALLY IS AN OPERATING SYSTEM?

AN OPERATING SYSTEM IS…

Page 14: How Do I Unix

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

Page 15: How Do I Unix

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

Page 16: How Do I Unix

QUIZ TIME

WHICH THINGS ARE UNIX?

Page 17: How Do I Unix
Page 18: How Do I Unix
Page 19: How Do I Unix
Page 20: How Do I Unix
Page 21: How Do I Unix
Page 22: How Do I Unix
Page 23: How Do I Unix
Page 24: How Do I Unix
Page 25: How Do I Unix
Page 26: How Do I Unix
Page 27: How Do I Unix
Page 28: How Do I Unix
Page 29: How Do I Unix
Page 30: How Do I Unix
Page 31: How Do I Unix
Page 32: How Do I Unix
Page 33: How Do I Unix
Page 34: How Do I Unix
Page 35: How Do I Unix
Page 36: How Do I Unix
Page 37: How Do I Unix
Page 38: How Do I Unix
Page 39: How Do I Unix
Page 40: How Do I Unix
Page 41: How Do I Unix
Page 42: How Do I Unix

WHERE IS UNIX

MAJORITY OF WEB SERVERS

▸ Amazon

▸ Flickr

▸ Paypal

▸ Wikipedia

▸ Facebook

▸ Youtube

Page 43: How Do I Unix
Page 44: How Do I Unix

DISTROS

DESKTOP AND LAPTOP UNIX

▸ Ubuntu

▸ Fedora

▸ Debian (& Raspbian)

▸ Mint

▸ Elementary

▸ BSD

Page 45: How Do I Unix

TEXT

Page 46: How Do I Unix
Page 47: How Do I Unix
Page 48: How Do I Unix
Page 49: How Do I Unix
Page 50: How Do I Unix

GETTING THINGS DONE

GUIS ARE ALL THE SAME

▸ Web browser

▸ Email

▸ All the “normal” applications

▸ Personal preference

Page 51: How Do I Unix

GETTING THINGS DONE

WHERE UNIX SHINES…

▸ command line tools

▸ shell scripting

▸ compose simple programs together to make complicated ones

Page 52: How Do I Unix

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

Page 53: How Do I Unix

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!

Page 54: How Do I Unix
Page 55: How Do I Unix

GETTING THINGS DONE

MOVING AROUND

▸ where am i ? - pwd

▸ change directory - cd

▸ what’s in this directory ? ls

Page 56: How Do I Unix

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

Page 57: How Do I Unix

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 !!!

Page 58: How Do I Unix

GETTING THINGS DONE

DOWNLOAD A FILE

▸ wget http://mywebsite.com/mypicture.jpg

Page 59: How Do I Unix

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

Page 60: How Do I Unix

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

Page 61: How Do I Unix

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

Page 62: How Do I Unix

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)

Page 63: How Do I Unix
Page 64: How Do I Unix

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

Page 65: How Do I Unix

GETTING THINGS DONE

HELP !!!!!

▸ Man pages are your friend !

▸ man ls

▸ man pwd

▸ q to quit

Page 66: How Do I Unix

PRACTICE

RASPBERRY PI

Page 67: How Do I Unix

TEXT

Page 68: How Do I Unix
Page 69: How Do I Unix
Page 70: How Do I Unix

PRACTICE

QUESTIONS?