Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


Tutorial Beginning Linux – User and Process Management filter_list
Author
Message
Beginning Linux – User and Process Management #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?
  • 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
If you want to change password for another user (Only if you are root):

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
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:

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
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:

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
To find out when a particular user last logged in to the system, give his username as an argument.

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]

[Image: 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
[Image: znALY5V.jpg]

[+] 1 user Likes §herlock's post
Reply

RE: Beginning Linux – User and Process Management #2
Good, detailed tutorial. Keep it up!
~~ Might be back? ~~

[+] 1 user Likes Bish0pQ's post
Reply

RE: Beginning Linux – User and Process Management #3
What about killing processes? Just gonna include this since you didn't, good tutorial nevertheless I guess -

To kill a process by its PID
Code:
$ kill {pid}

To kill a process by its name
Code:
$ killall {name here}

Also, there are many flags you can include in a kill command to make it do different things.

[+] 1 user Likes meow's post
Reply

RE: Beginning Linux – User and Process Management #4
(01-12-2016, 11:45 PM)meow Wrote: What about killing processes? Just gonna include this since you didn't, good tutorial nevertheless I guess -

To kill a process by its PID
Code:
$ kill {pid}

To kill a process by its name
Code:
$ killall {name here}

Also, there are many flags you can include in a kill command to make it do different things.

Thanks! I will include this in my next tutorial.
[Image: znALY5V.jpg]

Reply

RE: Beginning Linux – User and Process Management #5
I liked the tutorial. Short and digestable.
[Image: zombie_signature_by_meadowsdesigns-d50dssb.png]

Reply

RE: Beginning Linux – User and Process Management #6
(03-03-2016, 05:12 PM)XWorm Wrote: I liked the tutorial. Short and digestable.

Now this shit is grave digging. I don't care if the thread has been replied on in the past 3 months.

Reply

RE: Beginning Linux – User and Process Management #7
(03-03-2016, 11:39 PM)meow Wrote: Now this shit is grave digging. I don't care if the thread has been replied on in the past 3 months.

Care to explain how a reply just over 7 weeks old to the last post, Is classed as grave digging?
[Image: AD83g1A.png]

Reply







Users browsing this thread: 2 Guest(s)