assignment2

docx

School

Washtenaw Community College *

*We aren’t endorsed by this school

Course

120

Subject

Computer Science

Date

Apr 3, 2024

Type

docx

Pages

3

Uploaded by PresidentFlowerAlbatross

Report
Assignment 2 CIS120 For this assignment you use this page to answer the questions shown below. You must do the commands as well. Each answer will follow the question and will be written in blue and bold. 1. Create a directory within your assignments directory named "assignment2" write the command you used to do this. mkdir assignment2 2. Go into your assignment1 directory (you should have created this in the last assignment, if you haven't then you need to create it first). From within your assignment1 directory write a single command that will redirect the long format output of the /usr/bin file and folder listing to a file named binfile.txt that will be written inside the assignment2 directory. Write the command you used here. ls -l /usr/bin > ../assignment2/binfile.txt 3. Staying in your assignment1 directory write a command that will output the contents of your binfile.txt file located in assignment2. cat ../assignment2/binfile.txt or less ../assignment2/binfile.txt 4. Starting in your assignment1 directory use a relative path to move to the assignments directory. Write the command here cd ../ 5. Staying in the assignments directory create a file inside the assignment2 directory by entering the following command a. echo "This is file 3 inside of assignment2" > assignment2/file3.txt DONE
6. From the assignments directory write a single command that will create a symbolic link named symln in the assignment1 directory that links to file3.txt in the assignment2 directory. Write the command here. ln -s ../assignment2/file3.txt assignment1/symln 7. NOTE: For this one you should have a dir1 directory inside your assignment1 directory from last week's assignment if you do not then you will need to create one. Also add two files to dir1, here is the code to make the files a. echo "this is some text" > file1.txt b. echo "this is some text" > file2.txt I completed last week’s assignment. Stay in the assignments directory and write a single command that will combine (using cat) all the files in the assignment1/dir1 directory to a file in the assignment2 directory named cat.txt. cat assignment1/dir1/* > assignment2/cat.txt 8. Stay in the assignments directory and write a single command to remove the file3.txt file from the assignment2 directory. Write the command here rm assignment2/file3.txt 9. Stay in the assignments directory and write a single command (using cat) that will output the file contents and any errors from the symln file in assignment1 to a file named symlncontents.txt which will be put inside the assignment2 directory. Write the command here cat assignment2/symlncontents.txt > assignment1/symln 10.If you view the contents of the symlncontents file you will see that an error stating " No such file or directory" yet symln is there so what is the problem? Because symlncontents.txt has no contents but it’s still connected to symln.
11.Stay or go into the assignments directory write a single command that lists all the files from /usr/bin/ directory that contain the letters "db" and output those names to a file named "db_names.txt" which will be in assignment2. Write the command here ls /usr/bin/ | grep db > assignment2/db_names.txt 12.Staying in the assignments directory write a single command that outputs all the files from the /usr/bin directory to a file in assignment2 named all.txt. It will also output all the files in the /usr/bin directory that contain "xml". It will output that list to a file named xml.txt in the assignment2 directory. Write the command here ls /usr/bin/* > assignment2/all.txt ; ls /usr/bin | grep xml > assign ment2/xml.txt
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help