Exp.
2 Login to OS and monitoring the performance
For monitoring purpose, various commands can be used. A few of those
commands are listed below:
1. top
One of the most commonly used commands. At high level, it describes various
details like: system uptime, CPU usage, number of threads, memory usage etc.
The screenshot below shows the details about the results obtained after
executing the mentioned command.
There are many versions of top command which might be used in the later
stage.
NOTE: To exit/quit out of top command, press ‘q’.
2. vmstat
It gives the details about the virtual memory. Usually, a system starts using
virtual memory when it runs out of physical memory. As the size of physical
memory is limited, virtual memory is always required. The screenshot attached
below gives the details of the results obtained after the execution of vmstat
command.
Exp.3 Identify CPU and memory-intensive processes,
adjust process priority with renice, and kill processes.
The utilization of CPU and resources depends on the priority of the process. The
priority can be identified with the help of NICE value. Whenever a
process/application starts, its default NICE value is ZERO (0). It can be changed
from -20 to 19. Lesser the NICE value is, higher is the priority of the process.
Renice: renice alters the priority for the running process.
NOTE: Only super-user can increase the priority.
Steps for adjusting the process priority
1. Check for process status
ps – l
Here, observe the NICE value. By default the NICE value of new processes
would be ZERO.
ps stands for Process Status.
2. Start a new background process by executing
sleep 4000 &
3. Again, check the process status
ps -l
4. Using renice
Syntax: renice new_priority_value PID
Ex: renice +10 3383
To kill a process, use the following command:
Syntax: kill process_id
Ex: kill 3383
Exp.4 Locate and interpret system log files
cd /var/log
ls
The ls command is used to list all the files present under the current directory.
Experiment-5
First of all, let's check the total number of users available
at the moment. It can be done by executing the
following:
getent passwd
Adding a new user
In order to add a new user, one needs root privileges.
Let’s follow the shown command to add a new user.
sudo useradd Namm
Now, let’s set password for the newly created user. The
command to set password is given below.
Syntax: sudo passwd user-name
sudo passwd Namm
Then, it would ask for the new password.
Now, let’s try to switch to the new user. The command
to be followed is:
Syntax: su user-name
su Namm
Then, it’d ask you to enter the password for the newly
created user.
su: su stands for switch user in this case
To exit out of this user. Type exit.
Exp.6 Modify user name
Syntax: sudo usermod -l new-username old-
username
sudo usermod -l ABC Namm
Exp 7 Delete the user
Syntax: sudo userdel user-name
sudo userdel ABC
Experiment 8: Change passwords and
adjust password aging for local user
accounts.
Password management plays an important role nowadays as
one must change or update their passwords frequently.
Passwords can be updated for any user in linux. For instance,
in the previous experiment we created a user named “Namm”.
If we want to change the password for Namm we just need to
make use of the following command in order to do that.
Syntax: sudo passwd user-name
sudo passwd Namm
The output of the above command is
Password Aging
Password aging is used in order to prompt the user to change
their user-password after a point of time. The command used
for this purpose is chage
Syntax: chage -M 90 -W 10 user-name
-M stands for maximum number of days for which password
is valid
-W stands for warning for the number of days before password
expires.