search

How to view users in linux

Jul 09, 2019 am 10:52 AM
linux

How to view users in linux

When using a Linux system, you often need to check user information. In addition to the cat /etc/passwd file, there are actually many commands that can directly check system user information.

The following summarizes some common methods for viewing users under Linux systems:

id command

Function: Print the user and group information of the specified user.

Syntax: id [option]...[username]

Description: If the username is omitted, print the user and group information of the current user.

whois command

Function: Find and display user information.

Syntax: whois [options] ... Object...

Description: The whois command will find and display user-related information for the specified account. Because it searches the WHOIS database, this The account name must be registered above to be found, and there is no case difference in the name. To use the whois command, you need to install the whois software package first.

whoami command

Function: Display the user name associated with the current effective user ID.

Syntax: whoami [options]...

Description: Same as id -un.

Parameters:

--help Display this help information and exit

--version Display version information and exit

How to view users in linux

Linux id and whoami commands

who command

Function: Display the currently logged in user information.

Syntax: who [option]... [File | Parameter 1 Parameter 2]

Description: Executing this command can know which users are currently logged in to the system. Executing the who command alone will Lists the login account, the terminal used, the time of login, and where you logged in from or which X monitor you are using.

Parameters:

-a, --all is equal to -b -d --login -p -r -t -T -u option combination

-b, --boot Last system startup time

-d, --dead Display dead processes

-H, --heading Output the title bar of the header

- l, --login displays the system login process

--lookup attempts to check the host name through DNS

-m only faces hosts and users that interact directly with standard input

-p, --process Display the active processes derived from the init process

-q, --count List the login names and user numbers of all logged-in users

-r, -- runlevel Display the current running level

-s, --short Display only the name, line and time (default)

-T, -w, --mesg Use, - or ? to mark the user Message status

-u, --users List logged in users

--message equals-T

--writable equals-T

--help Display this help information and exit

--version Display version information and exit

How to view users in linux

Linux who command

wCommand

Function: Display the information of the users currently logged in to the system.

Syntax: w [-fhlsuV][user name]

Description: Execute this command to know who are the users currently logged into the system and the programs they are executing. Executing the w command alone will display all users. You can also specify a user name to display only the relevant information of a certain user.

Parameters:

-f Turn on or off the display of where the user logs in to the system.

-h Does not display the title information column of each field.

-l Use detailed format list, this is the default value.

-s Use a concise format list and do not display the user login time, terminal stage operations and CPU time consumed by the program.

-u Ignore the name of the executing program and information about the CPU time consumed by the program.

-V Display version information.

How to view users in linux

Linux w command

finger command

The function of the finger command is to query user information, usually Information such as the user name, home directory, dead time, login time, login shell, etc. of a user in the system will be displayed. If you want to query the user information on the remote machine, you need to follow the user name with "@hostname" in the format of [username@hostname]. However, the network host to be queried needs to run the finger daemon.

The general format of this command is:

finger [option] [user] [user@host]

The meaning of each option in the command is as follows:

-s Displays the user's registered name, actual name, terminal name, writing status, dead time, login time and other information.

-l In addition to the information displayed with the -s option, it also displays information such as the user's home directory, login shell, email status, and the contents of the .plan, .project, and .forward files in the user's home directory.

-p is the same as the -l option except that .plan files and .project files are not displayed.

How to view users in linux

Linux finger command

vlock command

Function: Lock the virtual terminal.

Syntax: vlock [-achv]

Description: Executing the vlock command can lock the virtual terminal to prevent others from using it.

Parameters:

-a or --all Lock all terminal stage jobs. If you use this parameter in a full-screen terminal, you will use the keyboard to switch the terminal function. Close together.

-c or --current Lock the current terminal phase job, this is the default value.

-h or --help Online help.

-v or --version Display version information.

How to view users in linux

vlock command under Linux

These are common methods for viewing users under Linux systems. You no longer need to directly search for the /etc/passwd file in the future.

Related recommendations: "Linux Tutorial"

The above is the detailed content of How to view users in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Understanding Linux: The Core Components DefinedUnderstanding Linux: The Core Components DefinedMay 01, 2025 am 12:19 AM

The core components of Linux include kernel, shell, file system, process management and memory management. 1) Kernel management system resources, 2) shell provides user interaction interface, 3) file system supports multiple formats, 4) Process management is implemented through system calls such as fork, and 5) memory management uses virtual memory technology.

The Building Blocks of Linux: Key Components ExplainedThe Building Blocks of Linux: Key Components ExplainedApr 30, 2025 am 12:26 AM

The core components of the Linux system include the kernel, file system, and user space. 1. The kernel manages hardware resources and provides basic services. 2. The file system is responsible for data storage and organization. 3. Run user programs and services in the user space.

Using Maintenance Mode: Troubleshooting and Repairing LinuxUsing Maintenance Mode: Troubleshooting and Repairing LinuxApr 29, 2025 am 12:28 AM

Maintenance mode is a special operating level entered in Linux systems through single-user mode or rescue mode, and is used for system maintenance and repair. 1. Enter maintenance mode and use the command "sudosystemctlisolaterscue.target". 2. In maintenance mode, you can check and repair the file system and use the command "fsck/dev/sda1". 3. Advanced usage includes resetting the root user password, mounting the file system in read and write mode and editing the password file.

Linux Maintenance Mode: Understanding the PurposeLinux Maintenance Mode: Understanding the PurposeApr 28, 2025 am 12:01 AM

Maintenance mode is used for system maintenance and repair, allowing administrators to work in a simplified environment. 1. System Repair: Repair corrupt file system and boot loader. 2. Password reset: reset the root user password. 3. Package management: Install, update or delete software packages. By modifying the GRUB configuration or entering maintenance mode with specific keys, you can safely exit after performing maintenance tasks.

Linux Operations: Networking and Network ConfigurationLinux Operations: Networking and Network ConfigurationApr 27, 2025 am 12:09 AM

Linux network configuration can be completed through the following steps: 1. Configure the network interface, use the ip command to temporarily set or edit the configuration file persistence settings. 2. Set up a static IP, suitable for devices that require a fixed IP. 3. Manage the firewall and use the iptables or firewalld tools to control network traffic.

Maintenance Mode in Linux: A System Administrator's GuideMaintenance Mode in Linux: A System Administrator's GuideApr 26, 2025 am 12:20 AM

Maintenance mode plays a key role in Linux system management, helping to repair, upgrade and configuration changes. 1. Enter maintenance mode. You can select it through the GRUB menu or use the command "sudosystemctlisolaterscue.target". 2. In maintenance mode, you can perform file system repair and system update operations. 3. Advanced usage includes tasks such as resetting the root password. 4. Common errors such as not being able to enter maintenance mode or mount the file system, can be fixed by checking the GRUB configuration and using the fsck command.

Maintenance Mode in Linux: When and Why to Use ItMaintenance Mode in Linux: When and Why to Use ItApr 25, 2025 am 12:15 AM

The timing and reasons for using Linux maintenance mode: 1) When the system starts up, 2) When performing major system updates or upgrades, 3) When performing file system maintenance. Maintenance mode provides a safe and controlled environment, ensuring operational safety and efficiency, reducing impact on users, and enhancing system security.

Linux: Essential Commands and OperationsLinux: Essential Commands and OperationsApr 24, 2025 am 12:20 AM

Indispensable commands in Linux include: 1.ls: list directory contents; 2.cd: change working directory; 3.mkdir: create a new directory; 4.rm: delete file or directory; 5.cp: copy file or directory; 6.mv: move or rename file or directory. These commands help users manage files and systems efficiently by interacting with the kernel.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment