37
votes
Accepted
When redirecting top to a file, why does cat command on that file display output of multiple top attempts?
Some top implementation (e.g. on OpenBSD, but presumably on some Linux systems too) detects whether its output is going to the terminal or to something that isn't a terminal (to a pipe or to a file) ...
5
votes
Accepted
Piping and input stream redirection to same command, which input does command take?
Redirections are processed from left to right, and in Bash, after pipelines (in fact, in any POSIX shell). In
cat numbers.txt | sort < words.txt
the shell first sets up sort’s (future) standard ...
3
votes
Piping and input stream redirection to same command, which input does command take?
Is it possible for one command to accept input stream from two different sources.
No; an input stream is literally just a file descriptor that someone else hands to you. Just as you only have one ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
io-redirection × 1456bash × 568
shell × 370
shell-script × 207
pipe × 207
linux × 87
stdout × 84
file-descriptors × 81
stderr × 74
command-line × 72
files × 55
cat × 50
ssh × 44
stdin × 43
zsh × 40
tee × 40
terminal × 37
output × 35
grep × 32
cron × 32
logs × 32
sudo × 29
text-processing × 28
process-substitution × 27
scripting × 25