Question

Unix bash script: I know you use the top command but else do you have to...

Unix bash script:

I know you use the top command but else do you have to do? Please Explain.

Show a real-time view of system information, such as CPU usage, memory usage, etc., and the processes using the most CPU, memory and time.

Show a real-time view of system information, such as CPU usage, memory usage, etc., and just your processes using the most CPU, memory and time.

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

Q. Show a real-time view of system information, such as CPU usage, memory usage, etc., and the processes using the most CPU, memory and time.

A. No need to use any other filter/option from top command, as its default options let you see all these data in real-time view.

Just use top command in bash shell and you’ll have your required answer.

Below image is having no filter/option , just top command

Q. Show a real-time view of system information, such as CPU usage, memory usage, etc., and just your processes using the most CPU, memory and time.

A. For this you need to use one of the option/filter of the top command and that is -u (hyphen u) . If that user’s not present , it’ll throw error Invalid user and exit

command : top -u <user’s name>

example : top -u HomeworkLib

Below image is having specific user and option 'i'

While using top command you can use following options as well to sort more:

1. ‘i’ --> this option will first remove the idle processes from the top’s output , if pressed again , you can have your default top’s command output

command : top -i (this will also work)

2. ‘P’ --> this option will let you sort by CPU Usage

3. ‘d’ --> this option will let you decide how much delay in seonds you want between two consecutive outputs of top command. By default its set to 5 seconds.

Command : top -d <second>

Add a comment
Know the answer?
Add Answer to:
Unix bash script: I know you use the top command but else do you have to...
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
  • Unix Help - I cant figure out how to answer the last question. Please help! Write...

    Unix Help - I cant figure out how to answer the last question. Please help! Write a bash script to produce the answers to each of the questions below. Before the output, echo to the screen the question number and the command that will be executed. Show a real-time view of system information, such as CPU usage, memory usage, etc., and the processes using the most CPU, memory and time.

  • How do I do the following on a Unix Command Line Prompt: Change you command-line prompt...

    How do I do the following on a Unix Command Line Prompt: Change you command-line prompt to some interesting phrase/word of your choice Change the command-line prompt to display your user name and your current working directory (this includes your interesting phrase/word) Create a short alias for “ls -l -a”, it is up to you, but maybe “lsa” Execute the “who” command together with the “grep” command to identify whether your peer group (or any 3 or more people) are...

  • Hello all, I have a c++/unix (bash) question. I am struggling on starting this assignment. If...

    Hello all, I have a c++/unix (bash) question. I am struggling on starting this assignment. If you could start the assignment and tell me how to do the rest it would be greatly appreciated! (Quick thumbs up answer response if thorough and correct) Maintain automobile records in a database Write a shell script to create, view and modify a simple database that contains automobile records. The shell script has to be done in Bourne shell syntax (bash as a matter...

  • 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 type your answer, thank you! :) The subject is UNIX Using the BASH for and...

    Please type your answer, thank you! :) The subject is UNIX Using the BASH for and while loops (Textbook question 13.19 page 403) 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...

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

  • LUNIX (Please Label) Exit vi (:q) and from the command line, type viscript4.sh. For this script,...

    LUNIX (Please Label) Exit vi (:q) and from the command line, type viscript4.sh. For this script, we will iterate through all files in the current directory print out their name using the for loop. Example (do not type yet): foriin*;do …;done where the…does some operation on$I, which stands for the current file. To do this, enter the following in your script4.sh file:           #!/bin/bash           for i in *; do                echo $i           done Once the above works, change the for loop to...

  • Using Unix processes Submit a README file that lists the files you have submitted along with...

    Using Unix processes Submit a README file that lists the files you have submitted along with a one sentence explanation. Call it Prj1README. MakeCopy.c : Write a C program that makes a new copy of an existing file using system calls for file manipulation. The names of the two files and copy block sizes are to be specified as command line arguments. Open the source file in read only mode and destination file in read/write mode. ForkCopy.c : Write a...

  • Unix questions, i need help on Hint: Commands to study to answer this question: predefined shell...

    Unix questions, i need help on Hint: Commands to study to answer this question: predefined shell variables, and .profile script file, echo SHELL, HOME, PATH, MAIL and TERM are predefined shell variables. You can use the value of a shell variable in a shell command putting $ in front of it. For example, to display the value of the HOME directory of the user, specify $HOME in the echo command like echo $HOME. Do not give just the value of...

  • Question 2 0/1 point (graded) What happens when you remove a directory using the command rm...

    Question 2 0/1 point (graded) What happens when you remove a directory using the command rm -r? You cannot remove a directory using the rm command. You permanently remove the entire directory, including all files and subdirectories. You move the entire directory to a trash folder, but it can be restored later. You get a warning message asking if you want to proceed, then you delete the directory. incorrect Answer Incorrect: Try again. Unix does not warn you before permanently...

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