pidof Command in Linux with Examples Last Updated : 26 May, 2022 Comments Improve Suggest changes Like Article Like Report pidof command is used to find out the process IDs of a specific running program. It is basically an identification number that is automatically assigned to each process when it is created. Syntax: pidof [options] program1 program2 ... programNWorking with Pidof Command 1. To find pid of any process pidof bash Use the name of the program as input to the command and command produced bash process ID in the output. 2. To get only one pid of a program pidof -s bash By default, pidof displays all pids of named command or program. So to display only one process ID of the program we have to pass "-s" option with it. 3. To get pids of scripts pidof -x bash The pidof command does not display pids of shell/perl/python scripts. We use the "-x" option to find the process ids of shells running the named script called bash. 4. To limit output based on the root directory pidof -c bash If we want that pidof returns only process ids that are running with the same root directory, we use "-c" command-line option. Note: This option is ignored for non-root users, as they are unable to check the current root directory of processes they do not own. 5. To omit processes pidof -o 87223 bash If we want to ignore or omit processes with that process id, we can use pidof command to this. This is useful to ignore calling shell or shell script or specific pid. Here, it says we want to find all pids of bash and omit pid #87223. So, we use the given code for that. 6. To find pid of a program and kill it p=$(pidof chrome) kill $p In this, firstly we find all PIDs of chrome server and then kill it. Comment More info K khu5h1 Follow Improve Article Tags : Technical Scripter Linux-Unix linux-command Linux-system-commands Explore Linux/Unix Tutorial 10 min read Getting Started with LinuxWhat is Linux Operating System 10 min read LINUX Full Form - Lovable Intellect Not Using XP 2 min read Difference between Linux and Windows 7 min read What are Linux Distributions ? 8 min read Difference between Unix and Linux 5 min read Installation with LinuxHow to Install Arch Linux in VirtualBox? 7 min read Fedora Linux Operating System 12 min read How to install Ubuntu on VirtualBox? 6 min read How to Install Linux Mint? 3 min read How to Install Kali Linux on Windows? 2 min read How to Install Linux on Windows PowerShell Subsystem? 2 min read How to Find openSUSE Linux Version? 2 min read How to Install CentOS 2 min read Linux CommandsLinux Commands 15+ min read Essential Unix Commands 7 min read How to Find a File in Linux | Find Command 9 min read Linux File SystemLinux File System 12 min read Linux File Hierarchy Structure 6 min read Linux Directory Structure 6 min read Linux KernelLinux Kernel 4 min read Kernel in Operating System 3 min read How Linux Kernel Boots? 11 min read Difference between Operating System and Kernel 3 min read Linux Kernel Module Programming: Hello World Program 7 min read Linux Loadable Kernel Module 7 min read Loadable Kernel Module - Linux Device Driver Development 4 min read Linux Networking ToolsNetwork configuration and troubleshooting commands in Linux 5 min read How to configure network interfaces in CentOS? 5 min read Command-Line Tools and Utilities For Network Management in Linux 8 min read Linux - Network Monitoring Tools 4 min read Linux ProcessProcesses in Linux/Unix 6 min read How to Manage Process in Linux 4 min read Getting System and Process Information Using C Programming and Shell in Linux 2 min read Process states and Transitions in a UNIX Process 4 min read Linux FirewallLINUX Firewall 7 min read iptables command in Linux with Examples 7 min read How to Configure your Linux Firewall - 3 Methods 12 min read Shell Scripting & Bash ScriptingIntroduction to Linux Shell and Shell Scripting 8 min read What is Terminal, Console, Shell and Kernel? 5 min read How to Create a Shell Script in linux 7 min read Shell Scripting - Different types of Variables 4 min read Bash Scripting - Introduction to Bash and Bash Scripting 12 min read Bash Script - Define Bash Variables and its types 12 min read Shell Scripting - Shell Variables 6 min read Bash Script - Difference between Bash Script and Shell Script 4 min read Shell Scripting - Difference between Korn Shell and Bash shell 3 min read Shell Scripting - Interactive and Non-Interactive Shell 3 min read Shell Script to Show the Difference Between echo â$SHELLâ and echo â$SHELLâ 4 min read Like