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

有帮助吗?

解决方案

maybe it was

wc -l

l for larry not number 1.

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top