Linux finger command

Linux Command Encyclopedia

fingerThe command is used to view detailed information about users on local or remote systems, including login name, full name, login time, idle time, etc.

Compared to thewhoandidcommand provides a richer display of user information and is suitable for understanding the status of other users on a multi-user shared server.

fingerIt was a commonly used user information query tool in early Unix systems; its name originates from the meaning of "pointing at" someone.

It can read from/etc/passwdread the user's personal description information from the GECOS field, and display their login status.

Although for security reasons, modern Linux distributions no longer install it by defaultfinger, but it still has practical value in intranet environments and teaching scenarios.

fingerThe system needs to runfingerdservice to query remote user information. For security reasons, most public servers have disabled this service.

Command syntax

fingerThe basic syntax is as follows:

finger [选项] [用户@主机]

If no parameters are specified, a summary of all currently logged-in users is listed.

If a username is specified, the detailed information for that user is displayed.

Specifyuser@hostthe format to query user information on remote hosts.

fingerThe common options are organized as follows:

OptionFunctionExample
-sDisplay user information in short formatfinger -s
-lDisplay user information in detailed long formatfinger -l example
-pDo not display the contents of .plan and .project filesfinger -p example
-mDisable matching lookup on usernamesfinger -m example

Detailed usage

View currently logged-in users

Run without parametersfinger, and it will list summary information for all logged-in users in the system.

# 查看所有当前登录的用户
$ finger
Login     Name           Tty      Idle  Login Time   Office     Office Phone
root      root           tty1           May 19 09:00
example    Zhang San      pts/0      3  May 19 10:30  A-301      010-12345678

The output includes login name, full name, terminal, idle time, login time, office, phone, and other information.

View detailed information of a specified user

Specifying a username allows viewing the complete information of that user.

# 查看 example 用户的详细信息
$ finger example
Login: example                    Name: Zhang San
Directory: /home/example          Shell: /bin/bash
Office: A-301, 010-12345678      Home Phone: 010-87654321
Last login Tue May 19 10:30 (CST) on pts/0
Mail last read Tue May 19 09:00 2026 (CST)
No Plan.

Detailed information includes the user's home directory, default shell, last login time, mail reading time, etc.

"No Plan." indicates that the user's home directory has no.planfile. Once the file is created, its contents will be displayed here, and it can be used to show a personal profile or current status.

Short format output

Using-sthe option can output only key fields, suitable for quick viewing.

# 以简短格式查看用户信息
$ finger -s example
Login     Name           Tty      Idle  Login Time   Office     Office Phone
example    Zhang San      pts/0      3  May 19 10:30  A-301      010-12345678

The short format omits details such as home directory, shell, last login time, etc., and outputs a one-line table.

Disable fuzzy matching

By default,fingerit will attempt to match all usernames, full names, and other information containing the specified string.-mThis behavior can be disabled to only exactly match usernames.

# 精确匹配用户名,不搜索全名和其他字段
$ finger -m example

When the system has full names or aliases similar to the target username,-mit can avoid returning unexpected results.

View multiple users

You can specify multiple usernames at once to view information for multiple users in a single operation.

# 同时查看多个用户
$ finger example root
Login: example                    Name: Zhang San
Directory: /home/example          Shell: /bin/bash
Office: A-301, 010-12345678      Home Phone: 010-87654321
Last login Tue May 19 10:30 (CST) on pts/0
No Plan.

Login: root                      Name: root
Directory: /root                 Shell: /bin/bash
Last login Tue May 19 09:00 (CST) on tty1
No Plan.

View remote user information

fingerSupports querying users on remote hosts in the format ofusername@host address。

# 查看远程主机上的用户信息(需要远程主机开启 fingerd 服务)
$ finger example@192.168.1.100
Login: example                    Name: Zhang San
Directory: /home/example          Shell: /bin/bash
Last login Tue May 19 08:00 (CST) on pts/1
No Plan.

Remote query requires the target host to runfingerd(finger daemon) and open port 79 externally. Most cloud servers have disabled this feature for security reasons.

Configure .plan and .project files

Users can create in their home directory.planand.projectfiles to display personalized information.

# 创建 .project 文件(单行项目说明)
$ echo "EXAMPLE Platform Development" > ~/.project

# 创建 .plan 文件(多行计划或简介)
$ cat > ~/.plan << 'EOF'
当前任务:
1. 负责 EXAMPLE 后端 API 开发
2. 维护数据库迁移脚本
3. Code Review 本周三之前完成
EOF

# 再次查看用户信息
$ finger example
Login: example                    Name: Zhang San
Directory: /home/example          Shell: /bin/bash
Office: A-301, 010-12345678      Home Phone: 010-87654321
Last login Tue May 19 10:30 (CST) on pts/0
Project: EXAMPLE Platform Development
Plan:
当前任务:
1. 负责 EXAMPLE 后端 API 开发
2. 维护数据库迁移脚本
3. Code Review 本周三之前完成

.projectThe file content is displayed as a single line,.planThe file content can have multiple lines, suitable for writing a personal profile or current work tasks.

.planThe extra indentation in the file by default is for alignment and layout. If you want to remove the indentation, you can add a blank line before the content.


Differences from the who and w commands

CommandInformation richnessMain purposeTypical scenario
whoBasicOnly lists logged-in users, terminals, and login timesQuickly check who is online
wMediumDisplays logged-in users and currently running programsUnderstand what users are currently doing
fingerDetailedDisplays complete user information (including contact details, plans, etc.)View a detailed profile of a specific user

FAQ

Modern Linux distributions (such as Ubuntu, Debian, CentOS) do not install it by defaultfinger. You need to manually runapt install fingeroryum install fingerto install it.

fingerIts installation and use may pose security risks: it exposes users' personal information and login status. Before using it on enterprise servers, please confirm that the security policy permits it.

fingerThe displayed office, phone, and other information comes from the GECOS field and can be modified using thechfncommand.

Iffingerit does not display any user information, check/etc/passwdwhether the user entry exists and whether the operation permission is sufficient.


Related commands

CommandFunction
whoDisplay currently logged-in users
wDisplay logged-in users and their current activity
idDisplay the user's UID, GID, and group membership
chfnModify the user's finger information (full name, phone, etc.)
usersDisplay currently logged-in users as a concise list
lastDisplay the user's recent login records

Linux Command Encyclopedia

Other extensions