total 1540 -rw-rw-r-- 1 lalit lalit 0 eb ! "":05 #at drw$rw$r-$ " lalit lalit 40%& eb " 11:"% D1 drw$r-$r-$ 11 lalit lalit 40%& eb 15 1&:'" Des(top drw$r-$r-$ " lalit lalit 40%& )an "7 11:'! Do#uments drw$r-$r-$ " lalit lalit 40%& eb 7 15:0& Downloads drw$r-$r-$ " lalit lalit 40%& )an "5 1':0% e*n+oi#e.php,files -rw-rw-r-- 1 lalit lalit 11''7 )an "5 1':0% e*n+oi#e.php.html drw$rw$r-$ " lalit lalit 40%& )an '1 1&:47 en-lish .ra#ti#es -rw-r--r-- 1 lalit lalit !445 )an "4 04:1! e$amples.des(top ". /ele#t any 5 #apitals of states in *ndia and enter them in a file named #apitals1. 0hoose 5 more #apitals and enter them in a file named #apitals". 0hoose 5 more #apitals and enter them in a file named #apitals'. 0on#atenate all ' files and redire#t the output to a file named #apitals. lalit@ubuntu:~$ tou#h #apital lalit@ubuntu:~$ #at #apital1 #apital" #apital' 1 #apital lalit@ubuntu:~$ #at #apital hyderabad shilon- #handi-arh pana2i na-pur bombay dispur patna raipur '. 0on#atenate the file #apitals' at the end of file #apitals. lalit@ubuntu:~$ #at #apital' 11 #apital lalit@ubuntu:~$ #at #apital hyderabad shilon- #handi-arh pana2i na-pur bombay dispur patna raipur dispur patna raipur lalit@ubuntu:~$ 4. 3i+e read and write permissions to all users for the file #apitals usin- relati+e method. lalit@ubuntu:~$ #hmod a4r 4w #apital lalit@ubuntu:~$ ls -l #apital -rw-rw-rw- 1 lalit lalit %0 eb 15 "':5" #apital lalit@ubuntu:~$ 5. 3i+e read permissions only to the owner of the file #apitals usin- absolute method. 5pen the file6 ma(e some #han-es and try to sa+e it. 7hat happens 8 lalit@ubuntu:~$ #hmod 400 #apital lalit@ubuntu:~$ ls -l #apital -r-------- 1 lalit lalit %0 eb 15 "':5" #apit lalit@ubuntu:~$ #at 11 #apital bash: #apital: .ermission denied &. 0reate an alias to #on#atenate the ' files #apitals16 #apitals"6 #apitals' and redire#t the output to a file named #apitals. 9#ti+ate the alias and ma(e it run. lalit@ubuntu:~$ alias #on#t:;#at #apital1 #apital" #apital'; lalit@ubuntu:~$ tou#h #apital lalit@ubuntu:~$ #on#t 1 #apital lalit@ubuntu:~$ #at #apital hyderabad shilon- #handi-arh pana2i na-pur bombay dispur patna raipur 7. ind out the line numbers on whi#h the strin- <date= e$ists in mydate. lalit@ubuntu:~$ f-rep -n lalit file1 1 my name is lalit !. .rint all lines of mydate e$#ept those that ha+e the letter <i= in them. lalit@ubuntu:~$ #at file1 lalit (ishor (umawat na+een (umar sharma om pra(esh (umawat lalit@ubuntu:~$ f-rep -+ (ishor file1 na+een (umar sharma om pra(esh (umawat %. >ist the words of 4 letters from the file mydate.
10. >ist 5 states in north east *ndia in a file mystates. >ist their #orrespondin- #apitals in a file my#apitals. ?se the paste #ommand to 2oin the " files. lalit@ubuntu:~$ paste #apital1 #apital" 1 #apital lalit@ubuntu:~$ #at #apital hyderabad pana2i shilon-na-pur #handi-arh bombay lalit@ubuntu:~$ 11. ?se the #ut #ommand to print the 1st and 'rd #olumns of the @et#@passwd file for all students in this #lass. lalit@ubuntu:~$ #ut -d ; ; -f"64 file" name lalit belon- Aa2asthan name name 1". 0ount the number of people lo--ed in and also trap the users in a file usin- the tee #ommand. lalit@ubuntu:~$ who B tee file" B w# -l " lalit@ubuntu:~$ #at file" lalit pts@" "01'-0"-15 1":"' C:0D lalit pts@' "01'-0"-15 14:4% C:0D 1'. 0on+ert the #ontents of file mystates into upper#ase. lalit@ubuntu:~$ #at myfile i am pursin- m#a from +it #olle-e pune lalit@ubuntu:~$ #at myfile B tr Ea-FE E9-GE * 9H .?A/*I3 H09 A5H J*K 05>>L3L .?IL 14. /ort the file names from #urrent dire#tory i-node number wise. lalit@ubuntu:~$ sort -A +itfile file' epps file" file1 file1~ fil1 tee apps #amp file1.t$t file".t$t lalit@ubuntu:~$ #at +itfile file".t$t file1.t$t file1 file1~ tee file" file' fil1 #amp epps apps lalit@ubuntu:~$ 15. Kry to open the file named myfile and redire#t the error messa-e into the file named errorfile. lalit@ubuntu:~$ #at file'" "1 errorfile lalit@ubuntu:~$ #at errorfile #at: file'": Io su#h file or dire#tory 1&. 0reate a file named #al#.t$t #ontainin- some arithmati# e$pressions. Aedire#t file #al#.t$t as an input to do #al#ulations and store the result in the file named result.t$t. lalit@ubuntu:~$ #at file1.t$t B b# 1 file".t$t lalit@ubuntu:~$ #at file".t$t 1' lalit@ubuntu:~$