Engineers Garage

  • Projects and Tutorials
    • Circuit Design
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Components
  • Articles
    • EG Blogs
    • Insight
    • Invention Stories
    • How to
    • What Is
    • News
      • EE Design News
      • DIY Reviews
      • Guest Post
      • Sponsored Content
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • Video
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering

Linux Command To List Currently Running Processes (Part 5/15)

November 13, 2020 By Ashish Vara

Linux command to List currently Running Processes

A file is everything in Linux. When a file is executed, it is understood as a process. Process is created by another process and gets destroyed after being used. Multiple processes can run on Linux system and various commands are specified for management of process.  Each process is identified by a unique number called Process-ID (PIDwhich is allocated while the process is created. from the parentPID.If you execute any single command from shell terminal, it also creates a process. Refer the tutorial Process in Linux for more information about process.

Here I will explain various process commands which  give out the information about running process.

Ps Command (Process Status)

The ps command displays the same process attributes owned by user running command.

Open the command terminal  by typing the following command and press enter key:

            ps

The following output is displayed on screen:

PID TTY          TIME CMD

            2637 pts/1    00:00:00 bash

            5505 pts/1    00:00:00 ps

Each line displays the information like process ID (PID), terminal with which process is associated (TTY), processor time (TIME) and name of process (CMD).

here first line (expecting header line) is the process information of login shell and another line is process information of ps command.

Full listing of current running process

The full listing of current running process includes information of parent of every process and user.

Command: ps<hyphen><-f>

f option indicates the full listing

Type from command terminal:

            ps -f

The following output is displayed on screen:

UID        PID  PPID  C STIME TTY          TIME CMD

ashish    2637  2629  0 06:16 pts/1    00:00:00 bash

ashish    5647  2637  0 10:53 pts/1    00:00:00 ps –f

List of all current running and system process

The list of all current running processes includes user and system process.

Command: ps<hyphen><-e>

The -e option indicates all processes including both user and system processes.

Type from command terminal:

            ps -e

The following output is displayed on screen:

PID                 TTY                TIME                         CMD

    1                  ?                      00:00:03          init

    2                  ?                      00:00:00          kthreadd

    3                  ?                      00:00:01          ksoftirqd/0

    5608            ?                      00:00:00          kworker/u16:0

    5664            ?                      00:00:00          kworker/u16:2

    5668            pts/1                00:00:00          ps

Note: process information changes on different system according to Linux distributor.

Process belong to specific user

The system administrator can get the user activity using ps command. The ps command is provide the list of process which is associated with specific user.

Command: ps<hyphen><-u><hyphen><name of user>

The -u option displays the process of specific user.

Type from command terminal:

            ps -u ashish

Note: here ashish is the user name of system

The following output is displayed on screen:

PID     TTY          TIME       CMD

 1816   ?          00:00:00          gnome-keyring-d

 1852   ?          00:00:00          init

 1952   ?          00:00:00          dbus-daemon

 1963   ?          00:00:00          upstart-event-b

 1975   ?          00:00:00          window-stack-br

List the process based on PID or PPID

Sometimes we want to know about the child process associated with specific parent process where they are born. The option –ppid used for child process information of specific parent id and –pid option provide the full information of specific child process.

 Command: ps<hyphen><–ppid or –pid><hyphen><PPID or PID of process>

Type from command terminal:

            ps –ppid 1

Note: here 1 is main system process which is the parent of various child processes.

The following output is displayed on screen:

PID     TTY          TIME       CMD

  264    ?          00:00:00          upstart-udev-br

  271    ?          00:00:00          systemd-udevd

  403    ?          00:00:00          dbus-daemon

  446    ?          00:00:00          systemd-logind

  457    ?          00:00:00          rsyslogd

  459    ?          00:00:00          bluetoothd

  531    ?          00:00:01          avahi-daemon

  634    ?          00:00:00          ModemManager

  663    ?          00:00:00          upstart-file-br

Now, enter the command for specific child process information in full format:

            ps -f  –pid 634

The following output is displayed on screen:

UID        PID PPID C STIME TTY     TIME      CMD

root          634    1     0    09:47     ?        00:00:00  /usr/sbin/ModemManager

Tree structure of process

Processes are associated with each other in hierarchical manner. Each process can be the parent of child process or child process of parent process. The system administrator can get the process tree based on PID.

Command: pstree<hyphen>PID of process>

Type from command terminal:

            ps –ppid 1

Note: here 1 is main system process which is the parent of various child processes.

The following output is displayed on screen:

init─┬─ModemManager───2*[{ModemManager}]

     ├─NetworkManager─┬─dhclient

     │                ├─dnsmasq

     │                └─3*[{NetworkManager}]

     ├─accounts-daemon───2*[{accounts-daemon}]

     ├─acpid

     ├─avahi-daemon───avahi-daemon

     ├─bluetoothd

     ├─colord───2*[{colord}]

     ├─cron

     ├─cups-browsed

     ├─cupsd

     ├─cupsd───dbus

Note: process information changes on different system according to Linux distributor.

Related Articles Read More >

Screenshot of Raspbian OS on Raspberry Pi
RPi Python Programming 03: Raspberry Pi as Linux System
Raspberry Pi Models
RPI Python Programming 02: Raspberry Pi Models
Raspberry Pi 4
RPi Python Programming 01: Introduction to Raspberry Pi 4
RPi Python Programming 05: Introduction to Python

Featured Tutorials

  • Screenshot of Raspbian OS on Raspberry Pi RPi Python Programming 03: Raspberry Pi as Linux System
  • Raspberry Pi Models RPI Python Programming 02: Raspberry Pi Models
  • Raspberry Pi 4 RPi Python Programming 01: Introduction to Raspberry Pi 4
  • RPi Python Programming 05: Introduction to Python
  • RPi Python programming 04 RPi Python programming 04: Setting up Raspberry Pi Linux computer
  • Python Basics RPi Python Programming 06: Python basics

Stay Up To Date

Newsletter Signup

EE Training Center Classrooms

“ee

“ee

“ee

“ee

Recent Articles

  • New Vishay Semiconductors increase efficiency of high-frequency applications
  • TI launches industry’s top wireless battery-management solution
  • AVX releases new series of embedded, highly sensitive Wi-Fi antennas
  • Nuvoton offers a secure storage MCU for multi-segments
  • Refrigerator Compressor Design Achieves High Energy Efficiency Ratings Using a Digital Signal Controller (DSC)
...

RSS EDABOARD.com Discussions

  • Rippe current rating of aluminium electrolytic capacitor is very low.
  • Why do some op amps have a higher GBW than what the unity gain-bandwidth is?
  • Stacked Diodes ?
  • dsPIC33f ADC reading voltage help
  • What the best way to store data of size ( 90,000 * 32) bit (taken from a text file) using VHDL?

RSS Electro-Tech-Online.com Discussions

  • Engine Temperature using an AD590 on the Oil Pressure Wire to the engine
  • Automotive 6 Volt Generator Transistor Voltage Regulator
  • Jon's Imaginarium - Microchip FilterLab Program and Graph Paper Printer Program by Dr. Philippe Marquis
  • Touch circuit sound, led. 555 timer
  • Dust extractor remote switch
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2021 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Circuit Design
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Components
  • Articles
    • EG Blogs
    • Insight
    • Invention Stories
    • How to
    • What Is
    • News
      • EE Design News
      • DIY Reviews
      • Guest Post
      • Sponsored Content
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • Video
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering