• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

groupmod: command not found

by admin

The groupmod command is used to change the group’s own attributes. It will edit the /etc/group file for you. Modifications of the group might include changing its name or GID. Adding a user to a group is considered to be a modification of the user, not the group. As such, it is accomplished using the usermod command.

Some groupmod options include the following.

Option Description
-g Change the group ID.
-n Rename a group.

Syntax

The syntax of the groupmod command is:

# groupmod [options] {group names}

To modify the name of a group after it has been created, use the groupmod command. To make the change, log in as the root user and enter the following command:

# groupmod -n newgroup currentgroup

where newgroup is the new name you want to give the group, and currentgroup is the current name of the group. For example, to change a group name from admin to geek, you would use the following command:

# groupmod -n geek admin

If you encounter below error while running the groupmod command:

groupmod: command not found

you may try installing the passwd package as shown below as per your choice of distribution.

Distribution Command
Debian apt-get install passwd
Ubuntu apt-get install passwd
Alpine apk add shadow
Arch Linux pacman -S shadow
Kali Linux apt-get install passwd
Fedora dnf install shadow-utils-2
Raspbian apt-get install passwd

groupmod Command Examples

1. Change the group ID:

# groupmod -g 123 group_name

2. Rename a group:

# groupmod -n new_group_name group_name

See the man page groupmod for a full list of all the command-line options available.

Filed Under: Linux

Some more articles you might also be interested in …

  1. asciiart Command Examples in Linux
  2. iperf Command Examples in Linux
  3. How to use strace and ltrace commands in Linux
  4. How to effectively use Man Pages under Linux
  5. iftop: command not found
  6. module: command not found
  7. How to install and configure Samba in CentOS / RHEL
  8. dd Command Examples in Linux
  9. ipset: command not found
  10. duc Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • nixos-rebuild Command Examples in Linux
  • nixos-option: Command Examples in Linux
  • nixos-container : Command Examples in Linux
  • nitrogen Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright