Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Complete Sensor Guide
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Tech Terms
    • Webinars & Digital Events
  • Resources
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • White Papers
  • Guest Post Guidelines
  • Advertisers
    • Advertise
    • PR Submissions
    • Eblast Submissions
  • Subscribe

How do you list Raspberry Pi’s users?

By Nikhil Agnihotri October 30, 2023

Raspberry Pi (RPi) is a popular microcomputer used for embedded systems design, hosting high-level applications that run over an operating system. Many of these applications have multiple active users with different permissions and access to system resources. 

As a result, there may be situations when it’s important to know what users are sharing the device. Fortunately, there are several ways to get a list of RPi’s registered users on the Linux system.  

In this article, we’ll discuss some of the common methods to obtain a list of RPi users. 

Listing users on Raspberry Pi
There are multiple methods for listing users on RPi, including the following.

1. Using the ‘cat’ command
2. Using the ‘getent’ command
3. Using the ‘cut’ and ‘awk’ commands
4. Using the ‘id’ command
5. Using the ‘w’ or ‘who’ command
6. Using the ‘/etc/passwd’ file
7. Using lslogin command
8. Using the ‘cut’ command for group members
9. Using GUI

Using the ‘cat’ command
The cat command in RPi and other Linux or Unix-based operating systems is a basic utility that displays the contents of one or more text files on the terminal. Cat stands for concatenate, one of its primary functions. The command has this syntax: 

cat [options] [file(s)]

The command can read data from a “passwd” file to obtain information about RPi’s users. The passwd file is present in all the Linux-based systems, including Raspberry Pi. It contains information about all users with access to the system. 

The following command can be used to attain the users: 

$ cat /etc/passwd

The command can be modified to obtain information about the users placed in the home directory by adding a filter using the ‘grep’ and ‘cat’ commands.

The grep command in RPi and other Linux/Unix-based operating systems is a powerful text-search utility used to search for specific patterns or strings within text files or the output of other commands. Grep stands for Global Regular Expression Print, which reflects its primary function of searching and printing lines that match a specified pattern.

The ‘cat’ and ‘grep’ commands can list the users of the home directory as follows:

$ cat /etc/passwd | grep home

Using the ‘getent’ command
The ‘getent’ command is another way to obtain information about RPi’s users. This command is a versatile utility that queries and retrieves information from various administrative databases. It can retrieve information about users, groups, hosts, networks, and other system-related data. It’s also particularly useful for getting data managed by database sources specified in the ‘/etc/nsswitch.conf’ configuration file. 

It has this syntax:

getent database [key]

The database specifies the type of retrieval information available (e.g., the “passwd” for the user information, the group for group information, the host for the host information, etc.). The key is an optional parameter that can search for a specific entry within the database.

To get a list of RPi’s users, use the ‘getent’ and ‘awk’ commands as per below.

$ getent passwd | awk -F ‘:’ ‘{print $1}’

To obtain information about a specific user, use this command:

$ getent passwd <username>

This command can also be used to sort a list of users within a specific range when it’s used with the ‘awk’ command as follows:

$ getent passwd {1000..6000}

Using the ‘cut’ and ‘awk’ commands
The ‘cut’ command in RPi and other Linux/Unix-based operating systems is a text-processing utility used to extract specific columns or fields from lines of text or delimited files. It’s useful for manipulating and processing structured data. This command can separate text into columns based on a delimiter character and then select specific columns for output. It has this syntax: 

cut [options] [file(s)]

The ‘[options]’ are the optional flags that modify the behavior of the ‘cut’ command, including specifying the delimiter and selecting fields and ‘[file(s)].’ The ‘[file(s)]’ are the files from which the ‘cut’ command will read data. 

To obtain information about RPi’s users, the command can be used to extract information from the ‘passwd’ file as follows:

$ cut -d: -f1 /etc/passwd

The ‘awk’ command in RPi and other Unix-like operating systems is a versatile text-processing utility that allows you to process and manipulate text data in a highly flexible and programmable manner. This command is powerful when working with structured text files, such as CSV files, log files, and other tabular or delimited data. The command has this syntax:

awk [options] ‘program’ [file(s)]

The ‘[options]’ are the optional flags that modify the behavior of the ‘awk’ command. The ‘program’ is a series of ‘awk’ commands enclosed in single quotes that define the actions to be performed on each line of input. The ‘[file(s)]’ are the files from which the ‘awk’ command will read data.

To obtain information about RPi’s users, this command can be used to extract information from the ‘passwd’ file as follows:

$ awk -F: ‘{print $1}’ /etc/passwd

Using the ‘id’ command
The ‘id’ command in Raspberry Pi and other Unix-like operating systems displays information about a user or group, including their user and group IDs (UID and GID), supplementary group IDs, and further details related to the user or group’s identity and privileges. 

This command can help you quickly access information about the current user or a specific user or group on the system. The command has this syntax: 

id [options] [username]

The ‘[options]’ are the optional flags that modify the behavior of the ‘id’ command. The ‘[username]’ is an optional argument specifying the username you want to display. If this is not specified, it defaults to the current user. The command can be used to get information about a specific RPi user as follows:

$ id <username>

Using the ‘w’ or ‘who’ commands
The ‘w’ command in Raspberry Pi and other Unix-like operating systems displays information about currently logged-in users and their activities. It provides a summary of who’s logged into the system, what they’re doing, and where they’re connected from. This command is useful for system administrators to monitor user sessions and resource use. The command has this syntax:

w [options]

The ‘ [options]’ are the optional flags that modify the behavior of the ‘w’ command. It’s executed as follows:

$ w

The ‘who’ command in Raspberry Pi and other Unix-like operating systems displays information about currently logged-in users. It provides a summary of who’s logged into the system, including details about their login sessions — such as the username, terminal or pseudo-terminal, login time, and remote IP address or hostname (if applicable).

While the ‘w’ command provides detailed information, including the terminal they are using, the ‘who’ command offers a simpler list. It has this syntax:

who [options]

The ‘ [options]’ are the optional flags that modify the behavior of the ‘who’ command. It’s executed as follows:

$ who

Using the /etc/passwd file
The information about RPi’s users can also be obtained by directly accessing the ‘passwd’ file using a text editor or pager like ‘nano’ or ‘less.’ It can be accessed as follows:

$ nano /etc/passwd

The ‘passwd’ file can be accessed using the less pager as follows:

$ less /etc/passwd

Using the ‘lslogin’ command
The ‘lslogin’ command lists all of RPi or any other Linux-based system’s current login sessions. It can be used to get information about the users who are logged in, the terminals they’re using, and the time they log in.

To list the current login sessions on your RPi, type the following command:

$ lslogin -u

Using the ‘cut’ command for group members
To list users belonging to a specific group, use the ‘cut’ and ‘grep’ commands as follows:

grep ‘^<groupname>:’ /etc/group | cut -d: -f4

Using GUI
In the desktop mode, a list of RPi users can be found by opening the file manager and navigating to the ‘home’ folder. In this folder, there are additional folders of all of the RPi’s users.

Conclusion
There are multiple ways to get information about Raspberry Pi’s users. Most of these methods access the ‘passwd’ file and manipulate its content. For example, information about users who are currently logged in can be obtained through commands like ‘w,’ ‘who,’ and ‘lslogins’. A folder for each user is in RPi’s home directory, which includes the names of all of the users.

You may also like:


  • RPi Python Programming 05: Introduction to Python
  • RPi Python programming 04
    RPi Python programming 04: Setting up Raspberry Pi Linux computer
  • Screenshot of Raspbian OS on Raspberry Pi
    RPi Python Programming 03: Raspberry Pi as Linux System
  • Raspberry Pi 4
    RPi Python Programming 01: Introduction to Raspberry Pi 4

  • How to build a Raspberry Pi VPN server

  • How to use Raspberry Pi camera module with Python
  • Connect Raspberry Pi to WiFi Prototype
    How to Connect Raspberry Pi to WiFi- (Part 3/12)

Filed Under: Electronic Projects, Raspberry pi, Tutorials
Tagged With: raspberrypi, rpi, users
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

Log in to leave a comment:

Lost your password?

Don't have an account? Register here

Submit a Guest Post

submit a guest post

EE TECH TOOLBOX

“ee
Tech Toolbox: Wide Bandgap Semiconductors
Moving from silicon to GaN or SiC feels like a whole new ballgame, doesn’t it? It isn’t just about faster switching; it’s about managing the layout parasitics and thermal realities that come with that speed. This month’s Tech Toolbox features a curated eBook that tackles these design hurdles head-on.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS feed: EDABOARD.com Discussions. EDABOARD.com Discussions.

  • 7555 with no discharge resistor for monostable operation?
  • I have an Acer Aspire 5 A515-54G-53H6 issue with mother board
  • PCB not properly made
  • Flyback converter working incorrectly
  • Improve Equipment Efficiency

RSS feed: Electro-Tech-Online.com Discussions Electro-Tech-Online.com Discussions

  • Electronics and PIC Programming Assembler Update
  • Getting rid of old magazines
  • PIC code for 2.42" I2C OLED Display?
  • Getting Back Into Electronics
  • Best way to check charge and discharge many mixed batteries?

Featured Tutorials

LoRa and LoRaWAN: A Complete Guide to Wireless Communication

  • Best practices for securing LoRa networks
    Best practices for securing LoRa networks
  • Understanding LoRa architecture: nodes, gateways, and servers
    Understanding LoRa architecture: nodes, gateways, and servers
  • Revolutionizing RF: LoRa applications and advantages
    Revolutionizing RF: LoRa applications and advantages
  • How to build a LoRa gateway using Raspberry Pi
    How to build a LoRa gateway using Raspberry Pi
  • How LoRa enables long-range communication
    How LoRa enables long-range communication
  • How communication works between two LoRa end-node devices
    How communication works between two LoRa end-node devices
More Tutorials >

Recent Articles

  • Silanna launches matched chipset for multi-channel LiDAR
  • Renesas launches browser-based embedded development hub
  • Diodes targets EV charging current sensing
  • Tria Technologies launches software kit for embedded systems
  • Nexperia adds 18 V to 200 V GaN FETs

EE ENGINEERING TRAINING DAYS

engineering
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2026 Arrowfly LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of Arrowfly
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Complete Sensor Guide
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Tech Terms
    • Webinars & Digital Events
  • Resources
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • White Papers
  • Guest Post Guidelines
  • Advertisers
    • Advertise
    • PR Submissions
    • Eblast Submissions
  • Subscribe