Lab 4 Redirect command outputs and save Fall 2023

docx

School

Oakland University *

*We aren’t endorsed by this school

Course

4130

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

5

Uploaded by kegreve

Report
Lab Chapter 4: Redirect Command Outputs and Save Them as Files Due Date: October 4 th by midnight In this lab, you will redirect the output of commands from the Command Prompt and save them as files for review. You will append data to existing files and copy and paste output into a new file. Task 1 : For this lab, the greater than (>) symbol will be referred to as redirect. First, enter the following command: ipconfig> ipconfigtest.txt. In this case, you have run the ipconfig command and redirect the output to a text file named ipconfigtest.txt. By default, the file is saved to the current default folder, C:\Users\LabConnection. Locate and open the file with Windows Explorer. Examine the file. Close the file and minimize Windows Explorer. Task 2 : To specify the location of the file when you create it, add the path to the file in the command line. For example, to save the file to the desktop, enter the following command: ipconfig>C:\Users\LabConnection\Desktop\ipconfigtest.txt.
Task 3 : To append data to an existing file, use the double redirect (>>) operator. Enter this command: ipconfig >> C:\Users\LabConnection\Desktop\ipconfigtest.txt. The new output will appear at the end of the existing file and all the data is preserved within this single file. Minimize the Command Prompt. Open the file. You can see the output is now listed twice. This option is useful when collecting data from repeated tests or from multiple computers where you want all the data to converge into a single file for future use. Close the file. Task 4 : Restore the Command Prompt. We will use command parameters next. The netstat command is used to show the IP address and port of each TCP and UDP connection on the computer. Here we will use the netstat command and redirect the output to a file. Type: netstat – an > C:\Users\LabConnection\Desktop\connections.txt. Minimize the Command Prompt, then locate and examine the new file. Close the file.
Task 5 : You can include a space in the filename by putting quotation marks around the entire filename and location. Enter: ping 8.8.8.8 > “C:\Users\LabConnection\Desktop\find google.txt”. Minimize the Command Prompt and review the new file. Close the file when finished. Task 6 : Restore the Command Prompt. Now try to copy and paste from the Command Prompt window to a new file. Run the command ipconfig/all. The new output populates your Command Prompt window. Now you are going to copy the new output to the Clipboard. Click the Command Prompt icon in the top left corner of the window, point to Edit, and then click Mark. The ipconfig output has been selected for you; press the Enter key to copy it to the Clipboard. Close the Command Prompt. Task 7 : On the desktop, open the text document named ipconfig Copy.txt and paste the selected text into your document. Review the contents, save the document, and then close it.
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
Questions 1. What is the best method for saving the results of a command from the Command Prompt window? a. Print screen b. Drag the window into graphics program c. Mark the text and copy/paste into a new file d. Any of these will work 2. At the command prompt, what function does the “>” symbol perform? a. Redirects the output b. Copies the screen c. Sends the output to the desktop d. Appends the output to the last file used 3. At the command prompt, what function does the “>>” symbol perform? a. Redirects the output b. Copies the screen c. Sends the output to the desktop d. Appends the output to the last file used 4. In order to use a filename with a space in its path from the command prompt, what symbol is used? a. - b. / c. \ d.
5. To support a path and filename with a space in it, what would you enter? a. Quotation marks around filename b. Quotation marks around all spaces c. Quotation marks around the entire path and filename d. None of these will work