Question

Write the AWK COMMAND that would show the user wmorales (or yourself) that is online (you...

Write the AWK COMMAND that would show the user wmorales (or yourself) that is online (you have to use a pipe)

Output, depending on the system, would be similar to:

$ wmorales pts/0 192.220.32.72 4:18pm 0.00s 0.07s 0.02s w

0 0
Add a comment Improve this question Transcribed image text
Answer #1

w is the command used to find who are online and what they are doing.

Here the content of line 3 of the w command is what we need here.

w x0r_d3v1l | awk 'NR==3'

Here x0r_d3v1l is user in this case.

Here the output of the command w x0r_d3v1l is piped to awk and NR is used to keep the current count of the record which is in general line. Here we need the line 3 of the command w hence we are checking with NR==3.

The output of the command may change from at your system as it depends on the current usage,uptime etc.

xor_d3vil@msi:-$ w 00:14:09 up 16 min, 1 user, load average: 0.95, 1.12, 1.13 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT xor_d3

Add a comment
Know the answer?
Add Answer to:
Write the AWK COMMAND that would show the user wmorales (or yourself) that is online (you...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • QUESTION 1 From YOUR home directory, execute a find command string that will locate the file...

    QUESTION 1 From YOUR home directory, execute a find command string that will locate the file called resolv.conf. Include the -exec flag in the find command to cat the file to the screen. Begin your find search from the letc directory Select the correct find command string below that will accomplish this. find /etc-name 'resolv.conf -cat D find /etc-name 'resolv.conf -exec cat 0 find. -name 'resolv.conf -exec cat 0\ find /-name 'resolv.conf' -exec cat 0 QUESTION 2 What find command...

  • 1) Write a Unix command that will display the message below using echo and the value...

    1) Write a Unix command that will display the message below using echo and the value of your environment variable instead of the sample student login /students/astud01 My home directory is /students/astude01 2) Write a Unix command to display your login and the system date with both commands on one line (the output may be on separate lines) SAMPLE OUTPUT (details will differ): cconner Tue Jul 7 15:38:44 PDT 2015 3) 1.Write a Unix command that will redirect (>) the...

  • cant you assume there is file like that that exists and just write a command for...

    cant you assume there is file like that that exists and just write a command for it. Task 3 (20 points) I have a text file located at: /home/hb117/class/cs371/labo2/global.txt In this task, you will design a pipe that print out the numbers of time the word "more", "than", "that", "scientists" and "global'appear in the article. Hint: use sort, uniq, tr and grep. Your pipe will need to start with tr: tr n " </home/hb1177class/c8371/1ab02/global.txt The output of your command should...

  • Exercise 1: Write a shell script that loops through the /etc/passwd file one line at a...

    Exercise 1: Write a shell script that loops through the /etc/passwd file one line at a time. Prepend each line with a line number followed by a colon and then a space. Example output: 1: root:x:0:0:root:/root:/bin/bash 2: daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin 3: bin:x:2:2:bin:/bin:/usr/sbin/nologin 4: sys:x:3:3:sys:/dev:/usr/sbin/nologin Exercise 2: Write a shell script that asks the user for the number of lines they would like to display from the /etc/passwd file and display those lines. Example output: How many lines of /etc/passwd would you like...

  • Please write the Linux commands and run them. h. What is the command or commands that...

    Please write the Linux commands and run them. h. What is the command or commands that would list the contents of the /var/log directory in alphanumeric order? List the command and its output. i. What is the command or commands used to list the files in /var/log in order of their size? List the command and its output. j. What is the command or commands used to list the top 10 file who use the most disk space? What is...

  • You must write a C program that prompts the user for two numbers (no command line...

    You must write a C program that prompts the user for two numbers (no command line input) and multiplies them together using “a la russe” multiplication. The program must display your banner logo as part of a prompt to the user. The valid range of values is 0 to 6000. You may assume that the user will always enter numerical decimal format values. Your program should check this numerical range (including checking for negative numbers) and reprompt the user for...

  • a) Write a one-line sed command that will replace all multiple spaces in a file called...

    a) Write a one-line sed command that will replace all multiple spaces in a file called names.txt (this is an arbitrary file that you may create yourself) by only one space. b) Consider the following file called system.txt: 1  2  3  4 5  6  7  8 9  He 11 Hg Ts H  15 Be 17 Mc Li 20 Write a one-line sed command that replaces the second number in every line with the string “system”, without the quotes. For example,...

  • Please use matlab cars. Answer: Function file; Command Window: 5.4 Write a user-defined function that plots...

    Please use matlab cars. Answer: Function file; Command Window: 5.4 Write a user-defined function that plots a circle given the coordinates of the center and the radius. For the function name and arguments use circleplot(x,y,R). The input arguments are the and y coordinates of the center and the radius. Use linspace to generte the angle from 0 to π with 100 points. (Hint: the circle equation: x+Rcos and yy-yRsin 0.) This function has no output arguments. Plot the circle using...

  • you are going to write a program, fastfactor, to find all the inegral factors of a...

    you are going to write a program, fastfactor, to find all the inegral factors of a number (integer). the program must be written in C. note that in C (as in most languages) % is a remainder operator, so if x % 3 == 0 that means 3 is a factor of x. you are going to write fastfactor to work like a "standard" UNIX command: the user can invoke the command like fastfactor 12 13 which would output 12:...

  • 1, If you were to produce online content what communication method would you use?If you were...

    1, If you were to produce online content what communication method would you use?If you were to produce online content what communication method would you use? 2, What reference site would you use to build your content Or use as an example to help develop your idea? 3, Provide a brief description of your online content. 4, What web based resources would you use to market yourself?

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT