Edit - Stack Overflow (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (Stack Overflow) (https://stackoverflow.com/opensearch.xml) (https://stackoverflow.com/posts/29357178/edit) (site logo) Join Stack Overflow By clicking “Sign up”, you agree to our (https://stackoverflow.com/legal/terms-of-service/public) terms of service and acknowledge you have read our (https://stackoverflow.com/legal/privacy-policy) privacy policy . Sign up with Google Sign up with GitHub OR Email Password (8+ characters (at least 1 letter & 1 number)) Sign up Already have an account? (https://stackoverflow.com/users/login) Log in Skip to main content (https://stackoverflow.com/) Stack Overflow (https://stackoverflow.co/) About Products (https://stackoverflow.co/teams/ai/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav-bar&utm_content=overflowai) OverflowAI (Search…) (Click to show search) (https://stackoverflow.com/users/login?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fposts%2f29357178%2fedit) Log in (https://stackoverflow.com/users/signup?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fposts%2f29357178%2fedit) Sign up Let's set up your homepage Select a few topics you're interested in: python javascript c# reactjs java android html flutter c++ node.js typescript css r php angular next.js spring-boot machine-learning sql excel ios azure docker Or search from our full list: (Search) Next You’ll be prompted to create an account to view your personalized homepage. (https://stackoverflow.com/) Home (https://stackoverflow.com/questions) Questions (https://stackoverflow.com/tags) Tags (https://stackoverflow.com/beta/discussions) Discussions Labs (https://chat.stackoverflow.com/?tab=all&sort=active) Chat (https://stackoverflow.blog/contributed?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=so-blog&utm_content=experiment-articles) Articles (https://stackoverflow.com/users) Users (https://stackoverflow.com/jobs?source=so-left-nav) Jobs (https://stackoverflow.com/jobs/companies?so_medium=stackoverflow&so_source=SiteNav) Companies Collectives Communities for your favorite technologies. (https://stackoverflow.com/collectives-all) Explore all Collectives Teams Ask questions, find answers and collaborate at work with Stack Overflow for Teams. (https://stackoverflowteams.com/teams/create/free/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Try Teams for free (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Explore Teams You are not (https://stackoverflow.com/users/login?ssrc=suggested_edit) logged in . Your edit will be placed in a queue until it is (https://stackoverflow.com/help/privileges/edit) peer reviewed . We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks. Required fields(required) * Rev (e51add55-0eae-45b6-87c9-ae62202c0ef6) Friedrich -- Слава Україні - May 21, 2022 at 14:43 - fixed: cmd and comment swapped (249489d9-143f-4874-af1f-42ac1127061c) Jonathan Leffler - Mar 31, 2015 at 0:25 - Remove the # from the output lines; it isn't there in 'real life'. (ac4baf3b-f654-479a-8049-64653ad595c1) kberg - Mar 30, 2015 at 22:04 Required fields(required) * (https://stackoverflow.com/questions/29357095/linux-how-to-get-group-id-from-group-name-and-vice-versa) Linux: How to get group id from group name? and vice versa? I want to retrieve group id of a particular group name. Is there a command in Linux/UNIX systems to do this? Also if I want to do it the other way - get group name from group id, is that also possible? Answer(required) * getent group 124 # mysql:x:124: getent group mysql # mysql:x:124: Heading (Ctrl-H) Bold (Ctrl-B) Italic (Ctrl-I) Link (Ctrl-L) Blockquote (Ctrl-Q) Table (Ctrl-E) Edit table Numbered list (Ctrl-O) Bulleted list (Ctrl-U) Horizontal rule (Ctrl-R) More formatting Undo (Ctrl-Z) Redo (Ctrl-Y) (https://stackoverflow.com/editing-help) Help (Rich text mode) Rich text mode (Markdown mode) Markdown mode (Markdown with preview mode) Markdown with preview mode Change selected language. Currently: csharp (auto) getent group 124 # mysql:x:124: getent group mysql # mysql:x:124: Draft saved Draft discarded Edit Summary(required) * (briefly explain your changes (corrected spelling, fixed grammar, improved formatting)) Save edits (https://stackoverflow.com/questions/29357095/linux-how-to-get-group-id-from-group-name-and-vice-versa/29357178#29357178) Cancel 0 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) How to Edit Correct minor typos or mistakes Clarify meaning without changing it Add related resources or links Always respect the author’s intent Don’t use edits to reply to the author How to Format create code fences with backticks ` or tildes ~ ```like so``` add language identifier to highlight code ```pythondef function(foo):print (foo)``` put returns between paragraphs for linebreak add 2 spaces at end _italic_ or **bold** indent code by 4 spaces backtick escapes `like _so_` quote by placing > at start of line to make links (use https whenever possible) [example](https://example.com) example (https://stackoverflow.com/editing-help) formatting help » (https://stackoverflow.com/help/how-to-answer) answering help » lang-bash (https://stackoverflow.com/) (https://stackoverflow.com/) Stack Overflow (https://stackoverflow.com/questions) Questions (https://stackoverflow.com/help) Help (https://chat.stackoverflow.com/?tab=site&host=stackoverflow.com) Chat (https://stackoverflow.co/) Products (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=teams) Teams (https://stackoverflow.co/advertising/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=advertising) Advertising (https://stackoverflow.co/advertising/employer-branding/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=talent) Talent (https://stackoverflow.co/) Company (https://stackoverflow.co/) About (https://stackoverflow.co/company/press/) Press (https://stackoverflow.co/company/work-here/) Work Here (https://stackoverflow.com/legal) Legal (https://stackoverflow.com/legal/privacy-policy) Privacy Policy (https://stackoverflow.com/legal/terms-of-service/public) Terms of Service (https://stackoverflow.com/contact) Contact Us Your Privacy Choices (https://stackoverflow.com/legal/cookie-policy) Cookie Policy (https://stackexchange.com/) Stack Exchange Network (https://stackexchange.com/sites#technology) Technology (https://stackexchange.com/sites#culturerecreation) Culture & recreation (https://stackexchange.com/sites#lifearts) Life & arts (https://stackexchange.com/sites#science) Science (https://stackexchange.com/sites#professional) Professional (https://stackexchange.com/sites#business) Business (https://api.stackexchange.com/) API (https://data.stackexchange.com/) Data (https://stackoverflow.blog/?blb=1) Blog (https://www.facebook.com/officialstackoverflow/) Facebook (https://twitter.com/stackoverflow) Twitter (https://linkedin.com/company/stack-overflow) LinkedIn (https://www.instagram.com/thestackoverflow) Instagram Site design / logo © 2025 Stack Exchange Inc; user contributions licensed under (https://stackoverflow.com/help/licensing) CC BY-SA . rev 2025.5.8.26374 By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our (https://stackoverflow.com/legal/cookie-policy) Cookie Policy . Accept all cookies Necessary cookies only Customize settings