grep is wrong tool, use
find with correct options
If you do
stat /var/run you'll quickly find out that
/var/run is symlink to
$ stat /var/run
File: /var/run -> /run
Size: 4 Blocks: 0 IO Block: 4096 symbolic link
Device: 801h/2049d Inode: 696874 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-02-07 13:17:01.225178554 +0800
Modify: 2017-12-18 20:44:12.898113636 +0800
Change: 2017-12-18 20:44:12.898113636 +0800
So you really need
/run directory instead. As for searching files with specific filename, you need
$ find /run -name "*.pid"
Because some files in that directory belong to root or other system users, you may need to use that command with
Alternatively, you can use
-L flag to allow following symlinks and call
$ find -L /var/run -name "*.pid"
Please note also, that
grep is wrong tool for the job.
grep is for searching text patterns inside text files, not in their filenames.
You also mentioned:
/var/run stores the processes running in the system and it has files with pid extension
That's actually incorrect. Process information belongs in
.pid files are simply used by some programs to prevent multiple copies of same process running (well, one of possible ways these files can be used). See this stackoverflow post for reference, as well as this highly voted answer on unix.se. While the directory belongs to root user, please don't assume that it's for startup and daemon apps only; scripts initiated with root permissions by user could write to the directory just as easily.