LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Tags used in this thread
Popular LQ Tags , ,

Reply
 
Thread Tools
Old 05-21-2009, 03:17 PM   #1
sl33p
Member
 
Registered: Dec 2008
Location: Tahiti
Distribution: Backtrack 4 / Fedora 10 / Ubuntu 9.04
Posts: 32
Thanked: 3
Process question


[Log in to get rid of this advertisement]
Hi guys, I`m studying for the LPIC-1 exam, and reading a book that they recommend: "Introduction to Linux: A Hands-on Guide", by Machtelt Garrels.

There's one question on the 4th chapter (Processes), that I found confusing:

Question: Based on process entries in /proc, owned by your UID, how would you work to find out which processes these actually represent?

What does he mean? If I run the command (considering that my username is sl33p):

Code:
$ps -u sl33p
...gives me the right answer?

The ps man page says:

Quote:
-u userlist

Select by effective user ID (EUID) or name.

This selects the processes whose effective user name or ID is in userlist. The effective user ID describes the user whose file access permissions are used by the process (see geteuid(2)). Identical to U and --user.
Thanks in advance.
sl33p is offline  
Tag This Post , ,
Reply With Quote
Old 05-21-2009, 03:47 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Fedora, FreeBSD
Posts: 2,386
Thanked: 81
Quote:
Originally Posted by sl33p
Question: Based on process entries in /proc, owned by your UID, how would you work to find out which processes these actually represent?
Here is a clue: look at the long listing of the PIDs in /proc and find the ones you own. Then investigate further...
anomie is offline     Reply With Quote
Thanked by:
Old 05-21-2009, 03:50 PM   #3
pixellany
Moderator
 
Registered: Nov 2005
Location: Pasadena, CA
Distribution: Arch
Posts: 13,164
Thanked: 284
First, Machtelt Garrels is a she....

So, ps -u tells you the owner of a process, but the question was how to find the details based on what you find in /proc.

Doesn't the book also give the answer???

Starting with no information, I guess I would run ps using the PIDs from /proc, and then grep using the username.
pixellany is offline     Reply With Quote
Thanked by:
Old 05-21-2009, 04:49 PM   #4
sl33p
Member
 
Registered: Dec 2008
Location: Tahiti
Distribution: Backtrack 4 / Fedora 10 / Ubuntu 9.04
Posts: 32
Thanked: 3

Original Poster
Thanks guys!

I've joined both comments and hopefully found out the answer. Nope, the book doesn't give any answer pixellany. Do you have them somewhere?

These are the two processes my normal user were running (partial output of $ps aux | grep sl33p):


Quote:
PID TTY TIME CMD
2396 pts/0 ... bash
2483 pts/0 ... write
The related folders for those processes inside /proc are (obviously): /proc/2483 and /proc/2396.
When I access those directories I see the same files. Then I ran:

Quote:
$pstree
.
..
...
init-----gnome-terminal---bash---su---bash---write
...
..
.
and could conclude that they have the same files inside /proc folders because one is the parent (bash) of the other (write).
This might sound obvious for you senior members anyways, but it shows (as far as I understood from the book) that the write process was originated by the fork/exec process from bash. Is that correct?

PS: Shame on me, about the he/she mistake, lol!
Regards,
sl33p is offline     Reply With Quote
Old 05-21-2009, 07:51 PM   #5
sundialsvcs
Senior Member
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 2,718
Thanked: 43
Why don't you try ... ls /proc/2396 ...

... and see what you might be able to find out about process #2396?

Gosh... all those files... what happens if I try: cat /proc/2396/cmdline ...?

(I've worked with many operating systems over the years, with all kinds of funky programs doing bug-ridden things to get system-information like that. The /proc/nnnn/ system is, if I may say so, " -ing brilliant ...")

Last edited by sundialsvcs; 05-21-2009 at 07:53 PM..
sundialsvcs is offline     Reply With Quote
Old 05-21-2009, 08:32 PM   #6
Fred Caro
Member
 
Registered: May 2007
Posts: 274
Thanked: 6
lpic

side step, I am studying for the lpi 1 but the materials, and or syllabi's, are well protected: even the IBM thing seems to be directed at part 2 or the old (pre 01/04/09) exam, have you had any luck?

Fred.
Fred Caro is offline     Reply With Quote
Old 05-22-2009, 09:11 AM   #7
sl33p
Member
 
Registered: Dec 2008
Location: Tahiti
Distribution: Backtrack 4 / Fedora 10 / Ubuntu 9.04
Posts: 32
Thanked: 3

Original Poster
Well man, I'm in the same situation...

As we're gonna be almost the first ones to realize this new LPI exam, what I decided to do is to "forget" about the LPI objectives... Just trying to learn Linux essentials.
What I mean is that even if you know that they can ask you about the at command, you cannot be so sure they actually will.

If you read the books they recommend on the materials sections of the website, you can fulfill the topics and go even further because it makes you read man pages )

My test is in June 30th and I'm confident about it. After reading the book, just enforce the knowledge about the topics they list on lpi.org

God be with us.
Regards,
sl33p is offline     Reply With Quote
Old 05-23-2009, 12:11 PM   #8
Fred Caro
Member
 
Registered: May 2007
Posts: 274
Thanked: 6
Best of luck with the exam. Over catering is probably the wise move but it gals me that the LPI authorities don't give a definitive syllabus. Free to some but not all.
Fred Caro is offline     Reply With Quote
Old 05-23-2009, 12:30 PM   #9
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 561
Thanked: 37
Break the question down-
1: based upon the entries in /proc ownded by your UID
- How do you see which in here is owned by your UID?
- How can you return a sorted list of these?
2: how would you work to find out which processes these actually represent?
- Where can you get a list of processes, both with UID and Command?
- Are there tools to do this?
- Is scripting a solution a viable option?

Maybe I'll try this LPIC thingy
jamescondron is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
killing process question mokku Linux - Newbie 7 05-29-2008 07:34 PM
A process-related question BiThian Programming 4 11-07-2006 01:51 PM
Question regarding process management misbahuddin Linux - Software 2 12-05-2005 11:06 AM
Process UID Question halfpower Linux - General 1 10-03-2005 01:25 PM
process question BajaNick Linux - General 3 01-20-2004 09:30 PM


All times are GMT -5. The time now is 10:24 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration