Question

In: Computer Science

Part 1: netstat Run the 'netstat' command and review the output. Note that the first part...

Part 1: netstat
Run the 'netstat' command and review the output. Note that the first part
of the output is a list of active Internet connections, and the second part
is a list of active sockets. The format of each part is different (i.e. different
number of columns per line, and different column headers).

1.  Write a bash command line that will display the number of active Internet
    connections as reported by 'netstat'.  Your output should be a single number.

2.  Write a bash command line that will display the number of active Internet
    connections with non-zero 'Send-Q' values, as reported by 'netstat'.  Your
    output should be a single number.

3.  Write a bash command line that will display the TOTAL of all 'Send-Q' values 
    for all active Internet connections reported by 'netstat'.  In other words, 
    calculate and display the numeric total of the 'Send-Q' column of the 'netstat'
    output. Your output should be a single number.

4.  Is the 'Foreign Address' reported by 'netstat' an internal or external address?
    Explain why.

5.  Write a bash command line that will display the 'I-Node' and 'State' values
    for all active UNIX domain sockets whose State is "CONNECTED" and whose "Path"
    value is empty (i.e. all spaces)

6.  Write a bash command line that will display the 'Type' and 'I-Node' values for
    all active UNIX domain sockets whose 'RefCnt' value is greater than 2.

Part 2: hostname
Review the 'man' documentation for 'hostname'.  

7.  Execute a 'hostname -i' command.  
    Is the IP address displayed by 'hostname' an internal or an external address?  
    Explay why.

Part 3: ping
Review the 'man' documetation for 'ping'.  
Execute a 'ping www.pcc.edu' command and review the output.

8.  Is the IP address shown for www.pcc.edu an internal or an external IP address?
    Explain why.

9.  Write a bash command line that will ping 'www.pcc.edu' 10 times, and then display
    the average ping time in milliseconds. Your output should be a single number.

Solutions

Expert Solution

1. Write a bash command line that will display the number of active Internet
    connections as reported by 'netstat'. Your output should be a single number.

   netstat | grep ESTABLISHED | wc | awk '{ print $1 }'

2. Write a bash command line that will display the number of active Internet
    connections with non-zero 'Send-Q' values, as reported by 'netstat'. Your
    output should be a single number.
  
   netstat | grep ESTABLISHED | awk '{ print $3 }' | grep -vcw 0
  

3. Write a bash command line that will display the TOTAL of all 'Send-Q' values
    for all active Internet connections reported by 'netstat'. In other words,
    calculate and display the numeric total of the 'Send-Q' column of the 'netstat'
    output. Your output should be a single number.

   netstat | grep ESTABLISHED | awk '{ print $3 }' | awk -F '|' '{sum+=$NF} END {print sum}'


5. Write a bash command line that will display the 'I-Node' and 'State' values
    for all active UNIX domain sockets whose State is "CONNECTED" and whose "Path"
    value is empty (i.e. all spaces)
  
   netstat | grep CONNECTED | awk '{if ($8) print $0;}' | awk '{ print $6 " " $7 }'

6. Write a bash command line that will display the 'Type' and 'I-Node' values for
    all active UNIX domain sockets whose 'RefCnt' value is greater than 2.

   netstat | grep CONNECTED | awk '{if ($2 > 2) print $0;}' | awk '{ print $5 " " $7 }'


9. Write a bash command line that will ping 'www.pcc.edu' 10 times, and then display
    the average ping time in milliseconds. Your output should be a single number.
  
   ping www.google.com -c 10 | grep rtt | awk '{print $4}' | cut -d / -f 2


Related Solutions

1. Show how to redirect the standard output of the date command to a file named...
1. Show how to redirect the standard output of the date command to a file named currentdate. 2. Continuing from the previous question: Show how to append the standard output of the who command to the file currentdate. 3. The password file (/etc/passwd) contains one line for each userid registered with the system. Show how to display the number of userids in the passwd file on the screen. 4. Employ a pipe to combine the who and the wc commands...
Compile and run the following code then answer the following questions: a.) Run this command from...
Compile and run the following code then answer the following questions: a.) Run this command from the shell prompt: ./a.out ls -F Explain, in your own words, why you see the screen output you do and how that output relates to both the content of the program AND the nature of the shell command used to invoke it. Be sure to comment on the pointer arithmetic done inside the line: execvp(*(argv+1), argv+1); b.) Run this command from the shell prompt:...
1. For each of the following events, explain the short-run and long-run effects on output and...
1. For each of the following events, explain the short-run and long-run effects on output and the price level, assuming policymakers take no action using a AS-AS-LRAS graph. (8 points) a. The stock market declines sharply, reducing consumers’ wealth. b. The federal government increases spending on national defense. c. A technological improvement raises productivity. d. A recession overseas causes foreigners to buy fewer U.S. goods and services. e. Using AS-AD-LRAS graph, explain the consequences of the budget deficit on output...
1A.Draw two graphs. On the first, show the short-run profit maximizing output of an individual firm...
1A.Draw two graphs. On the first, show the short-run profit maximizing output of an individual firm earning an economic profit, including MR, MC, AVC, and ATC. On the second, show the short-run market equilibrium price and quantity. Explain how the industry supply curve and the market equilibrium price and quantity are determined. B.Draw the MC, MR, ATC, and long-run ATC curves for a perfectly competitive firm in long-run equilibrium. Explain the relationship between those curves. Next, draw another graph showing...
Please note that this assignment consists of two separate parts. The first part gives the cash...
Please note that this assignment consists of two separate parts. The first part gives the cash flows for two mutually exclusive projects and is not related to the second part. The second part is a capital budgeting scenario. Part 1 Please calculate the payback period, IRR, MIRR, NPV, and PI for the following two mutually exclusive projects. The required rate of return is 15% and the target payback is 4 years. Explain which project is preferable under each of the...
1- Discuss the importance of starting the review of the evaluation note by determining what interventions...
1- Discuss the importance of starting the review of the evaluation note by determining what interventions the physical therapist wants you to provide. 2-What are some questions that the physical therapist assistant should ask when reviewing the evaluation note to guide interventions? 3- Why is it important to document patient education and communication within the intervention provided in the Patient/Client Management Model?
1) In the long run, the short-run aggregate supply curve shifts to eliminate any existing output...
1) In the long run, the short-run aggregate supply curve shifts to eliminate any existing output gaps. Depict the parallel shift of the short-run aggregate supply curve that occurs in the long run. 2) Following a reduction in consumer spending, in the long run, what is the value of real GDP in this economy?
Conducting a Bank Reconciliation Note: Part 1 is the bank reconciliation itself and Part 2 is...
Conducting a Bank Reconciliation Note: Part 1 is the bank reconciliation itself and Part 2 is for the adjusting entries. Instructions: Using the information below, complete the bank reconciliation for both the "book" and the "bank" sides and create all necessary adjusting journal entries. Details: Cash balance per company's records as of July 31st was $66,955. Bank statement balance as of July 31st was $15,875. A deposit in the amount of $52,000 was deposited into the night depository of the...
 how to run a t-test using STATA step by step?(command)
 how to run a t-test using STATA step by step?(command)
PART 1 Below there are the 4 steps for analyzing short run and long run macroeconomic...
PART 1 Below there are the 4 steps for analyzing short run and long run macroeconomic fluctuations. Apply them when answering the following two scenarios: 1.1 How does the increase in AI (Artificial Intelligence) affect the economy (AS-AD)? Follow the 4 steps below and present the excel graph or handwritten graph. 1.2 How does a reduction on exports affect the economy (AS-AD)? Follow the 4 steps below and present the excel graph or handwritten graph.. 4 Steps for Analyzing Short-Run...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT