1.) Unix/linux commands were designed following the \"do-one-thing-well\" princi
ID: 3713209 • Letter: 1
Question
1.) Unix/linux commands were designed following the "do-one-thing-well" principle. Explain how unix commands are designed to fit this method. Give three examples of commands that follow the do-one-thing-well principle and describe how they do so.
2.) If a command's executable file resides in a directory that is not defined in your PATH environment variable, how can you still execute it? Provide an example
3.) Can you have the same user-id appear more than one time in the output from the who command? Explain.
4.) Write commands to:
a. list the contents of the current directory in reversed alphabetic order, from z to a, in long format
b. list the contents of the directory but send the output of the listing to a file named dirlist.txt.
c. count the number of files in a directory (but not including the . and .. files)
5.) Write a command to compare the contents of files named list1 and list2 and show only the lines they have in common.
6.) Will the command cp tmp1 tmp2 work if: a. tmp1 is an ordinary file and tmp2 is a directory? b. Both tmp1 and tmp2 are directories?
7.) Can you always delete a file with the permissions set to 777? Explain.
All these questions are in regards to UNIX
Explanation / Answer
1.) Unix/linux commands were designed following the "do-one-thing-well" principle. Explain how unix commands are designed to fit this method. Give three examples of commands that follow the do-one-thing-well principle and describe how they do so.
Answer:
Do one thing well" means to do a new job, build afresh rather than complicate old programs by adding new features.
Examples:
->'ls' is a command that follows this philosophy, as it is a simple command that only lists the contents of a directory
-> The sort command, for example does only one thing. It sorts the data stream sent to it via Standard Input and sends the results to Standard Output. It can perform numeric, alphabetic and alphanumeric sorts in forward and reverse order. But it does nothing else. It only sorts but it is very, very good at that. Because it is very small, having only 2614 lines of code as shown in the table below, it is also very fast.
3.) Can you have the same user-id appear more than one time in the output from the who command? Explain.
Answer:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.