-1

First - i wanted to know how many process are currently running so i used this command:

$ ps | wc

i was expecting to one number, but the output was:

20 115 844

Three numbers were printed - with a space in the size of 'tab' between them.

what are those numbers mean? are they somehow related to the different 'aux' i can use with ps? probably this is not one long number - that will mean my OS run over 20M process...

Thanks!

1
  • Welcome on the Unix SE! Note, "I" is written always in uppercase on English. – peterh Nov 4 '18 at 22:07
2

The wc man page says that it:

Print newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified. With no FILE, or when FILE is -, read standard input.

Meaning those three numbers are the number of lines (20), words (115), and bytes (844) in the ps output.

If you only want the number of lines, use:

ps | wc -l
0
-1

The command man wc would explain exactly what the wc command does when not given any options on the command line.

It may contain something like

DESCRIPTION

The wc utility shall read one or more input files and, by default, write the number of <newline> characters, words, and bytes contained in each input file to the standard output.

(taken from the POSIX specification of this standard utility)

This means that the numbers that you see are the number of newline characters (or "lines"), the number of words (by some definition of "word" that possibly depends on your locale) and the number of bytes in the output of ps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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