Domanda

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

È stato utile?

Soluzione

maybe it was

wc -l

l for larry not number 1.

Altri suggerimenti

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.)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top