LoginSignup
1

More than 5 years have passed since last update.

自分のデフォルトで所属しているグループ名を取得する方法

Last updated at Posted at 2016-05-22

linuxでユーザーを作った際は、必ず自分のユーザー名グループに所属しています
その、gidの名前のみを取得するスクリプトを書きました

自分のデフォルトで所属しているグループ名を取得する方法

$ id | awk '{print $2}' | sed -e 's/gid=[^(]*(*\(.*\))/\1/'
hogegroup

2016-05-22 17:40 追記

グループ名を取得するほうほうには、こんな方法もある

id -gn

sugitkさんより

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1