A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
- -bash: getent: command not found
- #Debian
- apt-get install libc-bin
- #Ubuntu
- apt-get install libc-bin
- #Arch Linux
- pacman -S glibc
- #Kali Linux
- apt-get install libc-bin
- #CentOS
- yum install glibc-common
- #Fedora
- dnf install glibc-common
- #Raspbian
- apt-get install libc-bin
getent 从数据库命令显示的条目由 Name
服务切换库,其被配置成在支持 /etc/nsswitch.conf
中。如果提供一个或多个键自变量,则仅显示与提供的键匹配的条目。否则,如果未提供键,则将显示所有条目(除非数据库不支持枚举)。
- getent database [key ...]
- Get entries from administrative database.
- -s, --service=CONFIG 要使用的服务配置
- -?, --help 给出该系统求助列表
- --usage 给出简要的用法信息
- -V, --version 打印程序版本号
- ahosts ahostsv4 ahostsv6 aliases ethers group gshadow hosts netgroup
- networks passwd protocols rpc services shadow
getent 获取所有组的列表:
- getent group
- root:x:0:
- bin:x:1:
- daemon:x:2:
- sys:x:3:
- adm:x:4:
- tty:x:5:
- disk:x:6:
- lp:x:7:
- mem:x:8:
- kmem:x:9:
- wheel:x:10:
- cdrom:x:11:
- mail:x:12:postfix
- man:x:15:
- dialout:x:18:
- floppy:x:19:
- games:x:20:
- tape:x:30:
- video:x:39:
- ftp:x:50:
- lock:x:54:
- audio:x:63:
- nobody:x:99:
- users:x:100:
- utmp:x:22:
- utempter:x:35:
- ssh_keys:x:999:
- input:x:998:
- systemd-journal:x:190:
- systemd-network:x:192:
- dbus:x:81:
- polkitd:x:997:
- postdrop:x:90:
- postfix:x:89:
- chrony:x:996:
- sshd:x:74:
- ntp:x:38:
- tcpdump:x:72:
- nscd:x:28:
- screen:x:84:
- mysql:x:1001:
- apache:x:48:
- slocate:x:21:
- tss:x:59:
- rvm:x:1003:
- www:x:1002:
- jumpserver:x:1004:
- wentao:x:1005:
- luojunxue:x:1006:
- clamupdate:x:995:
- virusgroup:x:994:clamupdate,clamilt,clamscan
- clamilt:x:993:
- clamscan:x:992:
- prodev01:x:1007:
getent 查看群组成员:
- getent group group_name
getent 获取所有服务的列表:
- getent services
- #比如:
- $ getent services 80
- http 80/tcp www www-http
getent 根据当前登录信息查找 UID
:
- $ getent passwd `whoami`
- www:x:1002:1002::/home/www:/bin/bash
getent 通过 UID
查找用户名:
- getent passwd 1000
getent 执行反向 DNS
查找:
- getent hosts host
- #比如:
- $ getent hosts www.hexun.com
- 119.97.159.10 wsctcwhngtxdl01.fastcdn.hexun.com www.hexun.com www.fastcdn.hexun.com
- $ getent hosts command-not-found
- 192.168.1.23 command-not-found