Experiment 7: Process Management of Linux System
1. Use the at command to create an empty file test.txt in your name directory 2 minutes after the current time
Execute first means to execute at now + 2minutes
after two minutes, enter the statement to be executed after pressing Enter, and CTRL+D to exit.
Install without installing at package execution sudo apt-get install at
.
2. Use the batch command to create an empty file test2.txt in the name directory;
Similar to the at command, but batch is executed when the virtual machine is idle. Exit is also CTRL+D.
3. Use the crontab command to create a task in the name directory, and execute touch test3.txt once a day at 8:10;
Crontab command usage:crontab [-u 用户名] [ -e | -l | -r ]
-u specifies the user name to define the task scheduling, without this option, the current user is defaulted;
-e is used to edit the user's cron scheduling file;
-l is used to display the contents of cron scheduling files;
-r is used to delete the user's cron scheduling file.
First crontab -e edit the scheduling file, enter the statement in the figure below, ctrl+x to exit.
4. Display all processes in long format
Option e means displaying all processes; option l means displaying in long format.
5. Start the text editor gedit, check the gedit process ID, and then terminate it with the kill command;
6. Use the top command to view the system status, and output the results of the second update display to the file named top.log.
top -d 2 -n 1 -b > top.log
-d 2 means refresh every 2 seconds
-n 1 means output the result once in the file
-b means the file is readable