Linux / Unix: please help as much as you can. Thanks. (1) Using find a. find all
ID: 3854064 • Letter: L
Question
Linux / Unix: please help as much as you can. Thanks.
(1) Using find
a. find all files from /tmp directory that have a size > 5120 bytes
b. find all files from /usr/src that are owned by bin
Explain/demonstrate the following items using your Linux System.
(2) In vi(1) how would you make the vi session exeute a shell command and return back to the "vi"
session. ? Note the current editing file does not change.
(3) In vi(1) how would you import the content of a file into the file you are editing. Note that this must
modify the contents of the file you are editing.
(4) What is a setuid(1) program . Explain in details with an example using chmod(1)
Explanation / Answer
Hi,
Please find the Unix / Linux commands based on your requirements below:
1a. find /tmp -size 512c
1b. find /tmp -user bin
2. There are three ways to get back to the Vi session after briefly going away to execute a shell command:
2a. Use the :wq to quit the Vi editor, go back to the command line, execute the shell command, and again use vi file_name to get back to the same status where you left.
2b. Use tmux. Tmux is a utility for window management and also allows session management. This would allow you to return to a particular session after discontinuing to execute a shell command.
2c. Use the recover command in the Vi text editor to recover the past edits and start off from that point (this won't ensure full integrity of the code as it might not have been saved before you quit the last session.
3. To insert the contents of another file, you have two basic ways to accomplish it:
3a. To insert the content of the other file right after where the cursor is currently: :r file_name
3b. To insert content of another file after a specific line, say 45: 45:r file_name
4. A setuid program is when a particular user's access privileges are escalated for specific tasks on a system for a particular moment.
An example: chmod u+s file_name. Here, the setuid is added for the 'user'.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.