{
    "content": [
        {
            "type": "text",
            "text": "# lastlog (man)\n\n## NAME\n\nlastlog - reports the most recent login of all users or of a given user\n\n## SYNOPSIS\n\nlastlog [options]\n\n## DESCRIPTION\n\nlastlog formats and prints the contents of the last login log /var/log/lastlog file. The\nlogin-name, port, and last login time will be printed. The default (no flags) causes lastlog\nentries to be printed, sorted by their order in /etc/passwd.\n\n## TLDR\n\n> Show the most recent login of all users or of a user.\n\n- Display the most recent login of all users:\n  `lastlog`\n- Display the lastlog record of the specified user:\n  `lastlog --user {{username}}`\n- Display records older than 7 days:\n  `lastlog --before 7`\n- Display records more recent than 3 days:\n  `lastlog --time 3`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (7 subsections)\n- **NOTE**\n- **CONFIGURATION** (1 subsections)\n- **FILES**\n- **CAVEATS**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "lastlog",
        "section": "",
        "mode": "man",
        "summary": "lastlog - reports the most recent login of all users or of a given user",
        "synopsis": "lastlog [options]",
        "tldr_summary": "Show the most recent login of all users or of a user.",
        "tldr_examples": [
            {
                "description": "Display the most recent login of all users",
                "command": "lastlog"
            },
            {
                "description": "Display the lastlog record of the specified user",
                "command": "lastlog --user {{username}}"
            },
            {
                "description": "Display records older than 7 days",
                "command": "lastlog --before 7"
            },
            {
                "description": "Display records more recent than 3 days",
                "command": "lastlog --time 3"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-b",
                "long": "--before",
                "arg": null,
                "description": "Print only lastlog records older than DAYS."
            },
            {
                "flag": "-C",
                "long": "--clear",
                "arg": null,
                "description": "Clear lastlog record of a user. This option can be used only together with -u (--user))."
            },
            {
                "flag": "-h",
                "long": "--help",
                "arg": null,
                "description": "Display help message and exit."
            },
            {
                "flag": "-R",
                "long": "--root",
                "arg": null,
                "description": "Apply changes in the CHROOTDIR directory and use the configuration files from the CHROOTDIR directory."
            },
            {
                "flag": "-S",
                "long": "--set",
                "arg": null,
                "description": "Set lastlog record of a user to the current time. This option can be used only together with -u (--user))."
            },
            {
                "flag": "-t",
                "long": "--time",
                "arg": null,
                "description": "Print the lastlog records more recent than DAYS."
            },
            {
                "flag": "-u",
                "long": "--user",
                "arg": null,
                "description": "Print the lastlog record of the specified user(s). The users can be specified by a login name, a numerical user ID, or a RANGE of users. This RANGE of users can be specified with a min and max values (UIDMIN-UIDMAX), a max value (-UIDMAX), or a min value (UIDMIN-). If the user has never logged in the message Never logged in will be displayed instead of the port and time. Only the entries for the current users of the system will be displayed. Other entries may exist for users that were deleted previously."
            }
        ],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 2,
                "subsections": [
                    {
                        "name": "-b --before",
                        "lines": 2,
                        "flag": "-b",
                        "long": "--before"
                    },
                    {
                        "name": "-C --clear",
                        "lines": 2,
                        "flag": "-C",
                        "long": "--clear"
                    },
                    {
                        "name": "-h --help",
                        "lines": 2,
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-R --root",
                        "lines": 3,
                        "flag": "-R",
                        "long": "--root"
                    },
                    {
                        "name": "-S --set",
                        "lines": 3,
                        "flag": "-S",
                        "long": "--set"
                    },
                    {
                        "name": "-t --time",
                        "lines": 2,
                        "flag": "-t",
                        "long": "--time"
                    },
                    {
                        "name": "-u --user",
                        "lines": 12,
                        "flag": "-u",
                        "long": "--user"
                    }
                ]
            },
            {
                "name": "NOTE",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "CONFIGURATION",
                "lines": 2,
                "subsections": [
                    {
                        "name": "LASTLOG___UID___MAX (number)",
                        "lines": 7
                    }
                ]
            },
            {
                "name": "FILES",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "CAVEATS",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "lastlog - reports the most recent login of all users or of a given user\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "lastlog [options]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "lastlog formats and prints the contents of the last login log /var/log/lastlog file. The\nlogin-name, port, and last login time will be printed. The default (no flags) causes lastlog\nentries to be printed, sorted by their order in /etc/passwd.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "The options which apply to the lastlog command are:\n",
                "subsections": [
                    {
                        "name": "-b --before",
                        "content": "Print only lastlog records older than DAYS.\n",
                        "flag": "-b",
                        "long": "--before"
                    },
                    {
                        "name": "-C --clear",
                        "content": "Clear lastlog record of a user. This option can be used only together with -u (--user)).\n",
                        "flag": "-C",
                        "long": "--clear"
                    },
                    {
                        "name": "-h --help",
                        "content": "Display help message and exit.\n",
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "-R --root",
                        "content": "Apply changes in the CHROOTDIR directory and use the configuration files from the\nCHROOTDIR directory.\n",
                        "flag": "-R",
                        "long": "--root"
                    },
                    {
                        "name": "-S --set",
                        "content": "Set lastlog record of a user to the current time. This option can be used only together\nwith -u (--user)).\n",
                        "flag": "-S",
                        "long": "--set"
                    },
                    {
                        "name": "-t --time",
                        "content": "Print the lastlog records more recent than DAYS.\n",
                        "flag": "-t",
                        "long": "--time"
                    },
                    {
                        "name": "-u --user",
                        "content": "Print the lastlog record of the specified user(s).\n\nThe users can be specified by a login name, a numerical user ID, or a RANGE of users.\nThis RANGE of users can be specified with a min and max values (UIDMIN-UIDMAX), a max\nvalue (-UIDMAX), or a min value (UIDMIN-).\n\nIf the user has never logged in the message  Never logged in will be displayed instead of\nthe port and time.\n\nOnly the entries for the current users of the system will be displayed. Other entries may\nexist for users that were deleted previously.\n",
                        "flag": "-u",
                        "long": "--user"
                    }
                ]
            },
            "NOTE": {
                "content": "The lastlog file is a database which contains info on the last login of each user. You should\nnot rotate it. It is a sparse file, so its size on the disk is usually much smaller than the\none shown by \"ls -l\" (which can indicate a really big file if you have in passwd users with a\nhigh UID). You can display its real size with \"ls -s\".\n",
                "subsections": []
            },
            "CONFIGURATION": {
                "content": "The following configuration variables in /etc/login.defs change the behavior of this tool:\n",
                "subsections": [
                    {
                        "name": "LASTLOG___UID___MAX (number)",
                        "content": "Highest user ID number for which the lastlog entries should be updated. As higher user\nIDs are usually tracked by remote user identity and authentication services there is no\nneed to create a huge sparse lastlog file for them.\n\nNo LASTLOGUIDMAX option present in the configuration means that there is no user ID\nlimit for writing lastlog entries.\n"
                    }
                ]
            },
            "FILES": {
                "content": "/var/log/lastlog\nDatabase times of previous user logins.\n",
                "subsections": []
            },
            "CAVEATS": {
                "content": "Large gaps in UID numbers will cause the lastlog program to run longer with no output to the\nscreen (i.e. if in lastlog database there is no entries for users with UID between 170 and\n800 lastlog will appear to hang as it processes entries with UIDs 171-799).\n\n\n\nshadow-utils 4.8.1                           02/06/2024                                   LASTLOG(8)",
                "subsections": []
            }
        }
    }
}