EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login

PS command in Linux

By Priya PedamkarPriya Pedamkar

Home » Software Development » Software Development Tutorials » Linux Tutorial » PS command in Linux

PS command in Linux

Introduction to PS command in Linux

Linux process control could be implemented using the commands PS, kill, Bg, fg, jobs, nice, renice, grep and top . By using these commands any background daemon our program process can be effectively managed. The PS command is the process command which lists running processes and Damons and it is similar to task manager in Windows.

Syntax for PS command:

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

ps -[options]

Options Available for PS command

Common PS option available:

Option Working
1 e e option it displays running Daemons.
2 f with the F option it displays processes with full options.
3 l with the L option it would list more information on those processes.
4 ef we were to combine e and F together that would display all processes and Daemons on all TTYS.
5 a a would list all processes that run on terminals.
6 x X would list all processes that do not run on terminals.
7 aux we were to combine a U and X that would list all processes running on or off terminals and it would format the results with additional information similar to a long listing.

Examples of PS command in Linux

Given below are the examples:

Example #1

Code:

ps

Output:

ps command in linux 1

Explanation:

  • Here, we get a basic process ID or ped you TTY it runs on remember there seven we can do all F 1 to F 6 for a command prompt on alt f7 4x Windows or GUI you know the time in this case that the process is taken on the CPU and the command that’s running so in this case it’s the bourne-again shell.

Example #2

Code:

ps **

Output:

ps command in linux 2

Explanation:

  • Type in PS and we may know that pull up a man page or even if we put in bad syntax like a couple of asterisks it’ll give us a list of switches and things.

Example #3

Code:

ps a

Output:

ps a

Example #4

Code:

ps u

Output:

ps u

Example #5

Code:

ps aux|less

Output:

ps command in linux 5

Example #6

Code:

ps -f

Output:

ps -f

Explanation:

  • We could do PS with the F option it just gives us a little bit more info.
  • Again if we just go through this first part the user ID who’s running the process this is the pid the process ID and later when we couple this with the kill command we’ll need to know the pid for any process to be able to kill it or to send it to the background sometimes depends on what you will do with that the ppid is the parent process ID what happens is in the Bourne shell the bourne-again shell in this case bash.
  • Whenever you launch a process or a program it basically goes into a wait state and creates another shell and that show will turn around and launch that program and then when it’s done that shell as you know the child shell has its own built-in kill command kills itself and then it goes back to the parent or the parent process ID and the weight function is then complete and then the parent process ID will kind of give the cursor or the console back.
  • Snapshot has user ID in this case, the process ID, the parent process ID ppid the next option is the amount of CPU utilization in this case it’s negligible what’s being used at time at the time it started ,TTY,TIME is the you know in this case the time that the processes have taken up on the CPU which again it’s negligible and then following the command itself so just the bourne-again shell and the process command right now um not counting background demons and things that are written in the background.

Example #7

Code:

ps -ef

Output:

ps command in linux 7JPG

Explanation:

  • Here we wanted to display all processes and Daemons then F would be processes so that might be a useful come in there if you’re looking for a particular process.

Example #8

Code:

ps -l

Output:

ps command in linux 8JPG

Explanation:

  • If we want to list more information we can do PSL which will give me even more information on a process.
  • If we do that then this first column here the F stands for a flag and in this case if it’s four then that’s the root user in this case is then the next one here s is the process state and there are several states possible that is S for sleeping R for running Z for a zombie state in a zombie state the process is waiting for the parents who release it T that process could be stopped or it could be being traced by another process or W the process has no contents and memory so several different options there under state the UID 1000 again and the group of the user running the process, PPID is the process ID C is still the CPU utilization PR is the process priority so sort of the level of niceness that it’s running under now in the UNIX or Linux world the lower you know the priority that the higher the priority in other words.
  • So in other words zero as the highest and 127 would be the lowest in terms of priority the nice value and if that’s zero then they both have you know what the default nice value whatever they were launched under but if that were negative twenty you know the lower the number it has a much greater chance of gaining a higher priority and I say chance it’s not guaranteed but in a time slicing fashion as it shares CPU cycles with other demons and processes.
  • If that were nice the negative twenty would have a higher priority on the other hand if that were a positive 19 it would have a much lower chance of getting a high priority all right so the priority itself is different from the actual nice value which you know it is related to or does affect the priority and again we’ll take a look at that in greater detail in a moment we’re just going through the basics of the process commit right now um.
  • Let’s look at the next field the address is the memory address of the process okay and then the next field is the size of the process of memory WCHAN is what the process is waiting for while sleeping again the TTY to terminal and time is the time the process has taken on the CPU and command is the individual command process.

Recommended Articles

This is a guide to PS command in Linux. We have seen how we can see process and it information using PS command. Here we discuss the introduction, options available for PS command, and examples. You may also have a look at the following articles to learn more –

  1. du Command in Linux
  2. Linux Route Command
  3. SCP Command in Linux
  4. Linux tee Command

Linux Training Program (16 Courses, 3+ Projects)

16 Online Courses

3 Hands-on Projects

160+ Hours

Verifiable Certificate of Completion

Lifetime Access

Learn More

0 Shares
Share
Tweet
Share
Primary Sidebar
Linux Tutorial
  • Linux Commands
    • CAT Command in Linux
    • PS command in Linux
    • Mkdir Command in Linux
    • rmdir command in Linux
    • mv command in Linux
    • Linux rm Command
    • CHMOD Command in Linux
    • Zip Command in Linux
    • Linux Route Command
    • SCP Command in Linux
    • du Command in Linux
    • Less Command in Linux
    • Copy Command in Linux
    • Head Command in Linux
    • Help Command in Linux
    • Linux History Command
    • hostname Command in Linux
    • GREP Command in Linux
    • Linux Curl Command
    • Linux List Users
    • Linux List Directories
    • Linux Directory Permissions
    • Find Directory Linux
    • Linux User Permission
    • Linux Add User
    • Linux Delete User
    • Linux uniq
    • Linux Filter Commands
    • Linux sort Command
    • Linux Sort by Size
    • Remove dir Linux
    • Linux tr Command
    • Linux Touch Command
    • Linux More Command
    • Linux Cal Command
    • Linux OD
    • Linux Zcat
    • Linux tracepath
    • Linux Sleep
    • Linux bg Command
    • Linux WC
    • Linux Read
    • Linux Write
    • Linux Rename Command
    • Linux Free Command
    • Linux tac
    • Linux Shred
    • Linux wget
    • Linux Date
    • Linux Untar
    • Linux JQ
    • Linux Xargs
    • Linux Mount Command
    • Linux mdadm
    • Linux comm
    • Linux tee Command
    • Tail Command in Linux
    • Linux gzip
    • Linux Directory Structure
    • Linux Alias Command
    • Linux Inode
    • Linux Ping
    • Linux Watch Command
    • Linux Split Command
    • Linux Size
    • Linux Network Stack
    • Linux Diff Command
    • Vim Command in Linux
    • Linux nslookup
  • Basic
    • Introduction to Linux
    • What is Linux
    • Careers in Linux
    • How to Install Linux
    • How to Install Ubuntu
    • How to Install Ubuntu Server
    • How To Install Debian
    • Advantage Of Linux
    • What is Raid in Linux
    • What is Raid 5?
    • Raid 5 vs Raid 6
    • Careers in Linux Administration
    • What is Shell in Linux?
    • Bash Shell in Linux
    • Linux Emulator
    • Linux Operators
    • Linux Apps
    • Linux Keyboard Shortcuts
    • Linux Crontab
    • What is Raid Storage
    • What is Vmware
    • What is RedHat
    • What is Debian
    • Uses of Ubuntu
    • Career In RedHat
    • Linux Distributions
    • Linux From Scratch
    • Linux Format
    • Cheat Sheet Linux
  • Advanced
    • Install VMware
    • Install GRUB
    • Chown Command in Linux
    • Linux Network Command
    • Configuring Linux Network Environment
    • DNS Configuration in Linux
    • Linux Users
    • Create User in Linux
    • DHCP Server in Linux
    • FTP Server in Linux
    • Linux Regular Expression
    • IP Command in Linux
    • Set IP Address in Linux
    • Tar Command in Linux
    • Dynamic Host Configuration Protocol
    • Linux Kill Signals
    • Linux File Permissions
    • Linux File System
    • Linux Create File
    • Linux Concatenate Files
    • Linux Join
    • Linux Process Management
    • Linux Proxy Server
    • Linux System Commands
    • Linux System Logging
    • NFS in Linux
    • Linux LVM
    • Linux Repository
    • Samba Server in Linux
    • Top Commands in Linux
    • Types of Shells in Linux
    • Shell Script Types For Linux
    • GCC Command in Linux
    • Monolithic Kernel
    • YARN Package Manager
    • Linux Sed Replace
    • Linux List Groups
    • Linux Container
    • Linux Find File by Name
    • Create Folder in Linux
    • Linux Move Folder
    • Linux Error Codes
    • Linux Automount
    • Linux HugePages
  • Kali Linux
    • Install Kali Linux
    • Kali Linux Uses
    • Kali Linux Commands
    • Kali Linux Repository
    • Kali Linux Packages
    • Kali Linux root password
    • Kali Linux Alternative
  • Interview Questions
    • Linux Interview Questions
    • Linux System Administration Interview
    • Red Hat Interview Questions

Related Courses

Kali Linux Training

Linux Training Course

Red Hat Training Course

Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

© 2020 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA Login

Forgot Password?

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you
Book Your One Instructor : One Learner Free Class

Let’s Get Started

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

Special Offer - Linux Training Program (16 Courses, 3+ Projects) Learn More