Download Linux Command Practice: Searching, Sorting, and Manipulating Files and more Assignments Computer Science in PDF only on Docsity! Practice 3 Download file rolllist.txt, search and sort of this file. 1. search โWebโ grep Web rolllist.txt 2. search word โWebโ and list the line number grep โwn Web rolllist.txt 3. display lines without โWebโ grep โv Web rolllist.txt 4. display lines which start with โAโ,โBโ,โCโ, or โDโ. grep โ^[A-D]โ rolllist.txt 5. display lines which donโt start with โAโ,โBโ,โCโ, or โDโ. grep โ^[^A-D]โ rolllist.txt 6. display lines which end with โsโ grep โs$โ rolllist.txt 7. display lines which include at least 2 successive โ1โ egrep โ111*โ rolllist.txt egrep โ11+โ rolllist.txt 8. search lines which include โViโ or โBrโ egrep โVi|Brโ rolllist.txt 9. search lines which include at least 6 โ0โ egrep โ.*0.*0.*0.*0.*0.*0.*โ rolllist.txt 10. search lines which include โ03โ or โ033โ egrep โ033?โ rolllist.txt 11. sort file sort rolllist.txt 12. sort it in reverse order sort โr rolllist.txt 13. sort on second field sort +1 -2 rolllist.txt 14. set โ,โ as separator, sort on second field sort โt, +1 -2 rolllist.txt 15. set โ.โ As separator , sort on the third field by numeric order sort โt. +2 -3 โn rolllist.txt 27. use ls โl display attributes of file1 and file1link ls -l file1 file1link 28. remove file1link rm file1link 29. display the content of file1 cat file1 30. use ls-l display file1 ls โl file1 31. create a directory tartest in your home directory mkdir ~/tartest 32. copy all files and directories in your home directory into tartest cp โr ~/* ~/tartest 33. archive tartest to tartest.tar tar โcvf tartest.tar ~/tartest 34. archive tartest to tartest1.tar with gzip option tar โzcvf tartest1.tar ~/tartest 35. display file size of tartest.tar and tartest1.tar ls โl tartest.tar tartest1.tar 36. archive the current directory to current.tar tar โcvf current.tar . 37. create a directory tartest2 in your home directory mkdir ~/tartest2 38. extract tartest.tar tar โxvf tartest.tar 39. copy tartest1.tar to tartest2 and extract tartest1.tar in tartest2 cp tartest1.tar ~/tartest2 cd ~/tartest2 tar โzxvf tartest1.tar