fbpx getent Command in Linux: Query Users, Groups, and DNS | Certificação Linux

getent Command in Linux: Query Users, Groups, and System Databases

📅 01/01/2019 ⏱ 2 min ✍️ Uira Ribeiro
Linuxcommands
getent Command in Linux: Query Users, Groups, and System Databases
Exam Pass App — mais de 7.000 questões LPI, offline, em 5 idiomas, disponível no Android e na App Store
Available on
Google Play
Available on
App Store

The getent command in Linux is used to access the user account, password, and group databases.

Only the databases configured in the /etc/nsswitch.conf file can be accessed with this command.

The command syntax is:

$ getent base_de_dados chave

The database can have the following values:

  • passwd: refers to the /etc/passwd file;
  • shadow: refers to the /etc/shadow file;
  • group: refers to the /etc/group file;

The key is the item in the database you want information about.

See the example, it shows the zabbix user account data:

$ getent passwd zabbixzabbix:x:500:501::/home/zabbix:/bin/bash

Only root can access the shadow database:

# getent shadow zabbixzabbix:$6$..5pDu8/$SBoEjzWpYE3hRNhoPI8pJW5rPpM2eEqc3OyWgAqFAJWJsaOyxqMGs9BylcNiTKk.su.OQCuSEWRUEPoAuZFq0.:16537:0:99999:7::16509:

The getent command is useful for getting the data of a specific user account or group, without having to list the contents of the passwd, shadow or group files and filter the results with grep.

If you are an IT professional, support technician, or developer, have you ever thought about learning Linux for real?

And also getting an LPI Linux Essentials certification as a bonus?

And even better, with the best Online Linux course?

[RICH_REVIEWS_SHOW category="CURSO" num="all"]

Do it like these people and create your account now.

Here you have everything you need to succeed in LPI and CompTIA exams

Want to know if a certification is worth it? Find out why the salaries are good, and why companies are looking for Linux professionals. 

You will understand that the benefits far outweigh the sacrifice.

And if you have already decided, see our Certification Guide.

And if you want to know where to take the exams, check the city list.

If you want to know the exam language, see this post.

Learn much more about Linux in our online course. You can enroll here. If you already have an account, you can access here.

Did you like it? Share

Uira Ribeiro

Prof. Uirá Ribeiro

Chair do Board do Linux Professional Institute

After years of watching professionals waste hours on simple tasks because they didn't know the right Linux tools, I decided to teach.
Today I'm the author of most of LPI's official Learning Materials and mentor to over 14,000 certified students.

See my full story →

That was just one piece. The course teaches the whole path — from your first command to exam day.

Certificação Linux — a plataforma líder em certificações Linux no Brasil
WhatsApp