LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux 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


Reply
  Search this Thread
Old 02-20-2016, 04:03 AM   #1
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Rep: Reputation: Disabled
Looking at processes


I opened a terminal, and ran python.
Then I open another terminal, and ran top

But I do not see a process called python.

Why does python not show up in top while it is still running in the other terminal?
How do I "make" it show up in top?
Thanks.
 
Old 02-20-2016, 04:11 AM   #2
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
Originally Posted by fanoflq View Post
I opened a terminal, and ran python.
Then I open another terminal, and ran top

But I do not see a process called python.

Why does python not show up in top while it is still running in the other terminal?
How do I "make" it show up in top?
Thanks.
It depends on how you sort the output in the top command. A more efficient way (IMHO) to get the process running Python would be like this:
Code:
ps aux | grep python
Then you will only get the processes running Python.

See: http://www.tecmint.com/12-top-comman...ples-in-linux/
Or
Code:
man top
For more information on top.

Best regards,
HMW
 
Old 02-20-2016, 05:22 AM   #3
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
Thank you.
I am already aware of using ps.

But I am trying to see if I can do it using top.

And I also do not understand why python does not
show up in top while other processes (like Chrome, Firefox, gnome-terminal, etc)
shows up in top.
 
Old 02-20-2016, 10:06 AM   #4
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Red Hat, CentOS
Posts: 773
Blog Entries: 3

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Quote:
Originally Posted by fanoflq View Post
Thank you.
I am already aware of using ps.

But I am trying to see if I can do it using top.

And I also do not understand why python does not
show up in top while other processes (like Chrome, Firefox, gnome-terminal, etc)
shows up in top.
Short answer:
Because top sorts by CPU usage as default. Now consider this:
Code:
>>> while True:
...   print("foo")
^An infinite loop that eats CPU resources.
Then my top looks like this:
Code:
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND        
 1824 HMW       20   0  401628  24404  18728 R  48,5  0,6   0:37.48 xfce4-terminal 
 2258 HMW       20   0   35444   7672   4764 S  42,5  0,2   0:33.32 python3        
 2216 root      20   0       0      0      0 S   8,3  0,0   0:04.84 kworker/3:2    
  871 root      20   0  193020  28596  12972 S   6,6  0,7   0:59.84 Xorg           
 2262 root      20   0       0      0      0 R   4,0  0,0   0:03.03 kworker/0:2    
 2267 root      20   0       0      0      0 S   4,0  0,0   0:01.21 kworker/1:2    
 2035 root      20   0       0      0      0 S   2,0  0,0   0:03.17 kworker/2:2
top normally looks like this:
Code:
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND        
  871 root      20   0  195252  28660  13036 S  12,7  0,7   1:04.24 Xorg           
 1824 HMW       20   0  401628  24404  18728 S   6,3  0,6   1:09.91 xfce4-terminal 
    1 root      20   0  176328   5388   3144 S   0,0  0,1   0:01.11 systemd        
    2 root      20   0       0      0      0 S   0,0  0,0   0:00.01 kthreadd       
    3 root      20   0       0      0      0 S   0,0  0,0   0:00.19 ksoftirqd/0    
    5 root       0 -20       0      0      0 S   0,0  0,0   0:00.00 kworker/0:0H   
    7 root      20   0       0      0      0 S   0,0  0,0   0:03.32 rcu_sched      
    8 root      20   0       0      0      0 S   0,0  0,0   0:00.00 rcu_bh
I hope that helps clarify things, at least a little.

Best regards,
HMW
 
1 members found this post helpful.
Old 02-20-2016, 08:23 PM   #5
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
You might take a look at htop, which makes it much easier to sort the top display by command name.
 
1 members found this post helpful.
Old 02-20-2016, 09:18 PM   #6
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
Doug:

Thanks.
htop is very nice!
Cool!
 
Old 02-22-2016, 01:41 AM   #7
fanoflq
Member
 
Registered: Nov 2015
Posts: 397

Original Poster
Rep: Reputation: Disabled
I looked at options for ps.
-a Select all processes except both session leaders (see getsid(2)) and processes not associated with a
terminal.
From page of man getsid :
Where getsid(p) returns the session ID of the process with process ID p.

What does session leaders mean?
What is the significance of argument 2 in getsid(2) /
 
  


Reply

Tags
processes


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Limitations of System Processes and Oracle Processes in RHEL AS3.0 sathyguy Linux - Enterprise 0 03-03-2007 12:52 AM
Too many processes CelticSoul Linux - Software 1 10-22-2005 03:09 AM
How many processes does everyone have? Furlinastis Slackware 22 09-26-2005 03:53 AM
monitoring active processes and identifying the required processes. gajaykrishnan Programming 2 08-13-2004 02:58 AM
processes nautilus_1987 Linux - Software 11 09-28-2002 07:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:11 PM.

Main Menu
Advertisement
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
Twitter: @linuxquestions
Open Source Consulting | Domain Registration