我正在审查 unix 管理员提出的一组面试问题;我找到了一个名为“命名管道”的主题。
我用谷歌搜索了这个话题;在某种程度上我已经能够理解它:-命名管道 || 先进先出
但我仍然觉得我缺乏什么时候使用这种特殊类型的管道的知识。是否存在未命名管道无法工作的特殊情况?
我使用以下两个命令来产生相同的结果:-
[root@localhost ~]# grep line comments
The line should start with a single quote to comment in VB scripting.
Double slashes in the beginning of the line for single line comment in C.
[root@localhost ~]#
[root@localhost ~]# grep line <comments
The line should start with a single quote to comment in VB scripting.
Double slashes in the beginning of the line for single line comment in C.
[root@localhost ~]#
Run Code Online (Sandbox Code Playgroud)
如果这两种方法中的任何一种相互替代,请向我解释任何优点/缺点。
为什么建议/etc/sudoers
使用visudo
命令编辑文件?这是该文件的示例:
## Sudoers allows particular users to run various commands as
## the root user, without needing the root password.
##
## Examples are provided at the bottom of the file for collections
## of related commands, which can then be delegated out to particular
## users or groups.
##
## This file must be edited with the 'visudo' command.
Run Code Online (Sandbox Code Playgroud)
有什么特殊原因吗?
我有这两个文件:-
[root@localhost base_filters]# cat aix_old
joe
amadeus
image
bill
juliet
charlie
romeo
ftp
[root@localhost base_filters]# cut -d: -f1 passwd2
henry
amadeus
image
bill
julie
jennifer
charlie
romeo
harry
Run Code Online (Sandbox Code Playgroud)
我试图找出两个文件之间的差异;所以我使用以下命令:-
[root@localhost base_filters]# cut -d: -f1 passwd2 | sort | diff `sort aix_old` -
Run Code Online (Sandbox Code Playgroud)
但是收到以下错误:
diff: extra operand `charlie'
diff: Try `diff --help' for more information.
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用另一个临时文件来对内容进行排序,aix_old
但我不想要另一个临时文件;所以尝试了命令替换。
任何想法,我可能做错了什么。
[root@localhost ~]# ps aux | grep ata
root 19 0.0 0.0 0 0 ? S 07:52 0:00 [ata/0]
root 20 0.0 0.0 0 0 ? S 07:52 0:00 [ata_aux]
root 1655 0.0 2.6 22144 13556 tty1 Ss+ 07:53 0:18 /usr/bin/Xorg :0 -nr -verbose -auth /var/run/gdm/auth-for-gdm-t1gMCU/database -nolisten tcp vt1
root 3180 0.0 0.1 4312 728 pts/0 S+ 14:09 0:00 grep ata
[root@localhost ~]# ps aux | grep ata | cut -d" " -f 2
[root@localhost ~]#
Run Code Online (Sandbox Code Playgroud)
我希望输出中的第二列;但没有得到任何东西。有任何想法吗 ?
我正在努力学习tcpdump
。我运行了以下命令:-
tcpdump -i eth0 -lnXs1600 host google.com and port 80
Run Code Online (Sandbox Code Playgroud)
并得到以下结果:-
2:23:45.781779 IP 10.16.30.28.42957 > 173.194.36.65.http: Flags [S], seq 3301439566, win 5840, options [mss 1460,sackOK,TS val 212804497 ecr 0,nop,wscale 5], length 0
0x0000: 4500 003c dbdf 4000 4006 64ad 0a10 1e1c E..<..@.@.d.....
0x0010: adc2 2441 a7cd 0050 c4c7 f84e 0000 0000 ..$A...P...N....
0x0020: a002 16d0 a18e 0000 0204 05b4 0402 080a ................
0x0030: 0caf 2391 0000 0000 0103 0305 ..#.........
12:23:45.782354 IP 173.194.36.65.http > 10.16.30.28.42957: Flags [S.], seq …
Run Code Online (Sandbox Code Playgroud)