This question already has an answer here:

I googled, but it ignore the "%". all about pid.

My system is macOS.

Here's the code:

cat /usr/local/var/run/php-fpm.pid
#I got this.

#When I use vim open it. only have text "7260"

Could you tell me why ? Thank you very much.

marked as duplicate by Stephen Kitt, jasonwryan, Ulrich Schwarz, Archemar, GAD3R Sep 6 '16 at 9:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Are you using zsh? – heemayl Sep 6 '16 at 8:26
  • Yes. I use 'oh my zsh'. – godtail Sep 6 '16 at 8:28
  • First, I thought the % is about pid. Now i know the % is from ZSH. It's surely duplicated. – godtail Sep 6 '16 at 8:40

Your file doesn't finish with a newline, so Zsh appends a reverse-video % and a newline itself (both to indicate that the file doesn't end with a newline, and to avoid messing up the following prompt or losing the output entirely).

Question 3.23 of the Zsh FAQ has more detail on how to control this, as does the Zsh manual.


In Unix, the line ending is LF (\n), when a line is missing that, the next line is tacked to the current line at end as if they were a single line.

This is what happening here, the file /usr/local/var/run/php-fpm.pid got a single line with the PID and the line does not end in LF, on most shells yopu would get the next prompt tacked with the output, but here zsh is being smart and adding a % and \n indicating the line is missing a LF.


foo@bar% cat /proc/self/cmdline
foo@bar% bash
foo@bar$ cat /proc/self/cmdline 

Not the answer you're looking for? Browse other questions tagged or ask your own question.