Thursday, 31 August 2017

Unix Shell Scripting Tutorial - page 5

Unix Shell Scripting Tutorial - page 5

Question: What are the directory structure of unix?
  1. /: This is the root directory which should contain only the directories.
  2. /bin: Executable files are located here.
  3. /dev: Device drivers
  4. /etc: configuration files, valid user lists, groups, ethernet and hosts etc
  5. /lib: shared library files and sometimes other kernel-related files.
  6. /boot: files for booting the system.
  7. /home: home directory for users and other accounts
  8. /mnt: Used to mount other temporary file systems like CD/pendrive
  9. /proc: Contains all processes marked as a file by process number.
  10. /tmp: Holds temporary files used between system boots.
  11. /user: Used for miscellaneous purposes.
  12. /var: Typically contains log and print files.
  13. /sbin: Contains binary (executable) files.
  14. /kernel: kernel files



Question: How to create a new Group?
groupadd mynewgroup



Question: How to modify group name?
groupmod -n new_modified_group_name old_group_name



Question: How to delete group?
groupdel new_modified_group_name



Question: How to add a existing user to a group?
usermod -a -G mynewgroup username

-G Its for secondary group.
-g Its for primary group.


Question: How to change a User's Primary Group?
usermod -g groupname username  



Question: How to list groups of loggined user?
groups



Question: How to list groups of other user?
groups username



Question: How to Create a New User and Assign a Group?
useradd -G examplegroup username



Question: How to assign a user multiple groups?
usermod -a -G group1,group2,group3 username



No comments :

Post a Comment