A Singer letter can tell a lot
- 0
- Add a Comment
- No Related Post
A Single Letter Can Tell A Lot
At one time or another since the beginning of Penguin Shell, we’ve talked about three useful or, at least, interesting commands: who, uptime and ps. While these are all primarily administrator commands, they’re useful to know and interesting to play with. who returns a list of all users currently logged into the system, what time they logged in and where they came from. uptime lists the current system time, the amount of time the system has been running since the last reboot, how many users are logged in, how long they’ve been logged in, and system resource usage over the past 1, 5 and 15 minutes. Of the three, ps is probably the most globally useful, listing active processes. That’s nine different pieces of data between the three commands, without additional options. Quite a lot.
However, there’s a single letter command that, in effect, summarizes the data of these three commands. w prints a summary of system usage, a list of current users and the actions those users are taking. w also utilizes four interesting options to further slice and dice the data it returns.
| Option | Action |
| -f | toggles printing the remote hostname (from) field |
| -h | suppress headings and uptime information |
| -s | use a short format |
| -u | ignore user names while calculating current processes and CPU times |
See - it’s all about elegance and efficiency. It doesn’t get much more efficient than a single letter command. Heck, sometimes I can’t even think that efficiently.
