In: Computer Science
PLEASE EXPLAIN AND SHOW HOW TO DO THESE! (especially all the passwd ones!!)
Perform the following on your Linux instance:
-Execute the command ls -l /etc/hosts /fakepath. Send the standard output to a file named ${HOME}/ls-stdout and the standard error to a file named ${HOME}/ls-stderr.
-Print the text Hello, World! to a file named ${HOME}/info. Overwrite the file if it already exists. Then, append the text The date is: to the ${HOME}/info file. Finally, append the standard output of the date command to the ${HOME}/info file.
-Print all lines that contain both the string nologin and the string run within the /etc/passwd file. Send the standard output to the file ${HOME}/passwd-nologin.
-The /etc/passwd file contains colon-delimited values. For all lines within /etc/passwd, print the 7th field, filtering the output so it only contains unique values. Send the standard output to the ${HOME}/passwd-unique file.
-Print the first 5 lines of the /etc/passwd file, changing all occurrences of the character x to the character !. Send the standard output to the ${HOME}/passwd-modify file.
-Print all lines within the /etc/passwd file that contain a 3 digit number in the range 900 to 999. Send the standard output to the ${HOME}/passwd-number file.
-Print all lines within the /etc/passwd file that begin with the string sh, ss, or sy. Send the standard output to the ${HOME}/passwd-prefix file.
-Create a file named ${HOME}/text-edit with the following content:
This is college.
It is located in America.
This is the third line of text.
For credit on this assignment, upload one or more screenshots showing the following:
-The output of cat ${HOME}/ls-stdout.
-The output of cat ${HOME}/ls-stderr.
-The output of cat ${HOME}/info.
-The output of cat ${HOME}/passwd-nologin.
-The output of cat ${HOME}/passwd-unique.
-The output of cat ${HOME}/passwd-modify.
-The output of cat ${HOME}/passwd-number.
-The output of cat ${HOME}/passwd-prefix.
-The output of cat ${HOME}/text-edit.
Answer 1
************
Answer 2
***************
Answer 3
*************
Answer 4
*************
Answer 5
**********
Answer 6
*************
Answer 7
*************
cltr + d to save
if you have any doubt then please ask me without any hesitation in the comment section below , if you like my answer then please thumbs up for the answer , before giving thumbs down please discuss the question it may possible that we may understand the question different way and i can edit and change the answers if you argue, thanks :)