Question

In: Computer Science

Using repl.it, your own Linux installation, or other Linux emulator do the following and take screenshots...

Using repl.it, your own Linux installation, or other Linux emulator do the following and take screenshots for the steps that require it. Paste your screenshots into a word document, in the same order as the questions, and upload the file by 11 AM on Friday.

1. Show the contents of your home directory and take a screenshot

2. Create a directory named IT305 in your home directory and take a screenshot

3. Create a file called oldfile.txt in your home directory using the command line method of your choice. Make sure the file has at least 10 lines of characters in it. (I would suggest writing 10 lines that follow a pattern like this - This is line 1. This is line 2. and so on)

4. Create a new file in IT305 in the following manner:

use the nl command to number the lines of oldfile.txt, pipe that to the head command but only show the first 5 lines, pipe that to the tail command but only show 2 lines and redirect that output to the IT305 folder and create the newfile.txt. Do this on one command line. Take a screenshot of the command line that you use and of the contents of newfile.txt

5. Using the nslookup command, do a lookup of www.marymount.edu  (Links to an external site.)and redirect the output to a file named marymount.txt

6. del the IT305 directory and take a screenshot that shows that it is no longer in your home directory

Solutions

Expert Solution

Here are the answers and screenshots from my Linux machine:

1) First switch to your home directory using cd ~ command. Then you can use ls or ls -l command to list its contents. ls -la will list even the hidden files.

2) Once in your home directory (use cd ~ command), you can create a directory using mkdir command. mkdir IT305 will create the required directory.

3) To create oldFile.txt, we've used here cat > oldFile.txt command. Once your enter this command, it allows you to type and enter file contents. After you finish, press Ctrl+D key combination to save the file and exit the cat command. File can be checked from ls command and its contents can be checked using cat command.

4) Here we're using piping to send the output of one command to another using pipe ( | ) character. I've shown the series of commands to show how it works. The complete command is highlighted in red box which is:

nl oldFile.txt | head -5 | tail -2 > IT305/newFile.txt

assuming you're in your home directory already (use cd ~) if not.

Content of newFile.txt created using this command is also shown at the end using cat.

5) To use nslookup, we need to specify either hostname or IP for it to resolve it IP or hostname respectively via DNS. Since we have to redirect its output to a file called marymount.txt, our command would be:

nslookup www.marymount.edu > marymount.txt

We can see that a new file marymount.txt has been created using ls and to check its contents use cat command as shown at the end. The file content will match the output of nslookup run earlier.

6) A directory can be deleted using rm command. Since IT305 directory isn't empty and contains newFile.txt created as part of answer 4, we've to use rm -rf to remove it. So command is rm -rf IT305 when executed inside your home directory. We can verify the same has been removed by issuing ls command as shown in the end.


Related Solutions

Complete the following exercises using C programming language. Take screenshots of the code and its output...
Complete the following exercises using C programming language. Take screenshots of the code and its output where specified and paste them into in a well-labeled Word document for submission. Scenario Assume you are the CIO of an organization with three different IT department locations with separate costs. You want a program to perform simple IT expenditure calculations. Your IT expenditure target is $35,000 per site. Site expenditures: Site 1 – $35,000. Site 2 – $37,500. Site 3 – $42,500. Exercise...
(Complete Using Ubuntu) Please try each command in Linux system, and get screenshots (you may put...
(Complete Using Ubuntu) Please try each command in Linux system, and get screenshots (you may put multiple commands in one screenshot) which can show how actually each command runs. Also, give a brief description (one or two sentences) for each command. For the commands which have multiple switches/parameters, please try one popular switch/parameter. Linux Commands: rm,cp ,mv (name), ld, ftp, more, less, cat (date), tar, top, ps (name), kill, df, last, patch, mkdir (date)
Using Linux in VirtualBox Do the Following Exercise: Using the clear command At this point, you...
Using Linux in VirtualBox Do the Following Exercise: Using the clear command At this point, you screen might seem filled with commands and their results. Use the clear command anytime you want a clean slate. This exercise enables you to clear the screen now. To clear the screen: Type clear on the command line, and press Enter. The command prompt is now in the upper-left corner of your screen. [No output or questions for this part.] Viewing manual pages You...
Linux is open source software. Using your own words describe the essence of open-source software and...
Linux is open source software. Using your own words describe the essence of open-source software and how it differs from proprietary software, and explain in detail why one kind of software offers its users a more consistent experience.
Using short essay format and in your own words, answer the following questions. These do not...
Using short essay format and in your own words, answer the following questions. These do not need to be lengthy. Turn it as a word document via the View/Complete Assignment link below. 1. What is a nutrient? Name the six classes of nutrients found in foods. What is an essential nutrient? 2. Which nutrients are inorganic, and which are organic? Discuss the significance of that distinction. 3. Which nutrients yield energy, and how much energy do they yield per gram?...
48. Answer the following using your own words, do not copy from another source. A. Define...
48. Answer the following using your own words, do not copy from another source. A. Define the term enterotoxin and give an example of an organism (Genus and species name) that causes food poisoning and produces an enterotoxin. B. Define the term cytotoxin and give an example of an organism (Genus and species name) that causes food poisoning and produces a cytotoxin. 50. Choose ONE of the following questions to answer. You can write your answer on a separate sheet...
Using your own personal experiences and knowledge please discuss the following question: Do you believe that...
Using your own personal experiences and knowledge please discuss the following question: Do you believe that accounting is critical to our economic system? Why is it an integral part of our economic system Explain. Support your answers with at least one practical example. Why did you choose accounting as your major? If it is not your major, explain your reason for your selection of your major What is a CPA? What service can a CPA provide that a non CPA...
Your are to take the following c code and do the following on Eve: create a...
Your are to take the following c code and do the following on Eve: create a file with the code called quiz32.c create a second file with the code called quiz64.c Using gcc and stopping it after the Assembly phase, generate an optimization level 1, 32 bit ISA relocatable object file for quiz32.c Using gcc and stopping it after the Assembly phase, generate an optimization level 1, 64 bit ISA relocatable object file for quiz64.c obtain a list of the...
In MongoDB using Linux how do you Execute the command to find the size of a...
In MongoDB using Linux how do you Execute the command to find the size of a single document of your choosing from the enron database Execute the command to find the size of the collection of documents in the enron database
Please write shell scripts in Kali Linux to complete the following tasks. Task A - Take...
Please write shell scripts in Kali Linux to complete the following tasks. Task A - Take your UIN Write a script like below that reads and displays the MIDAS ID if the following requirements are satisfied: Only lower case letter [a-z] and numeric character[0-9] are allowed MIDAS ID must between 4 to 8 digits Test your script with the following examples: Your MIDAS ID in lower case Your MIDAS ID w.one upper case A string less than 4 digits A...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT