Question

What are the exact commands I should use to complete the task? 1. Run command (date;...

What are the exact commands I should use to complete the task?

1. Run command (date; sleep 45; echo “Done.”; date) > date.out in the foreground (i.e. without &)

2. Suspend it with Ctrl-Z. Pay attention to the number in the [], it will become handy later. This number is the job number of the command that has been suspended.

3. Run command top to display only processes started by you (i.e. associated with your userid). Write down the process ID of the sleep 45 process. Quit command top by entering q.

4. Run command sleep 60 &, repeat step 3 and write down the process ID of the sleep 60 process. Note that top will display both sleep processes so you need to identify the one that is started later.

5. Run command sleep 100&, repeat step 3 and write down the process ID of the sleep 100 process.

6. Run echo “Process ID of sleep 45 is X and process ID of sleep 60 is Y, and that of sleep 100 is Z”, where X, Y and Z are process ID of the three sleep processes started earlier

7. Put the previously suspended command into the background with command bg.

8. Run command jobs

9. Bring the command in step 1 back into the foreground with command fg, wait until it finishes.

10. Kill the sleep 60 process with the kill command

11. Kill the sleep 100 process with the kill command

12. Run command jobs

13. Using ps –ef and grep to list all processes started by you and verify that there is no sleep process remain

14. Display the content of file date.out using the cat command

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

NOTE: I have completed your assignment. Please check and let me know if you find any issues. I will revert back within 24 hours. thanks for your patience.

The output of these command might not be same in your system. So use the commands i have provided sequentially and let me know if you have any questions.

1. Run command (date; sleep 45; echo “Done.”; date) > date.out in the foreground (i.e. without &)
Ans)
Command:
(date; sleep 45; echo “Done.”; date) > date.out

Explanation:
1) This command starts date command and sleeps for 45 seconds
2) once the sleep time is over i.e. 45 secs in this case. it will execute another date command and write to date.out file

2. Suspend it with Ctrl-Z. Pay attention to the number in the [], it will become handy later. This number is the job number of the command that has been suspended.
Ans)
Command:
Unix Terminal> (date; sleep 45; echo “Done.”; date) > date.out
^Z
[1]+ Stopped ( date; sleep 45; echo “Done.”; date ) > date.out
Unix Terminal>

Explanation:
1) ctrl-z will suspend the current process
2) we can see the suspended process job id is 1. Note that it differs from system to system and it might not be same in your computer.

3. Run command top to display only processes started by you (i.e. associated with your userid). Write down the process ID of the sleep 45 process. Quit command top by entering q.
Ans)
Command:
top -u vishal

pid : 23

Explanation:
1) Execute the top command like i have shown
2) Identify the sleep command in top command listing and note down the process Id. In my case the sleep process id is 23.

4. Run command sleep 60 &, repeat step 3 and write down the process ID of the sleep 60 process. Note that top will display both sleep processes so you need to identify the one that is started later.
Command:
bash-4.4$ sleep 60 &
[2] 37
bash-4.4$  

bash-4.4$ top -u vishal

pid: 37

Explanation:
1) Run the command sleep 60 & which sleeps for 60 seconds and runs in background
1) Execute the top command like i have shown
2) Identify the sleep command in top command listing and note down the process Id. In my case the sleep process id is 37.


5. Run command sleep 100&, repeat step 3 and write down the process ID of the sleep 100 process.
Command:
bash-4.4$ sleep 100 &   
[3] 39
bash-4.4$

bash-4.4$ top -u vishal
pid: 39

Explanation:
1) Run the command sleep 100 & which sleeps for 100 seconds and runs in background
1) Execute the top command like i have shown
2) Identify the sleep command in top command listing and note down the process Id. In my case the sleep process id is 39.


6. Run echo “Process ID of sleep 45 is X and process ID of sleep 60 is Y, and that of sleep 100 is Z”, where X, Y and Z are process ID of the three sleep processes started earlier
Command:
bash-4.4$ echo "Process ID of sleep 45 is 23 and process ID of sleep 60 is 37, and that of sleep 100 is 39"   
Process ID of sleep 45 is 23 and process ID of sleep 60 is 37, and that of sleep 100 is 39
bash-4.4$   

Explanation:
1) As you have noted down the process Id of each of these processes put the values in place of X, y and Z in the echo statement and execute
2) I have shown how to do that. In your case the process Ids might differ.

7. Put the previously suspended command into the background with command bg.
Command:
bash-4.4$ bg
[1]+ ( date; sleep 45; echo “Done.”; date ) > date.out &
bash-4.4$

Explanation:
1) Run bg which pulls the previous suspended process using ctrl-z into background
2) You will see similar output like shown above.

8. Run command jobs
Command:
bash-4.4$ jobs
[1]+ Running ( date; sleep 45; echo “Done.”; date ) > date.out &   
bash-4.4$  

Explanation:
1) jobs command will shown currently running jobs
2) The output would be similar to what i have shown above.  

9. Bring the command in step 1 back into the foreground with command fg, wait until it finishes.
Command:
bash-4.4$ fg
( date; sleep 45; echo “Done.”; date ) > date.out   

Explnation:
1) fg command will put process in foreground
2) The output will look similar to what i have shown above.

10. Kill the sleep 60 process with the kill command
Command:
bash-4.4$ kill 37

Explanation:
1) kill command will kill a particular process
2) kill 37 will kill process id 37
3) The process Id might not be same as what i have used here. You should use process Id which you have noted above for sleep 60 process.

11. Kill the sleep 100 process with the kill command
Command:
bash-4.4$ kill 39

Explnation:
1) kill command will kill a particular process
2) kill 39 will kill process id 39
3) The process Id might not be same as what i have used here. You should use process Id which you have noted above for sleep 100 process.

12. Run command jobs
Command:
bash-4.4$ jobs

Explanation:
1) jobs command will show currently running jobs
2) Exeucte the jobs command like above to see if there are any running jobs

13. Using ps –ef and grep to list all processes started by you and verify that there is no sleep process remain
Command:
bash-4.4$ ps -ef|grep vishal

Explanation:
1) ps -ef will list all process in your system
2) To get process started by you, use command grep. In my case the user name is vishal which differs in your case. So get your username and grep like what i have done.

14. Display the content of file date.out using the cat command
Command:
bash-4.4$ cat date.out
Sun Feb 11 02:05:30 UTC 2018
“Done.”   
Sun Feb 11 02:06:15 UTC 2018
bash-4.4$   

Explanation:
1) cat command will list contents of a file
2) cat date.out will list the timestamps written to file date.out

Add a comment
Know the answer?
Add Answer to:
What are the exact commands I should use to complete the task? 1. Run command (date;...
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
  • What are the exact commands I should use to complete the task. 1. Using the ps...

    What are the exact commands I should use to complete the task. 1. Using the ps –ef and grep command list all processes started by you (i.e. owned by your userid). (Hint: ‘^userid’ with match with a line that start with userid.) 2. Run command group (echo “Snoozing…”; date; sleep 50; echo “Awake.”;date ) > sleep.out & Note: Do not omit the parenthesis!!! 3. Repeat 1, identify process number of the process sleep 4. Display the content of file sleep.out...

  • On your Fedora Linux virtual machine, switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and...

    On your Fedora Linux virtual machine, switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the terminal using the user name of root and the password of LNXrocks!. At the command prompt, type sleep 6000 and press Enter to start the sleep com- mand, which waits 6000 seconds in the foreground. Do you get your prompt back after you enter this command? Why? Send the process an INT signal by typing theCtrl+c key combination. At the...

  • Summary should briefly analyze the central problems and issues of the case and provide some analysis...

    Summary should briefly analyze the central problems and issues of the case and provide some analysis and suggestions. Thank you. Lean Initiatives and Growth at Orlando Metering Company It was late August 2002 and Ed Cucinelli, vice president of Orlando Metering Company (OMC), sat in his office on a late Saturday morning. He had come in to prepare for some strategic planning meetings that were scheduled for the upcoming week. As he noticed the uncommon silence in the building, Ed...

  • 1. Analyze the major challanges USB faced in the last 5 years, in your opinion, what...

    1. Analyze the major challanges USB faced in the last 5 years, in your opinion, what were the crucial factors in the banks downturn? 2. what are the main triggers to change the banks approach to communication and what is different today regarding the dealings and relationship to its share-and stakeholders? 3. How would you evaluate the constant replacement of the banks chairman and CEO? 4. in view of the future strategy of USB, what are your suggestions in order...

  • 1. Analyze the major challanges USB faced in the last 5 years, in your opinion, what were the cru...

    1. Analyze the major challanges USB faced in the last 5 years, in your opinion, what were the crucial factors in the banks downturn? 2. what are the main triggers to change the banks approach to communication and what is different today regarding the dealings and relationship to its share-and stakeholders? 3. How would you evaluate the constant replacement of the banks chairman and CEO? 4. in view of the future strategy of USB, what are your suggestions in order...

  • Additional code needed: PartA: BurgerOrder class (1 point) Objective: Create a new class that represents an...

    Additional code needed: PartA: BurgerOrder class (1 point) Objective: Create a new class that represents an order at a fast-food burger joint. This class will be used in Part B, when we work with a list of orders. As vou work through this part and Part B, draw a UML diagram of each class in using the UML drawing tool 1) Create a new Lab5TestProject project in Netbeans, right-click on the lab5testproject package and select New>Java Class 2) Call your...

  • 4. Perform a SWOT analysis for Fitbit. Based on your assessment of these, what are some strategic options for Fitbit go...

    4. Perform a SWOT analysis for Fitbit. Based on your assessment of these, what are some strategic options for Fitbit going forward? 5. Analyze the company’s financial performance. Do trends suggest that Fitbit’s strategy is working? 6.What recommendations would you make to Fitbit management to address the most important strategic issues facing the company? Fitbit, Inc., in 2017: Can Revive Its Strategy and It Reverse Mounting Losses? connect ROCHELLE R. BRUNSON Baylor University MARLENE M. REED Baylor University in the...

  • 1. Which of the following are the sites within the human body where carbon dioxide and...

    1. Which of the following are the sites within the human body where carbon dioxide and oxygen are exchanged? A. Alveoli B. Arteries C. Synapses D. Venules 2. Which of the following describes the most important reason for repeating an experimental investigation? A. To verify the validity of the original findings B. To expand upon the original investigation C. To manipulate the independent variable D. To attempt to disprove the hypothesis 3. Lithium has an atomic number of 3 and...

  • 10. Write a one-page summary of the attached paper? INTRODUCTION Many problems can develop in activated...

    10. Write a one-page summary of the attached paper? INTRODUCTION Many problems can develop in activated sludge operation that adversely affect effluent quality with origins in the engineering, hydraulic and microbiological components of the process. The real "heart" of the activated sludge system is the development and maintenance of a mixed microbial culture (activated sludge) that treats wastewater and which can be managed. One definition of a wastewater treatment plant operator is a "bug farmer", one who controls the aeration...

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