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

Binary Search Tree (Part 1): Note: This is the first part of a 2-part lab. Only...
Binary Search Tree (Part 1): Note: This is the first part of a 2-part lab. Only this part is due on Oct 29. But please get it working or you will struggle with the second part. For the second part, the data type will be changing. For now, it is a string. Contents Explanation: 2 BST.cpp: 2 Code you must write: 2 bool insert(string s) (7): 2 TNode *find(string s) (4): 2 void printTreeIO(Tnode *n)(3): 2 void printTreePre(Tnode *n) (3):...
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...
1) Open a new terminal. a) Use the runlevel command. What is the current run level...
1) Open a new terminal. a) Use the runlevel command. What is the current run level of your system? b) Use the command ls /usr/lib/system/system . What does this show? c) Use the command ls /etc/rc.d. What does this show? d) Use the command ls/etc/rc.d/init.d. What SysV daemons are available on your system? e) Type init 3 and press Enter. The type runlevel. What is the most recent runlevel? f) Type init 1 and press enter. Does the runlevel command...
Part Two: Download VendingChange.java (above). Run it and become familiar with the output. Essentially, you need...
Part Two: Download VendingChange.java (above). Run it and become familiar with the output. Essentially, you need to create a user friendly GUI app using the code parameters of VendingChange. Turn VendingChange.java into a GUI app. 1) Your program must display the input dialog. 2) You must check that the data entered by the user follows the required input. If not, your program must display an error dialog and exit. 3) If the input is valid, then your program must display...
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) 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?
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?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT