Instructions: For each question, you must give the complete/full command that when executed in a
Linux Bash shell it gives the correct output (as stated in the question). Full credit is given only when
command executed successfully and gave the correct output.
Example
Question: What is the command to list the contents of the current directory in long format?
Answer: ls –l
Note: Quotes surrounding certain terms such as “ls”, “/etc/passwd”, “work”, etc. are NOT part of that
term. The quotes are only for highlighting the terms. When using that term remove the quotes. Your
answer must be the exact string that is typed into the Bash shell.
1. Your home directory currently has permissions “rwxr-xr-x”. Give 3 different ways to change the
permissions to “rwxrwx—“.
2. What is the command to create a file named “#secret”?
3. What is the command to save the contents of both files “/proc/cpuinfo” and “/proc/meminfo” to a
file named “hwinfo.txt” in your own home directory and have nothing printed on the screen?
4. What is the command to find all files in directory “/etc” (and its subdirectories) whose filenames
ended in “config”?
5. What is the command to display the names of all files in the system that are bigger than 10 MB and
do not display any error message regarding files/directories you cannot access?
6. What is the command to display a sorted list in ascending order (A to Z) of all files in “/etc” (and its
subdirectories) that contain the string “address” somewhere in the contents of the file?
CPSC-254 Fall 2017 Prof. Thomas Nguyen Assignment #2 pg. 2
7. What is the command to unpack a tarballed and compressed file named “grep.tgz” in
“~/Downloads” and have the outputs placed in “~/source”?
8. What is the command to list just the PID of all “bash” processes currently running in the system?
9. What is the single command to both display the calendar for the year 2017 on the console and save
it a file named “cal2015.txt”?
10.What are the outputs of the commands “yes please” and “who is best?”? Explain why you got the
outputs that you got.
Expert Answer
1
chmod -R 770 ~/
chmod -R u=rwx,g=rwx ~/
chmod -R g+w,o-rx ~/
2
touch ‘#secret’
3
cat /proc/cpuinfo /proc/meminfo > hwinfo.txt
4
ls -R | grep config$
Champ, here you go. We are suppos to answer 4 sub questions according to chegg protocol, so have to leave here. If you face any problem with any of the question, question me in the comment section below