


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Practice 4
1. Display the name of the owner of the shell whoami 2. Switch User to root su Or su root cat > crontab.cron
cat > at.csh #!/bin/csh echo This was scheduled 3 minutes ago. > /dev/pts/ (use tty to check your terminal dev name, and replace /dev/pts/1 with the output of tty )
6. Schedule jobs in file at.csh to be executed 3 minutes later. cat at.csh | at now + 3 minutes 7. List the jobs which is scheduled by at at – l 8. Delete jobs of at.csh at – r 34 (34 is the number of job) 9. Use “:” as a separator, print out the first and last field of each line in file /etc/passwd awk – F: ‘{print $1, $NF}’ /etc/passwd 10. For any file, print “Start to scan file filename ” before scanning the file and print line number and the number of fields of each line. Then, print “END” after scanning. cat > p10.awk BEGIN { print “Start to scan file”, FILENAME} {print NR” ”NF} END {print “END”} ^D awk – f p10.awk float
16. For file dummy2, output the results which replace lines 4-6 by “lines 4-6 are censored” cat > sed 4,6c
lines 4-6 are censored sed – f sed16 dummy 17. Merge file float and dummy2 together, save as a new file merge sed ‘$r dummy2’ float > merge 18. Display the results of file float which covert all upper-case characters in file float into lower-case. tr A-Z a-z < float 19. Display the results of file float which replace every non lower-case character with #. tr – c a-z # <float 20. Save the results of file float which delete all upper-case characters in file float.del