> ## Content Index
> Fetch the complete content index at: https://itsfoss.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Get Process Name From PID in Linux
- URL: https://itsfoss.com/linux-process-name-pid/
- Published: 2023-10-31T12:41:42.000Z
- Updated: 2023-10-31T12:41:42.000Z
- Description: Learn to get the process name from the PID of a process in this quick Linux tip.
- Author: Sagar Sharma
- Tags: Quick Tip, #hide

While listing the active processes in the background, it may not show the name of the process and will only show you the PID of the process.

And if you are curious to know the name of the process, then you can use the ps command in the following manner:

```
ps -p <Enter_PID> -o comm=
```

In the above command, make sure to replace `<Enter_PID>` with the PID of your process.

Want more details? Here you have it.

## How to get the process name from PID

In this section, I will walk you through a detailed explanation of how I used the ps command to get the process name. 

Also, I will show you how you can find a process name directly using the `pidof` command later in this tutorial.

So let's start with the breakdown of the ps command. 

First, let's have a look at the output you get when you use the ps command in the following manner:

```
ps -p <Enter_PID> -o comm=
```

For example, here, I used the PID `4416`, so here's the end command I have to use:

```
ps -p 4416 -o comm=
```

![Use the ps command to know the process name from PID](https://itsfoss.com/content/images/2023/10/Use-the-ps-command-to-know-the-process-name-from-PID.png)

As you can see, the PID indicated that the process name was `firefox-bin`.

Now, let's break it down for better understanding:

- `ps`: The ps command which is used to get information about running processes.
- `-p <Enter_PID`: The `-p` flag is used to specify the PID of the process and you append the PID with it.
- `-o comm=`: This part is used to format the output with the ps command. Specifically, when you pair the `-o` flag with the `comm==` (an abbreviation for command), it shows the name of the executable associated with the process.

Pretty cool. Right?

But how would you know the actively running processes? Use the ps command with the `-ef` flag as shown:

```
ps -ef
```

![Use of ps command to list actively running processes](https://itsfoss.com/content/images/2023/10/Use-of-ps-command-to-list-actively-running-processes.png)

Pretty cool. Right?

But what if you want to know the PID using the process name only? Well, in that case, you can use the `pidof` command in the following manner:

```
pidof exact_process_name
```

For example, if I want to know the PID of firefox, then I will use the following:

```
pidof firefox
```

![Find the PID using process name in Linux](https://itsfoss.com/content/images/2023/10/Find-the-PID-using-process-name-in-Linux.png)

That was easy. 

## Here's how to master the Linux command line 

Beginner to the terminal? Let me share some tips to [embrace the terminal](https://itsfoss.com/love-thy-terminal/).

First, start with the [basic Linux commands](https://learnubuntu.com/top-ubuntu-commands/?ref=itsfoss.com) to get the hang of how you perform basic tasks in the terminal:

[25 Must-Know Ubuntu CommandsNew to Ubuntu? Here are the must know Ubuntu commands that will help you get control on the system more effectively in the terminal.![](https://learnubuntu.com/assets/icon-192x192.png?v=c525bdf48a)Learn UbuntuSagar Sharma![](https://learnubuntu.com/content/images/2023/05/best-ubuntu-commands.png)](https://learnubuntu.com/top-ubuntu-commands/?ref=itsfoss.com)

Once done, you can refer to [our tutorial series "Terminal Basics"](https://itsfoss.com/tag/terminal-basics/) where we have covered how you perform basic tasks like copying files, changing directories, etc:

[Linux Command Tutorials for Absolute BeginnersNever used Linux commands before? No worries. This tutorial series is for absolute beginners to the Linux terminal.![](https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png)It's FOSS![](https://itsfoss.com/content/images/2023/03/terminal-basics-series-tag.png)](https://itsfoss.com/tag/terminal-basics/)

I hope you will find this guide helpful.