Search notes:

Shell command: getent

getent finds entries in name service switch libraries.

Find a user or group entry

Find a user in the password file /etc/passwd.
$ getent passwd rene
rene:x:1000:1000:,,,:/home/rene:/bin/bash
The previous command returned the entire line of the /etc/passwd database.
In order to get a specific field, for example the home directory which is the sixth, the output of getent can be piped into cut:
$ getent passwd rene | cut -d: -f6
/home/rene
Similary, an entry in /etc/group can be found like so
getent group sudo
Apparently, this also works with pam/nss and user/groups that are not in the standard /etc/passwd and /etc/group files.

See also

Shell commands

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Linux/sh...', 1740458746, '3.129.250.65', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Linux/shell/commands/getent(59): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78