Adding users and groups in linux

Adding users:

# create a new user
sudo adduser wonderfulperson
sudo useradd wonderfulperson

# udpate password
sudo password wonderfulperson

# batch add users.
vi addmultipleusers

# add the test content below
# username:passwd:uid:gid:full name:home_dir:shell


# back to shell, type the newusers command with attribute
sudo newusers users.txt

#example output
?? $ less /etc/passwd | grep user


# look up all of the existing groups in Linux
cut -d: -f1 /etc/group

# To review which group a user belong to use:
groups <username>


# Add groups
sudo groupadd guestusers
sudo addgroup guestusers

# To add one user in multiple groups user the following code:
sudo usermod -a -G <group1>,<group2>,<group3> <username>
?? $ sudo usermod -a -G mysql,apache,sssd user2
?? $ groups user2
user2 : user2 sssd apache mysql


Bash Line Commands – Most used

Basic Bash commands
Crtl+A – move to the beginning of a line
Crtl+E – move to the end of a line
Crtl+F == right arrow
Crtl+B == back arrow
Crtl+D – delete a character
Crtl+U – delete from curser positon to the beginning of the line
Crtl+K – delete from the curser positon to the end of the line
Crtl+X then backspace == Crtl+U
Crtl+T transpose a character
Esc+T transpose WORDS
Esc+U change to uppercase – whole word
Esc+L change to lower case
history – show the command history
history -c : clear the history