Linux / Unix: lastcomm Command Examples

Linux / Unix: lastcomm Command Examples

The lastcomm command is used to display information about previously executed commands on a Linux or Unix system. It reads the acct file, which is a record of all command executions on the system.

Here are some examples of how you can use the lastcomm command:

  • To display a list of the most recently executed commands, you can use the lastcomm command with no options:
refer t‮l:o‬autturi.com
lastcomm

This will display a list of the executed commands, along with the date and time of the execution, the user's name, the command name, and the terminal or hostname from which the command was executed.

  • To display a list of commands that were executed by a specific user, you can use the -u option followed by the user's name:
lastcomm -u username

This will display a list of commands that were executed by the specified user.

  • To display a list of commands that were executed on a specific terminal or hostname, you can use the -t option followed by the terminal or hostname:
lastcomm -t terminal_name

This will display a list of commands that were executed on the specified terminal or hostname.

  • To display a list of commands that contain a specific string, you can use the -f option followed by the string:
lastcomm -f string

This will display a list of commands that contain the specified string.

For more information about the lastcomm command and its available options, you can consult the lastcomm man page or use the lastcomm --help command.

Created Time:2017-10-29 22:09:00  Author:lautturi