User commands and logs

groups

As you might guess from the name, the groups command extracts selected information from the /etc/group file and displays it (Figure 9). With no options, groups lists information for the current user, but a valid username can be used as an option instead.

Figure 9: groups is a view for the /etc/groups file.

finger

For some reason, the finger command is not installed by default on the desktops of many distributions. However, if you are administering a multiuser system, it is well worth installing.

Without the use of any options, or with the -s option (Figure 10), finger followed by an account name lists the login name, the name, the interface, how long the user has been idle, when they logged in, their office, and their office phone number. If, like many home users, you leave the name, office, and office number blank when you create users, these columns will, of course, be empty.

Figure 10: The finger command provides basic information about user accounts.

Using the -l option, you get the same information reformatted, plus the user's home directory and login shell, as well as the last time they received internal mail. For administration work, this option is probably the most useful.

w

One of the most useful commands for gathering information about users, w, is also one of the simplest. It shows what processes a user is running at the time the command is run.

Entering the w command plus a username (or omitting a username and defaulting to the current account) produces a table of information for the user (Figure 11). From left to right, the information is the user account, its terminal, its remote host (0 if none exists), the login time, the length of idle time, the JCPU or time used by all processes attached to the terminal, the PCPU or time used by the current process, and the name of the current process.

Figure 11: What is a user running and where? Use w to get the answers.

If you choose, you can run a shorter summary by using the -l option. The information displayed using the -l option omits the login time, the JCPU, and PCPU.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Introducing Bash

    Beyond all the splash screens, screen savers, and vivid rock-star wallpaper is the simple yet powerful Bash shell.

  • Command Line: More Secure Passwords

    Even with encrypted drives, account passwords remain one of the prime security methods for any Linux system. With a little knowledge of the available commands and their options, you can make your account passwords more secure.

  • Bash Tricks

    The Bash shell is powerful and infinitely expressive. In this article we describe some tricky techniques you can use to enhance and customize your Bash environment.

  • Command Line – Killing Processes

    Linux offers a variety of tools for shutting down systems and processes. We describe some important commands.

  • Command Line: User Accounts

    Linux is a multiuser system: many users can work at the same machine at the same time on separate accounts. In this month’s column, we take a close look at how to create and manage Linux user accounts from the command line.

comments powered by Disqus