BASIC LINUX COMMANDS β GENERAL COMMANDS P-2
Letβs see some general commands once again.
pidof process_name
This command will display the PID (i.e Process ID) of a particular process.
For Eg :- βpidof firefoxβ.
pwdx PID_No
This command will display the path of the process.
For Eg :- βpwdx 2074β ==> PID for firefox works on /home/user.
nice -n 11 specific_command
Nice is used to modify programβs priority.Values ranges from [ -20 to +19 ].
-20 has highest priority.Where +19 has lowest priority.
-n ==> denotes number.
11 ==> is the value from the range.
NOTE : [ From -20 to 0 ] were root user permitted.
Value 10 is default.Sudo command must use for set the priority to -20 to 0.
renice -n 7 -p PID_No
Renice is nothing but,to change the priority order.Here PID should mention.
This will change the priority from 11 to 7.
BASIC USER MANAGEMENT COMMANDS
Now,we can see some User management commands.
sudo useradd username
This command will add a new user.By default this is password free.We need to set the password later.It will automatically generates User ID.
sudo useradd -u 0127 username
In this command,we made a custom ID (0127) to the username.
Conform this by using the below command.
tail /etc/passwd
A user is created named βsampleuserβ with a ID β1002β.
sudo passwd -Sa
Using this command,we can check the password is allocated or not to a user.
P ==> denotes it is Password protected.
L ==> denotes for Locked.
NP ==> denotes No Password.
sudo passwd username
Here,we can set a password to that user.
There is another method for creating a user with interactive.We can see the method below..,
sudo adduser username
In this method,we can set password,Name,and some user details.
sudo userdel username
For deleting the user,we can use this command.
NOTE :
This will delete the user,but the folder created for that user wonβt be deleted.The folder will only create when the user create on interactive method.We need to remove that folder manually.
sudo userdel -r username
This will delete the user with the userβs folder.
We can check the by changing our directory to home.
cd /home
ls
Here, we can see the user folders is created or not.Like the below image.
Now,we can create groups.
sudo groupadd group_name
sudo groupadd -g custom_group_ID group_name
This will create a new group.
Also we can use a custom group_ID.
sudo useradd -G group_name username
sudo usermod -a -G group_name username
Using any one of these commands we can add the respective user to the group.
sudo groupdel group_name
This will delete the group.
Thatβs it..!