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)
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?
Filessort filenameuniq filenamedos2unix oldfile newfilefind path -name *htmlwc filenamecut: selected fields from each line
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
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
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]