Question: I use SSH to connect to Linux, maybe run a Linux script multiple times, and use nohup to suspend these processes, and then close the SSH connection. After the next SSH connection to Linux, how can I distinguish between different scripts and get different PIDs?

This Linux script will always print content on the screen. I use Python's paramiko library, SSH to Linux, run the script and use nohup to suspend the process and redirect the output to the file. This process may be multiple times. How to distinguish the starting process, find its PID and kill it. It is best not to modify the Linux script because the script is not written by me.

I use the script name to find the process number, get a lot of PIDs, I can't distinguish them.

Answer: 
You could parse the output of [`ps -eo pid,lstart,cmd`](https://www.shellhacks.com/linux-ps-command-get-process-start-time-date/) which shows the process id, start time and path, e.g.:

```
  PID                  STARTED CMD
    1 Mon Jun 19 21:31:08 2017 /sbin/init
    2 Mon Jun 19 21:31:08 2017 [kthreadd]
    3 Mon Jun 19 21:31:08 2017 [ksoftirqd/0]

```

== Edit ==

Be aware that if the remote is macOS the `ps` command does not recognize the `cmd` keyword, use `comm` or `command` instead, e.g.: `ps -eo pid,lstart,comm`
Use ps command to check running process.
For checking only shell scripts , You an do something like this:-

```
ps -eaf |grep .sh

```

This will give you all the information about running shell scripts only, easily you can distinguish b/w running scripts.

In place of ".sh" you can give file name also, than you will get information only about that running file.