Analysis of accton and lastcomm commands in linux, acctonlastcomm
We use the accton command to enable or disable process statistics. If no parameters are included, the process statistics will be disabled. Its main parameters are as follows:
(1)-V or -- version indicates that the version information is displayed and exited.
(2)-h or -- help to print help information.
In linux, to start process statistics, you must use the accton command and run it as root. The accton command is in the form of accton file, and the file must exist in advance. We can use the touch command to create the file. Once accton is activated, you can use the lastcomm command to detect the commands executed at any time in the system. To disable statistics, use the accton command without any parameters.
Lastcomm displays information about previously used commands. Accton is used to START process records. In this way, all commands are recorded in a specified file, and lastcomm is used to view the file for system management. The main options are as follows:
(1)-strict-match indicates exact match to each column.
(2) -- user name Only displays Command records of the specified user.
(3) -- command name only displays records of the specified command.
(4) -- tty name only displays commands run on the specified terminal.
(5)-f filename specifies a Command record file to replace the default file.
(6) -- debug prints other kernel information.
(7) -- version prints the version information.
(8) -- help prints help information.