Logging and Monitoring Commands in Linux (original) (raw)

Last Updated : 7 Jan, 2026

Logging and monitoring commands in Linux are used to track system activity, view logs, monitor performance, and record user actions. These commands help system administrators analyze system behavior, troubleshoot issues, audit user activity, and maintain overall system health.

Logging and monitoring commands are mainly used to:

Below are the commonly used Logging and Monitoring Commands in Linux

1. journalctl

The journalctl command is used to view logs collected by the systemd journal.

**Syntax:

journalctl

**Example:

journalctl -xe

journalctl

2. last

The last command displays the login and logout history of users.

**Syntax:

last

**Example:

last

Lightbox

3. history

The history command shows previously executed commands by the user.

**Syntax:

history

**Example:

history

history

4. sar

The sar command collects and reports system performance statistics.

**Syntax:

sar

**Example:

sar -u

sar

5. script

The script command records all terminal activity in a file.

**Syntax:

script filename

**Example:

script session.log

script

6. scriptreplay

The scriptreplay command replays a terminal session recorded using the script command.

**Syntax:

scriptreplay timing_file script_file

**Example:

scriptreplay timing.log session.log

scriptreplay