LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

lastcomm

displays information about previously executed commands from process

TLDR

Show recent commands
$ lastcomm
copy
Show commands by user
$ lastcomm [username]
copy
Show specific command
$ lastcomm --command [vim]
copy
Show from specific file
$ lastcomm -f [/var/account/pacct]
copy
Show commands by terminal
$ lastcomm --tty [pts/0]
copy

SYNOPSIS

lastcomm [options] [user] [command] [terminal]

DESCRIPTION

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.

PARAMETERS

--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.

OUTPUT FLAGS

$ S - Superuser (root) executed
F - Forked but didn't exec
D - Dumped core
X - Killed by signal
copy

ENABLING ACCOUNTING

$ # Enable accounting
sudo accton /var/account/pacct

# Disable accounting
sudo accton off
copy

INSTALL

sudo apt install acct
copy
sudo apk add acct
copy
sudo zypper install acct
copy
nix profile install nixpkgs#acct
copy

CAVEATS

Requires process accounting enabled. Accounting adds system overhead. File grows continuously (rotate with sa). Not available on all systems.

HISTORY

lastcomm is part of the Unix process accounting system, dating back to early Unix. It provides historical tracking of executed commands, useful for auditing and troubleshooting.

SEE ALSO

sa(8), accton(8), last(1), ac(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid