For each of questions 8 to 15, describe what UNIX command (or series of commands
ID: 3907576 • Letter: F
Question
For each of questions 8 to 15, describe what UNIX command (or series of commands) you would have to enter in order to perform the required operation: 8. Delete a file called doc1. Rename the file compA1 to be compAl.txt. Show the contents of the/gator/faculty directory. Sort the contents of the text file called websites. Create a directory called school and subdirectories econ and info. Find the name of the user whose user name is hfor1234 Delete all the files in a directory called dir1, and also the directory. Move all the files with names starting with asst into a new directory 10. 12. 13. 14 15. called assignments.Explanation / Answer
Q8: rm -f doc1
Q9: mv compA1 compA1.txt
Q10: ls -l /gator/faculty/*
Q11: sort websites -o websites
Q12: mkdir -p school/{econ,info}
Q13: getent passwd | grep hfor1234 | awk -F: '{print $5}' | awk -F, '{print $1}'
Description - retrieves the related entry from /etc/passwd and then parses the line, to retrieve the user's name
Q14: rm -fr dir1
Q15: mkdir assignments && find asst* -maxdepth 1 -type f -exec mv {} assignments/ ;
Desc: First, create the target directory and then find only the files in the current directory that start with asst and move then to assignments folder.
If you have any queries or changes, please leave a comment.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.