Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the Unix command that performs the requested action: 1. Finger all the cur

ID: 3665826 • Letter: W

Question

Write the Unix command that performs the requested action:
1. Finger all the currently logged in users who have the string “le” anywhere in their name and redirect the output into a file named fingeredUsers.txt. Do this as a single one-line Unix command expression.
2. Assuming you are in your home directory, write all the Unix command-line commands you would use to do the following: create a sub-directory called Source. The Source directory will have two additional sub-directories: Backup and Docs, create these as well. Assume your home directory has a bunch of .doc and .java files. Write two commands executed on a single command-line that copies all the .doc files into the Docs directory and the .java files into the Source directory. Write all the above command-line commands without moving away from your home directory.

Explanation / Answer

Question 1:

who command is used to get all the currently logged in users so we will cut "who" command.

we need only user name, so will use "cut" command to remove other information except user name.

we also need to filter out the repeated name, so we will use the "sort" command also.

we need to get the name of all users having "le" string in their name so we will also use "grep" command

So now one line unix command is: who | cut -d " " -f 1 | sort -u | grep -i "le" > fingeredUsers.txt

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote