Sunday, June 1, 2014

Useful Linux Commands for User handling

1) How to find out under which user session you are working ?
         use "whoami" to find out user name of user currently active
                   >whoami

 2) How to add new user ?
                   >useradd your_user_name
                  rather
                   >sudo useradd your_user_name

 3) How to change password of user ?
                 >passwd your_user_name
                      rather
                >sudo passwd your_user_name

 4) Delete a user
               >userdel user_name_to_delete 
5) List all users on Linux Box
             >cat /etc/passwd

6) How to find out current Users & their process?
     'w' is command that we can use here
              >w

7) Currently logged in users:
       To list currently logged in users 'who' command can be used
             >who

8) How to see all groups ?
       To list out all groups on your machine
            >cat /etc/group

 Please use manpages for more details about each command like say 
          >whoami  -h

Thanks & Happy Weekend!

No comments:

Post a Comment