免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2389 | 回复: 7
打印 上一主题 下一主题

[系统管理] Linux wc指令 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-11-09 14:07 |只看该作者 |倒序浏览
那位大神帮忙看看这条命令那错了ps -aux | wc -l?
我执行完提示错误信息Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
177。
大神帮忙指点一下啊,谢了。

论坛徽章:
4
午马
日期:2013-09-27 17:46:50CU十二周年纪念徽章
日期:2013-10-24 15:41:34双子座
日期:2014-02-11 18:27:382015年辞旧岁徽章
日期:2015-03-03 16:54:15
2 [报告]
发表于 2012-11-09 14:13 |只看该作者
重定向到一个文本再统计呢

ps -aux > ps.txt
wc -l ps.txt

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
3 [报告]
发表于 2012-11-09 15:03 |只看该作者
[chenyx@5250 ~]$ ps aux | wc -l
95
[chenyx@5250 ~]$ ps -aux | wc -l
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
95

我的也是这样.

论坛徽章:
0
4 [报告]
发表于 2012-11-09 16:07 |只看该作者
ps aux

man ps


Note that "ps -aux" is distinct from "ps aux". The POSIX and UNIX standards require that "ps -aux" print all processes owned by a user
       named "x", as well as printing all processes that would be selected by the -a option. If the user named "x" does not exist, this ps
       may interpret the command as "ps aux" instead and print a warning. This behavior is intended to aid in transitioning old scripts and
       habits. It is fragile, subject to change, and thus should not be relied upon.

论坛徽章:
21
白羊座
日期:2013-08-23 15:49:17金牛座
日期:2013-10-08 17:00:03处女座
日期:2013-10-12 11:54:11CU十二周年纪念徽章
日期:2013-10-24 15:41:34午马
日期:2013-11-27 14:07:21巨蟹座
日期:2013-12-04 10:56:03水瓶座
日期:2013-12-04 15:58:00亥猪
日期:2014-05-24 16:02:3115-16赛季CBA联赛之辽宁
日期:2016-11-07 13:52:53戌狗
日期:2013-08-23 16:15:31白羊座
日期:2013-08-24 21:59:24巨蟹座
日期:2013-08-25 16:34:24
5 [报告]
发表于 2012-11-09 17:16 |只看该作者
  1. ps aux | wc -l
复制代码

论坛徽章:
0
6 [报告]
发表于 2012-11-09 18:06 |只看该作者

       wc - print the number of newlines, words, and bytes in files
也就是说WC这个命令只能对文件进行统计

论坛徽章:
33
荣誉会员
日期:2011-11-23 16:44:17天秤座
日期:2014-08-26 16:18:20天秤座
日期:2014-08-29 10:12:18丑牛
日期:2014-08-29 16:06:45丑牛
日期:2014-09-03 10:28:58射手座
日期:2014-09-03 16:01:17寅虎
日期:2014-09-11 14:24:21天蝎座
日期:2014-09-17 08:33:55IT运维版块每日发帖之星
日期:2016-04-17 06:23:27操作系统版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-24 06:20:0015-16赛季CBA联赛之天津
日期:2016-05-06 12:46:59
7 [报告]
发表于 2012-11-09 20:46 |只看该作者
ps aux 是没有 "-"的.

Linux的 ps 支持两种风格的参数, 有些带 "-", 有些不带"-", 具体的可以man ps 查看一下, 我不记得太多了.

论坛徽章:
0
8 [报告]
发表于 2012-11-20 16:24 |只看该作者
不是WC的问题,是PS -aux的问题。 不应该加-  ,应该是ps aux
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP