Your SlideShare is downloading. ×
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Unix for Librarians
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Unix for Librarians

240

Published on

Workshop

Workshop

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
240
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Unix for LibrariansRavi Mynampatysearchguy@hbs.edu
  • 2. About meJust a hustler making a living by pretending toknow more about search than he actuallydoes...
  • 3. Workshop Goals● Remember the roaring 90s?● Geared towards beginners● Lifetime guarantee!
  • 4. What is Unix?Multi-userMulti-taskingHierarchical filesystemEverything is a file
  • 5. PhilosophyDoug McIlroy:● Write programs that do one thing and do it well.● Write programs to work together.● Write programs to handle text streams, because that is a universal interface.
  • 6. Lets get startedThese slides:- SlideshareUse your own shell orGo here:http://bellard.org/jslinux/
  • 7. A brief note about shellsMany flavorsBourne (sh)Korn (ksh)Bourne-again (bash)C-shell (csh)tcshecho $0
  • 8. How do I get in/out?login: searchguyPassword:Authentication successfulLogout > exit, logoutid, whoamipasswd
  • 9. Where am I?hostnameuname -apwdcdls
  • 10. ExerciseLogin to JS shell1. Who are you logged in as?2. What is the name of the machine?3. What is the OS? and version?4. What dir are you working in?5. Change dir to /bin a. Look at a listing of all files in that dir b. are there any that begin with z (just eyeball it for now)
  • 11. Whats around me?catless is better than more
  • 12. Documentation/Locationsmanaproposwhichwhereis
  • 13. Exercise1. Examine the /etc/passwd file a. what are a couple of ways of doing this?2. Where is the "less" utility located on the filesystem?
  • 14. Whos around?whofingerwlast
  • 15. Directoriesmkdir new_dircd dir_namepwdyour home dir
  • 16. Filescp old_file new_filemv old_file new_filegrep search_str filenamehead filenametail filename
  • 17. Exercise1. Navigate to /etc/ directory2. Take the file named "passwd" a. Make 4 copies in /var/tmp/ b. Name them as follows: i. passwd1, passwd2, passwd3, passwd43. Search for the string "daemon" in any one of the 4 files a. How many instances did you find?
  • 18. Filessort filenameuniq filenamedos2unix oldfile newfilefind path -name *htmlwc filenamecut: selected fields from each line
  • 19. File compressiongzip filenamegunzip filename.gzzcat filename.gztar cvf all.tar file1 file2 file3 ...tar tvftar xvf
  • 20. Hidden Filesls -a.profile.cshrc.login.aliases. and ..
  • 21. File/Directory permissionsls -l-rwxr-xr-x-u, g, ochmod 775 filenamechmod g+w filename
  • 22. Linkingln old_file new_fileln -s old_file new_file
  • 23. Exercise: Linking1. Navigate to /var/tmp2. Create a hardlink to the passwd3 file3. Create a symlink to the passwd4 fileWhat do you see?1. Delete passwd3 and passwd4What do you notice?
  • 24. Editing filesviemacs...
  • 25. What did I do?![and can I do it again?]history!!!13
  • 26. I/O Redirection, Pipes><>>|xargs
  • 27. Exercise: I/O, Redirectioncommand arg1 arg2 ... > filename● cat > io.txtUnix is great, much better than many other ossmakes me very productiveCONTROL-D● cat < io.txt● In /var/tmp merge all passwd* files into one
  • 28. Exercise: Pipes● Your merged file in /var/tmp ○ find the uniq lines ○ sort the file ○ now lets pipe it!● sort filename | uniq● find . -name pass* | xargs grep -i nobody
  • 29. More on pipes...history | perl -pe s/^ +[0-9]+// | sort | uniq -c | sort -nr | head"Top 200" list of directory sizes (under /dir-name - in KB)sorted by largest:du -dk /dir-name | sort -rn | head -200 > report.txtList of requesting IPs from a web server log, sorted bymost frequent first:cut -f1 -d access.log | sort | uniq -c | sort -rn[df: free disk blocks,du: disk usage]
  • 30. Processespsps -ups -eps -auxwwtop
  • 31. Dealing with processeskill pidbg a process: command &jobsfg job_numbernice
  • 32. Remotelyscprsyncsftppingtracerouteifconfig
  • 33. Automationatcron
  • 34. Theres plenty more...But for now......thanks for attending! searchguy@hbs.edu

×