《linux程序设计》阅读后的疑问。

AIGPTchina 2012-09-19 11:02:40
1、kill HUP 1234 这个HUP是什么意思?
2、kill -l 1234>killout.txt 2>killerr.txt 这个l是什么意思?
3、kill -l 1234>killout txt 2>&l 最后一个l是什么意思?2>&l 是配套用的?
4、通过管道连接的进程可以同时运行,它是怎么做到的?并随着数据流在它们之间的传递可以进行自动协调?
是怎么做到的?

5、more命令是干什么的?分页显示?more命令可以接受文件名为参数?具体表现,实例。

6、ps-xo comm 这个-xo comm是代表什么意思?

7、grep 后面的参数 是l 还是数字1.代表什么意思?
8、fi是什么意思?done又是什么意思?done代表这个shell 结束输入吗?
9、你使用shell变量来处理每个文件,以使该脚本自动化文档化。这句话是什么意思?
...全文
74 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2012-09-19
  • 打赏
  • 举报
回复
楼主不会用--help参数和man命令。
qq120848369 2012-09-19
  • 打赏
  • 举报
回复
1、kill HUP 1234 这个HUP是什么意思?
向进程号1234的进程发送SIGHUP信号(终端挂断信号,默认由终端挂断时向终端关联会话的前台进程组发送)

2、kill -l 1234>killout.txt 2>killerr.txt 这个l是什么意思?

你打错了吧, 是kill -1吧, 意思是发送数值为1的信号给1234进程,kill命令的标准输出与标准错误分别重定向到killout和killerr两个文件. (信号1是SIGHUP)

3、kill -l 1234>killout txt 2>&l 最后一个l是什么意思?2>&l 是配套用的?

>killout相当于1>killout, 即重定向标准输出到Killout文件。 2>&1是描述符的dup2操作,你可以man dup2了解一下C实现方法, 这里2>&1表示dup2(1,2), 即将2重定向到1,其中2是标准错误,所以接下来标准错误和标准输出都将输出到killout文件。

4、通过管道连接的进程可以同时运行,它是怎么做到的?并随着数据流在它们之间的传递可以进行自动协调?

先pipe再fork, 描述符将会被子进程继承, 因此父子进程可以通过管道交换数据.

5、more命令是干什么的?分页显示?more命令可以接受文件名为参数?具体表现,实例。

这个问题太幼稚了, 自己man more, man less

6、ps-xo comm 这个-xo comm是代表什么意思?

x的用法:

x Lift the BSD-style "must have a tty" restriction, which is imposed upon the set of all processes when some BSD-style options are used or when the ps
personality setting is BSD-like. The set of processes selected in this manner is in addition to the set of processes selected by other means. An
alternate description is that this option causes ps to list all processes owned by you (same EUID as ps), or to list all processes when used together
with the a option.

o用法(自定义输出格式):

o format specify user-defined format. Identical to -o and --format.

KEY LONG DESCRIPTION
c cmd simple name of executable
C pcpu cpu utilization
f flags flags as in long format F field
g pgrp process group ID
G tpgid controlling tty process group ID
j cutime cumulative user time
J cstime cumulative system time
k utime user time
m min_flt number of minor page faults
M maj_flt number of major page faults
n cmin_flt cumulative minor page faults
N cmaj_flt cumulative major page faults
o session session ID
p pid process ID
P ppid parent process ID
r rss resident set size
R resident resident pages
s size memory size in kilobytes
S share amount of shared pages
t tty the device number of the controling tty
T start_time time process was started
U uid user ID number
u user user name
v vsize total VM size in kB
y priority kernel scheduling priority


7、grep 后面的参数 是l 还是数字1.代表什么意思?


-l, --files-with-matches
Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the
first match.

即只输出第一个匹配的文件,grep [options] [-e PATTERN | -f FILE] [FILE...] 你可以看到grep后面的FILE...表示可以输入多个文件。

8、fi是什么意思?done又是什么意思?done代表这个shell 结束输入吗?
if fi
do done
这个问题太幼稚。

9、你使用shell变量来处理每个文件,以使该脚本自动化文档化。这句话是什么意思?
脚本进行文本处理的意思。






一句话总结, 楼主看的书是垃圾, 名气大, 作用小。 请看《UNIX环境高级编程》
冷月清晖 2012-09-19
  • 打赏
  • 举报
回复
9、你使用shell变量来处理每个文件,以使该脚本自动化文档化。这句话是什么意思?

这句的意思是指你要自动化处理,肯定得用到变量吧?后面就讲解shell变量怎么使用。
冷月清晖 2012-09-19
  • 打赏
  • 举报
回复
4、通过管道连接的进程可以同时运行,它是怎么做到的?并随着数据流在它们之间的传递可以进行自动协调?
是怎么做到的?

linux在这方面做得很不错,至于怎么做到的你要分析linux内核的源码了。

其他问题貌似帮助都能查到,或者你google。

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧