{
    "mode": "man",
    "parameter": "lastcomm",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/lastcomm/1/json",
    "generated": "2026-05-30T06:10:39Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "lastcomm -  print out information about previously executed commands.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "lastcomm",
                    "content": "[ command-name ...  ]\n[ user-name ...  ]\n[ terminal-name ...  ]\n[ OPTION ... ]\n"
                }
            ]
        },
        "DESCRIPTION": {
            "content": "lastcomm  prints  out  information  about  previously executed commands.  If no arguments are\nspecified, lastcomm will print info about all of the commands in acct (the record file).   If\ncalled with one or more of command-name, user-name, or terminal-name, only records containing\nthose items will be displayed.  For example, to find out which users used command `a.out' and\nwhich users were logged into `tty0', type:\nlastcomm a.out tty0\n\nThis  will  print any entry for which `a.out' or `tty0' matches in any of the record's fields\n(command, name, or terminal).  If you want to find only items that match *all* of  the  argu‐\nments on the command line, you must use the '-strict-match' option.  For example, to list all\nof the executions of command a.out by user root on terminal tty0, type:\nlastcomm --strict-match --command a.out --user root --tty tty0\n\nThe order of the arguments is not important.\n\nFor each entry the following information is printed:\n+ command name of the process\n+ flags, as recorded by the system accounting routines:\nS -- command executed by super-user\nF -- command executed after a fork but without a following exec\nC -- command run in PDP-11 compatibility mode (VAX only)\nD -- command terminated with the generation of a core file\nX -- command was terminated with the signal SIGTERM\n+ the name of the user who ran the process\n+ time the process started\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "--strict-match",
                    "content": "Print only entries that match *all* of the arguments on the command line.",
                    "long": "--strict-match"
                },
                {
                    "name": "--print-controls",
                    "content": "Print control characters.\n--user name\nList records for user with name.  This is useful if you're trying to match a  username\nthat happens to be the same as a command (e.g., ed ).\n--command name\nList records for command name.\n--tty name\nList records for tty name.",
                    "long": "--print-controls"
                },
                {
                    "name": "--forwards",
                    "content": "Read  file  forwards  instead of backwards. This avoids trying to seek on the file and\ncan be used to read from a pipe. This must be specified prior to any -f arguments.",
                    "long": "--forwards"
                },
                {
                    "name": "-f --file",
                    "content": "Read from the file filename instead of acct.  A filename of \"-\" will result in reading\nfrom stdin. This must either be the first -f option, or --forwards must precede all -f\noptions.\n--ahz hz\nUse this flag to tell the program what AHZ should be (in hertz).  This option is  use‐\nful  if  you  are trying to view an acct file created on another machine which has the\nsame byte order and file format as your current machine, but has a different value for\nAHZ.",
                    "flag": "-f",
                    "long": "--file"
                },
                {
                    "name": "-p, --show-paging",
                    "content": "Print paging statistics.\n--pid  Show PID and PPID of the process if acct version 3 format is supported by kernel.\n--pid  Add  pid  of  the process and pid of the process parent to the output (pid is the last\nbut one and parent pid the last column).  These values are shown only  when  they  are\ngenerated by acct function (depends on the version of kernel)",
                    "flag": "-p",
                    "long": "--show-paging"
                },
                {
                    "name": "--debug",
                    "content": "Print verbose internal information.",
                    "long": "--debug"
                },
                {
                    "name": "-V, --version",
                    "content": "Print the version number of lastcomm.",
                    "flag": "-V",
                    "long": "--version"
                },
                {
                    "name": "-h, --help",
                    "content": "Prints  the  usage string and default locations of system files to standard output and\nexits.\n",
                    "flag": "-h",
                    "long": "--help"
                }
            ]
        },
        "FILES": {
            "content": "acct\nThe system wide process accounting file. See acct(5) (or  pacct(5))  for  further  de‐\ntails.  /var/log/account\nThis directory contains pacct files which contain the binary process accounting\ndata as written by the kernel.",
            "subsections": []
        },
        "AUTHOR": {
            "content": "The GNU accounting utilities were written by Noel Cragg <noel@gnu.ai.mit.edu>. The  man  page\nwas adapted from the accounting texinfo page by Susan Kleinmann <sgk@sgk.tiac.net>.",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "last(1), acct(5)\n\n\n\n\n1995 October 31                               LASTCOMM(1)",
            "subsections": []
        }
    },
    "summary": "lastcomm -  print out information about previously executed commands.",
    "flags": [
        {
            "flag": "",
            "long": "--strict-match",
            "arg": null,
            "description": "Print only entries that match *all* of the arguments on the command line."
        },
        {
            "flag": "",
            "long": "--print-controls",
            "arg": null,
            "description": "Print control characters. --user name List records for user with name. This is useful if you're trying to match a username that happens to be the same as a command (e.g., ed ). --command name List records for command name. --tty name List records for tty name."
        },
        {
            "flag": "",
            "long": "--forwards",
            "arg": null,
            "description": "Read file forwards instead of backwards. This avoids trying to seek on the file and can be used to read from a pipe. This must be specified prior to any -f arguments."
        },
        {
            "flag": "-f",
            "long": "--file",
            "arg": null,
            "description": "Read from the file filename instead of acct. A filename of \"-\" will result in reading from stdin. This must either be the first -f option, or --forwards must precede all -f options. --ahz hz Use this flag to tell the program what AHZ should be (in hertz). This option is use‐ ful if you are trying to view an acct file created on another machine which has the same byte order and file format as your current machine, but has a different value for AHZ."
        },
        {
            "flag": "-p",
            "long": "--show-paging",
            "arg": null,
            "description": "Print paging statistics. --pid Show PID and PPID of the process if acct version 3 format is supported by kernel. --pid Add pid of the process and pid of the process parent to the output (pid is the last but one and parent pid the last column). These values are shown only when they are generated by acct function (depends on the version of kernel)"
        },
        {
            "flag": "",
            "long": "--debug",
            "arg": null,
            "description": "Print verbose internal information."
        },
        {
            "flag": "-V",
            "long": "--version",
            "arg": null,
            "description": "Print the version number of lastcomm."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Prints the usage string and default locations of system files to standard output and exits."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "last",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/last/1/json"
        },
        {
            "name": "acct",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/acct/5/json"
        }
    ]
}