function::task_egid - Linux
Overview
task_egid retrieves the effective group ID of a task. The effective group ID is the group ID that the task will use if it performs operations that are controlled by file system permissions, such as creating files.
Syntax
task_egid [<pid>]
If no PID is specified, the effective group ID of the current task is retrieved.
Options/Flags
None.
Examples
To retrieve the effective group ID of the current task:
$ task_egid
100
To retrieve the effective group ID of a specific task:
$ task_egid 1234
100
Common Issues
If the specified task does not exist, task_egid will return an error.
Integration
task_egid can be used in conjunction with other commands to perform advanced tasks. For example, it can be used with the ps
command to identify tasks that are running with a specific effective group ID.
$ ps -e | task_egid
PID User Group EGID Command
1234 root root 100 init
1235 root root 100 [kthreadd]
1236 root root 100 [migration/0]
Related Commands
- getgid – Get the current process’s real group ID.
- getegid – Get the current process’s effective group ID.
- setgid – Set the current process’s real group ID.
- setegid – Set the current process’s effective group ID.