Pregunta

I'm working my way through a unix tutorial. Contrary to the expectations bestowed upon me by the tutorial when I enter the command

wc -1

I get the following

wc: illegal option -- 1
usage: wc [-clmw] [file ...]

Can anyone explain this and how i can use wc -1 to determine how many users are logged in

¿Fue útil?

Solución

maybe it was

wc -l

l for larry not number 1.

Otros consejos

Maybe you misreaded wc -l (lowcase L, not number one), which counts the number of lines of standard input.

To count the number of users logged in, use this:

users | wc -l

| is a special symbol of the shell, that redirects the standard output of the first command to the standard input of the second, by using Unix pipes.

(users prints the list of logged in users to standard output.)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top