Linux command
lastcomm 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Show recent commands
lastcomm
Show commands by user
lastcomm [username]
Show specific command
lastcomm --command [vim]
Show from specific file
lastcomm -f [/var/account/pacct]
Show commands by terminal
lastcomm --tty [pts/0]
说明
lastcomm displays information about previously executed commands from process accounting data. It shows command name, flags, user, terminal, and execution time. Process accounting must be enabled for lastcomm to have data. The accounting file is typically /var/account/pacct.
参数
- --command _name_
- Filter by command name.
- --user _name_
- Filter by user.
- --tty _name_
- Filter by terminal.
- -f _file_
- Use specific accounting file.
- --forwards
- Show oldest first.
- --strict-match
- Exact match only.
- --debug
- Debug output.
FAQ
What is the lastcomm command used for?
lastcomm displays information about previously executed commands from process accounting data. It shows command name, flags, user, terminal, and execution time. Process accounting must be enabled for lastcomm to have data. The accounting file is typically /var/account/pacct.
How do I run a basic lastcomm example?
Run `lastcomm` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --command _name_ do in lastcomm?
Filter by command name.