Linux Terminal Command: w
The w command is an essential tool in User & Permission Management. In this tutorial, we will explore what w does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.
Concept & Explanation
The w command lists all active logged-in users, the terminal line they are using, their source IP, login time, idle time, and the command they are currently running.
Common Options & Syntax
w [options] [arguments]
Here are the most common flags used with w:
- Simple Usage: Basic default commands.
- Detailed View: Shows diagnostic information.
- Advanced Actions: Can chain parameters for scripting.
1. Interactive Example (Simple)
Here is how most people run the command:
# Example
w
What it does: Displays user session status and system load averages.
2. Power-User Example (Advanced)
For scripting and advanced diagnostics, use this configuration:
# Advanced
w -h -s
What it does: Prints summary details without header lines (-h) in short format (-s) for easier parser script processing.
⚙️ Warning & Common Pitfalls
[!WARNING] The active command column only displays the process linked to the terminal’s tty. Background daemon jobs will not appear in this list.
🔗 Related Commands
Here are some related posts on cli_tty1 you might want to check out:
- jobs : List active shell jobs.