小编Sam*_*Sam的帖子

为什么发出相同的命令可以在 tty 中创建比在 pts/gnome-terminal 中更多的输出?

侏儒终端:

$ sudo update-grub
[sudo] password for user: 
Generating grub configuration file ...
Found background image: .background_cache.png
Found linux image: /boot/vmlinuz-3.16.0-4-amd64
Found initrd image: /boot/initrd.img-3.16.0-4-amd64
done
Run Code Online (Sandbox Code Playgroud)

从tty1由作为访问Ctrl+ Alt+ F1

$ sudo update-grub
[sudo] password for user: 
Generating grub configuration file ...
Found background image: .background_cache.png
Found linux image: /boot/vmlinuz-3.16.0-4-amd64
Found initrd image: /boot/initrd.img-3.16.0-4-amd64
[ 1603.545926] EXT4-fs (sda2): unable to read superblock
... (repeats twice)
[ 1603.560671] FAT-fs (sda2): invalid media value (0x4c)
... (repeats once)
[ …
Run Code Online (Sandbox Code Playgroud)

tty gnome-terminal stdout stderr

11
推荐指数
1
解决办法
458
查看次数

`cat` 的 I/O 模型与其他实用程序的 I/O 模型有何不同?

stdbuf --help(GNU)的输出:

Usage: stdbuf OPTION... COMMAND
Run COMMAND, with modified buffering operations for its standard streams.
...

NOTE: If COMMAND adjusts the buffering of its standard streams ('tee' does
for example) then that will override corresponding changes by 'stdbuf'.
Also some filters (like 'dd' and 'cat' etc.) don't use streams for I/O,
and are thus unaffected by 'stdbuf' settings.
Run Code Online (Sandbox Code Playgroud)

我很困惑在这种情况下“I/O 流”的确切定义是什么,以及它cat具体如何适用。如果它不使用标准 I/O 流,那么它使用什么?相关的手册页和网络搜索未能提供进一步的洞察力。

io text-processing cat stdout stdin

5
推荐指数
2
解决办法
150
查看次数

将 stderr 全局重定向到 /dev/null 后的不可见提示

学习TLDP 的高级 Bash 脚本指南我无法在 debian 9 的 bash 4.4.12 中重建以下 shell 输出,包括 tty 和 pts:

bash$ lsof -a -p $$ -d0,1,2
COMMAND PID     USER   FD   TYPE DEVICE SIZE NODE NAME
 bash    363 bozo        0u   CHR  136,1         3 /dev/pts/1
 bash    363 bozo        1u   CHR  136,1         3 /dev/pts/1
 bash    363 bozo        2u   CHR  136,1         3 /dev/pts/1


bash$ exec 2> /dev/null
bash$ lsof -a -p $$ -d0,1,2
COMMAND PID     USER   FD   TYPE DEVICE SIZE NODE NAME
 bash    371 bozo        0u   CHR …
Run Code Online (Sandbox Code Playgroud)

bash debian io-redirection

3
推荐指数
1
解决办法
411
查看次数