In: Computer Science
1. Show how to redirect the standard output of the date command to a file named currentdate.
2. Continuing from the previous question: Show how to append the standard output of the who command to the file currentdate.
3. The password file (/etc/passwd) contains one line for each userid registered with the system. Show how to display the number of userids in the passwd file on the screen.
4. Employ a pipe to combine the who and the wc commands to show the number of userids currently logged into the system.
5. Write a Unix command line to list only the 20th last file in the directory /etc.
6. Write a Unix command line to to count how many files and directories you have the execute permission for in your home directory.
7. In the following pipeline, the find command searches all the directories under /etc looking for files owned by userid root. The names of all such files are then written to standard output, one per line. The output of find is piped to wc -1 to count the lines:
find /etc -type f -user root -print | wc -l
As find does its work, it will generate various error messages you don’t want to see. Your goal is to rewrite the pipeline to throw away the error messages without affecting the rest of the output. Show how to do this for BASH shell.
Answer 1
**************
date > currentdate
Answer 2
**************
Answer 3
***************
Answer 4
*************
Answer 5
**************
Answer 6
************
Answer 7
**************
find /etc -type f -user root -print -name expect 2>/dev/null
| wc -l
Thanks