Question

Examine the following script, n-on: who | sort | awk '{print $1}' | uniq | wc...

Examine the following script, n-on:

who | sort | awk '{print $1}' | uniq | wc -l

What will be the output of n-on?

(A) The number of processes running for each user that is currently logged on to the system.

(B) The number of users logged on to the system at the time the script is run.

(C) The date and time of your last login to the system.

(D) A list of all the users currently logged on to the system and the date and time they logged on.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
  • let's break down each command and discuss them one by one
  • 1.) who : this command will list all the users that are currently logged into the system. Each line of the list will contains these field in that order: NAME LINE TIME COMMENT
  • 2.) sort : this command will sort the list returned by who command
  • 3.) awk '{print $1}': this command will return only the first fields in the list returned by sort. That is, the command will all the NAME of currently logged in users.
  • 4.) uniq: this command will filter all the unique name is NAME list returned by previous command.
  • 5.) wc -l: this command will count the number of line in the NAME list. This count will be equal to number of users currently logged in to the system.
  • Answer: B
Add a comment
Know the answer?
Add Answer to:
Examine the following script, n-on: who | sort | awk '{print $1}' | uniq | wc...
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
  • I need this done ASAP. Please write a bash shell script that does the following: Prints...

    I need this done ASAP. Please write a bash shell script that does the following: Prints out how many users are logged on. This can be accomplished using who and wc. Prints out a list of currently logged on users. This can be accomplished using who, grep, regular expressions, and echo. Prints out how many processes you have running from past days, and a list of those jobs. Use `whoami` to get your username. Run ps -ef and see how...

  • Write a shell script to solve the following business problem. Create a file called whoislogin.out...

    Write a shell script to solve the following business problem. Create a file called whoislogin.out that contains the output of the who command, then append to the whois.out file, the output of the date and finger commands. Your script should prompt to pick any users from the list of users currently logged onto the system. Use the variable concept to search for the specific user from those displayed on the screen coming from the who is.out file created. Show a...

  • In UNIX Write a script that checks each minute and reports on who logs in and...

    In UNIX Write a script that checks each minute and reports on who logs in and who logs out. You can follow the steps below (not the only way): Using the commands who and cut, extract the list of usernames currently logged in the system To check after a minute, the sleep command can be used: sleep 60 Get the new list of users logged in after a minute For each user in the list; check if he is in...

  • 1. Write the command to set the following permissions on a script file with the following...

    1. Write the command to set the following permissions on a script file with the following name; myscript.sh Owner: full access; read, write and execute Group: read and execute Other: no access 2. Create a new file with the name "myfirstscript.sh". Write a new script that performs the following tasks in sequence; Display the usernames of currently logged in users; sorted from a-z HINT: You will need to filter the output of the whocommand Display a list of usernames who...

  • Open vi or pico and create a script called Information.   Add the contents from the following table to the script: (Hin...

    Open vi or pico and create a script called Information.   Add the contents from the following table to the script: (Hint: use echo to add blank lines to your output and to write out the headings). Headings: Utilities (command to execute) Today’s date is: date The current users logged on to the system are: who My current startup directory is: pwd Today’s identification information is: id The processes running on my system are: ps Add a header to your Information...

  • 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...

  • You will create a shell script that prints out the following information about the system it is run on: • The system’s n...

    You will create a shell script that prints out the following information about the system it is run on: • The system’s name and IP address • How much memory the system is currently using, and how much total memory it has • The number of CPUs of the machine • The number of unique users on the system at that moment When your script is run, each of these values should be clearly labeled in the output, such as...

  • INFO 1211

    Lab 0: Essential UNIX OperationsObjectivesAt the end of this of lab, you should be able to:securely      log in to a remote computer running a UNIX-like operating systemread the      manual page for any commanduse the      UNIX file systemedit a      text fileNotes:·         In order to get familiar with UNIX, do all your work on UNIX.·         A command line interface may be harder to learn, but can be more powerful for scripting and automating tasks.·        ...

  • The first script is validate.sh. This is a simple form validation script that will be used...

    The first script is validate.sh. This is a simple form validation script that will be used to verify the inputs given. Normally, this would be done to validate input from a website or another program before entry into a database or other record storage. In this case, we will keep it simple and only focus on the input validation step. In particular, the script should prompt the user for four values: first name, last name, zip code, and email address....

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