国际访客建议访问 Primers 编程伙伴 国际版站点 > Bash 教程 > pinky 以获得更好的体验。

# Bash 的 pinky 命令

pinky [OPTION]... [USER]...

!subtitle:功能

打印用户信息。

这个命令是 finger 命令的简单实现。

!subtitle:类型

可执行文件(/usr/bin/pinky),属于 coreutils

!subtitle:参数

  • OPTION 选项:

    • -l - 为指定的用户生成长格式的输出

    • -b - 长格式中省略的用户主目录和 shell

    • -h - 长格式中省略 ~/.project 文件

    • -p - 长格式中省略 ~/.plan 文件

    • -s - 使用短格式输出;默认

    • -f - 短格式中省略列标题行

    • -w - 短格式中省略用户名

    • -i - 短格式中省略用户名和远程地址

    • -q - 短格式中省略用户名,远程地址和空闲时间

    • --help - 显示帮助

    • --version - 显示版本

  • USER - 用户名列表;默认为当前用户

# 示例

$ pinky                 # 默认使用短格式
Login       Name                TTY      Idle   When             Where
primers     primers             pts/0    2d     2025-11-19 13:31 192.168.1.100
primers     primers             pts/3           2025-11-19 13:35 192.168.1.100
$ pinky -q              # 省略用户名 远程地址 空闲时间
Login       TTY      When
primers     pts/0    2025-11-19 13:31
primers     pts/3    2025-11-19 13:35
$ pinky -l planc        # 使用长格式,必须指定用户名
Login name: primers                       In real life:  primers
Directory: /home/primers                  Shell:  /bin/bash

# 推荐阅读

# 手册

PINKY(1)                         User Commands                        PINKY(1)

NAME
       pinky - lightweight finger

SYNOPSIS
       pinky [OPTION]... [USER]...

DESCRIPTION
       -l     produce long format output for the specified USERs

       -b     omit the user's home directory and shell in long format

       -h     omit the user's project file in long format

       -p     omit the user's plan file in long format

       -s     do short format output, this is the default

       -f     omit the line of column headings in short format

       -w     omit the user's full name in short format

       -i     omit the user's full name and remote host in short format

       -q     omit  the  user's  full name, remote host and idle time in short
              format

       --help display this help and exit

       --version
              output version information and exit

       A lightweight 'finger' program;  print user information.  The utmp file
       will be /var/run/utmp.

AUTHOR
       Written by Joseph Arceneaux, David MacKenzie, and Kaveh Ghazi.

REPORTING BUGS
       GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
       Report any translation bugs to <https://translationproject.org/team/>

COPYRIGHT
       Copyright © 2023 Free Software Foundation, Inc.   License  GPLv3+:  GNU
       GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
       This  is  free  software:  you  are free to change and redistribute it.
       There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
       Full documentation <https://www.gnu.org/software/coreutils/pinky>
       or available locally via: info '(coreutils) pinky invocation'

GNU coreutils 9.4                 April 2024                          PINKY(1)
本文 更新于: 2025-11-27 09:38:15 创建于: 2025-11-27 09:38:15