Beginning Linux – User and Process Management 01-12-2016, 02:21 PM
#1
This is the third chapter of the Beginning Linux series. Here is the link to the first chapter and here to the second.
What is in this Chapter?
Sources:
Changing your password
In the last chapter, we forgot to add this part, so we are adding it here. To change your password, use the passwd tool. You will need to enter your current password and a new password to replace it with. For security purposes, neither the old nor the new password is echoed to the screen as you type it.
To change your password, type:
If you want to change password for another user (Only if you are root):
User Activity
Here we will see some simple commands for finding out who we are currently sharing the system with and what they are doing.
Listing your username
Use whoami command to output the username of the user that is logged in at the terminal. It's useful to determine whether or not it is your account that you are messing with.
To output your username:
The user who is currently logged in at the terminal is geekizer.
Listing Logged in Users
Use who command to see the list of all the users that are currently logged in to the system. The output has minimum of three columns, listing username, terminal location, time of login for all users. Fourth column maybe there if a user is logged using the X Window System; it lists the window location of the user's session.
To see the logged in users:
The output in this example shows that the user geekizer is logged in on tty1 (the first virtual console on the system), and has been on since 20:09 on 20 October. The user helpo is logged in on tty2 (the second virtual console), and has been on since 14:37 on 21 October. The user sherlock is logged in twice−−on tty3 (the third virtual console), and ttyp1, which is an X session.
Listing Who is on and what they are doing
The w tool is similar to who, but it shows more detail. It gives a header line that contains information about the current system status, including the current time, the amount of time the system has been up and running, and the number of users on the system. It then outputs a list of users currently logged in to the system, giving eight columns of information for each.
These columns include username, terminal location, X session (if any), the time of login, the amount of time the user has been idle, and what command the user is running. (It also gives two columns showing the amount of time the system's CPU has spent on all of the user's current jobs (JCPU) and foreground process (PCPU).
To see who is currently logged in and what they are doing, type:
As you can see, the command's output shows the current system time, system uptime, and the logged in users along with what they are doing.
Finding last time a user logged in
Use last tool to find out who has recently used the system, which terminal they used and when they logged in or out.
To find out when a particular user last logged in to the system, give his username as an argument.
Listing System Activity
When you run a command, you are starting a process on the system. Every process is given a unique number, called its process ID or 'PID'.
Use ps command to list processes on the system. It displays information about processes that includes process ID, name of command being run, user who is running that program, and how long the process has been running.
By default, ps outputs 5 columns; PID, Terminal name, Status ((S)leeping, ®unning, (Z)ombie process: process that has already died) total amount of time CPU has spent on the process since its start and name of the command being run.
![[Image: LpnDSb5.png]](http://i.imgur.com/LpnDSb5.png)
![[Image: HJVFKwd.jpg]](http://i.imgur.com/HJVFKwd.jpg)
What is in this Chapter?
- Changing passwords
- Listing User Activity
- Listing System Activities
Sources:
- Intro Linux
- Linux Cookbook
Changing your password
In the last chapter, we forgot to add this part, so we are adding it here. To change your password, use the passwd tool. You will need to enter your current password and a new password to replace it with. For security purposes, neither the old nor the new password is echoed to the screen as you type it.
To change your password, type:
Code:
$ passwd
Code:
$ passwd <username>
User Activity
Here we will see some simple commands for finding out who we are currently sharing the system with and what they are doing.
Listing your username
Use whoami command to output the username of the user that is logged in at the terminal. It's useful to determine whether or not it is your account that you are messing with.
To output your username:
Code:
$ whoami
geekizer
Listing Logged in Users
Use who command to see the list of all the users that are currently logged in to the system. The output has minimum of three columns, listing username, terminal location, time of login for all users. Fourth column maybe there if a user is logged using the X Window System; it lists the window location of the user's session.
To see the logged in users:
Code:
$ who
geekizer tty1 Oct 20 20:09
helpo tty2 Oct 21 14:37
sherlock tty3 Oct 21 15:04
sherlock ttyp1 Oct 21 15:04
Listing Who is on and what they are doing
The w tool is similar to who, but it shows more detail. It gives a header line that contains information about the current system status, including the current time, the amount of time the system has been up and running, and the number of users on the system. It then outputs a list of users currently logged in to the system, giving eight columns of information for each.
These columns include username, terminal location, X session (if any), the time of login, the amount of time the user has been idle, and what command the user is running. (It also gives two columns showing the amount of time the system's CPU has spent on all of the user's current jobs (JCPU) and foreground process (PCPU).
To see who is currently logged in and what they are doing, type:
Code:
$ w
As you can see, the command's output shows the current system time, system uptime, and the logged in users along with what they are doing.
Finding last time a user logged in
Use last tool to find out who has recently used the system, which terminal they used and when they logged in or out.
Code:
$ last
Code:
$ last geekizer
Listing System Activity
When you run a command, you are starting a process on the system. Every process is given a unique number, called its process ID or 'PID'.
Use ps command to list processes on the system. It displays information about processes that includes process ID, name of command being run, user who is running that program, and how long the process has been running.
By default, ps outputs 5 columns; PID, Terminal name, Status ((S)leeping, ®unning, (Z)ombie process: process that has already died) total amount of time CPU has spent on the process since its start and name of the command being run.
![[Image: LpnDSb5.png]](http://i.imgur.com/LpnDSb5.png)
![[Image: HJVFKwd.jpg]](http://i.imgur.com/HJVFKwd.jpg)
I had to do the last section in image because apparently you can't write the linux command to list all the processes in MyBB forums that is powered by Cloudflare and what ever version you are using. I have made a post on MyBB community regarding that:
http://community.mybb.com/thread-187969.html
http://community.mybb.com/thread-187969.html