3

In a Linux Foundation course we're told to use cat & at a terminal prompt to return what appears to be the current max (used) PID. I wanted to clarify what the & parameter means but both cat --help and man cat turned up nothing for the ampersand parameter.

Snapshot for clarity:

enter image description here

Can anyone please explain what the ampersand means in this context?

Alxs
  • 2,200
  • 3
  • 21
  • 31

1 Answers1

4

The & means that you send the command to the background (also called forking), and you are given "back" the prompt even though execution of the command continues (if any).

There is a very good discussion about this in this thread.

To know what the max_pid is, you can look in /proc:

cat /proc/sys/kernel/pid_max 
32768

Or (as root):

sysctl kernel.pid_max 
kernel.pid_max = 32768
  • Cheers! So the ampersand is not not really a parameter specific to cat (explaining no mention in the docs). That helped a lot, the linked thread was useful too. Tx :) – Alxs Dec 10 '16 at 16:40
  • 1
    @Alxs No. You're right. The & can be used with any command. It is not a parameter. –  Dec 10 '16 at 16:41
  • 1
    Sending command to background != Forking, please clear up your ideas first. – heemayl Dec 11 '16 at 03:44