Question

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

5. Kill the sleep process

6. Repeat 1. and verify that the process sleep no longer exist

7. Display the content of file sleep.out

8. Remove file sleep.out

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

Command Sequence:

Note:: $ is used before every command to indicate that following text is command.

So, $ is not part of command.

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

Answer:

$ ps -ef | grep "^userid"

Note: "ps" lists the processes that running at present.

-e option makes ps command list all the processes.

-f option makes ps command list the processing in full format

"grep" command returns lines which match the given pattern.

2. Run command group

(echo “Snoozing…”; date; sleep 50; echo “Awake.”;date ) > sleep.out &

Note: Do not omit the parenthesis!!!

Answer:

$ (echo “Snoozing…”; date; sleep 50; echo “Awake.”;date ) > sleep.out &

Note:

'echo' command- print statements to standard output

'sleep 50' command - starts the sleep process which is of duration 50 seconds

'date' command - returns the current date

'> sleep.out' This shell operator is used to redirect the output. Here output

will be redirected to sleep.out

'&' makes the command group run in the background.

3. Repeat 1, identify process number of the process sleep

Answer:

$ ps -ef | grep "^userid"

4. Display the content of file sleep.out

Answer:

$ cat sleep.out

Note: cat command displays the contents of a file.

5. Kill the sleep process

Answer:

$ kill sleep_process_id

Note: Here sleep_process_id is from Step 3.

The sleep_process_id is at the first column value and seventh

column value must be "sleep" i.e process name.

Note:

kill command terminates the process with given id.

6. Repeat 1. and verify that the process sleep no longer exist

Answer:

$ ps -ef | grep "^userid"

7. Display the content of file sleep.out

Answer:

$ cat sleep.out

Note: "cat" command is used to display the file contents.

8. Remove file sleep.out

Answer:

$ rm sleep.out

Note: "rm" command is used to remove the files.

Example-Screenshot:

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

  • LINUX QUESTIONS (dont have to display output, I will be running these commands myself to check...

    LINUX QUESTIONS (dont have to display output, I will be running these commands myself to check the output) Display the command(s) used to do the following: create an empty file called history by using just a redirection operator. Verify and show. Show/verify all results (i.e., all commands and their corresponding outputs). Wait 1 minute or more and then display the command(s) used to do the following: change the timestamp on the history file you just created. Verify/display the change. Show/verify...

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

  • Login to Suse Linux as root. Complete the task working as the root user. 1. What...

    Login to Suse Linux as root. Complete the task working as the root user. 1. What is your current directory. What did you enter at the command prompt to determine your current working directory? 2. Change directories if needed to find your foods (or food) file. Use vi to make the file contain 10 food items. Save your file and quit. Use the cat command, and option, and the argument food to display the food file with numbered lines. Use...

  • Question III This question carries 20% of the marks for this assignment. Given the following mix...

    Question III This question carries 20% of the marks for this assignment. Given the following mix of tasks, task lengths and arrival times, compute the completion [5 marks and response time time from the arrival to the finish time) (5 marks for each task, along with the average response time for the FIFO. RR and SJF algorithms. Assume a time slice of 10 milliseconds and that all times are in milliseconds. You are kindly asked to provide the Gantt Chart...

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