Questions tagged [output]
382 questions
221
votes
7 answers
Pass the output of previous command to next as an argument
I've a command that outputs data to stdout (command1 -p=aaa -v=bbb -i=4).
The output line can have the following value:
rate (10%) - name: value - 10Kbps
I want to grep that output in order to store that 'rate' (I guess pipe will be useful…
Paul
- 2,211
- 2
- 12
- 3
107
votes
4 answers
Save all the terminal output to a file
Is there some way of saving all the terminal output to a file with a command?
I'm not talking about redirection command > file.txt
Not the history history > file.txt, I need the full terminal text
Not with hotkeys !
Something like terminal_text >…
user78927
78
votes
10 answers
Converting colored output into html
There are tools providing coloured output:
dwdiff -c File1 File2 # word level diff
grep --color=always # we all know this guy
...
The question is: How to convert their colored output of arbitrary program into coloured html file?
Other output…
Grzegorz Wierzowiecki
- 13,865
- 23
- 89
- 137
70
votes
5 answers
how to output text to both screen and file inside a shell script?
Currently I have a shell script which logs messages to a log file like this:
log_file="/some/dir/log_file.log"
echo "some text" >> $log_file
do_some_command
echo "more text" >> $log_file
do_other_command
When executing this script, there is no…
jurchiks
- 803
- 1
- 7
- 5
42
votes
6 answers
Append to a pipe and pass on?
I have a simple bash function dividing two numbers:
echo "750/12.5" | bc
I'd like to take the output from bc and append /24 and pipe said result to another instance of bc.
Something like:
echo "750/12.5" | bc | echo $1 + "/24" | bc
Where $1 is the…
Philip Kirkbride
- 9,816
- 25
- 95
- 167
40
votes
6 answers
How do I add newlines between lines printed on the command line?
Mail logs are incredibly difficult to read. How could I output a blank line between each line printed on the command line? For example, say I'm grep-ing the log. That way, multiple wrapped lines aren't being confused.
xenoterracide
- 57,918
- 74
- 184
- 250
32
votes
2 answers
Pausing terminal output
I have a command which outputs lots of data (say, strace with lots of syscalls, running for a few minutes).
Is there any option (e.g. command wrapper or something similar) that would allow me to pause the output of the command (just the output on…
syntagma
- 12,091
- 21
- 57
- 74
28
votes
5 answers
Can zsh access the stdout of last run program?
I often use find or locate to find out about paths.
(~) locate foobar.mmpz
/home/progo/lmms/projects/foobar.mmpz
The next step is often to open or otherwise manipulate the files. In a happy case like above, I can do this:
(~) ls `!!`
ls `locate…
mike3996
- 1,539
- 1
- 13
- 17
23
votes
5 answers
Pipe the output of a command if it is successful
INPUT_FILE=`ls -rt $MY_DIR/FILE.*.xml | head -1 | xargs basename`
I wanted to execute the second command (head -1) only if the first command is successful. How do I improve this command?
Govind Kailas
- 1,331
- 1
- 10
- 16
23
votes
3 answers
Capture all the output of a script to a file (from the script itself)
I have a bash script that calls various commands and prints some output (both from the called commands themselves, such as git pull, and informative messages generated by the script itself such as Operation took XX minutes.
I'd like to capture the…
Dr. Gianluigi Zane Zanettini
- 512
- 1
- 5
- 9
23
votes
3 answers
How to prevent random console output from breaking the terminal?
There are many questions on SE that show how to recover from terminal broken by cat /dev/urandom. For those that are unfamiliar with this issue - here what it is about:
You execute cat /dev/urandom or equivalent (for example, cat…
rr-
- 983
- 1
- 8
- 16
22
votes
2 answers
What prevents stdout/stderr from interleaving?
Say I run some processes:
#!/usr/bin/env bash
foo &
bar &
baz &
wait;
I run the above script like so:
foobarbaz | cat
as far as I can tell, when any of the processes write to stdout/stderr, their output never interleaves - each line of stdio…
Alexander Mills
- 9,330
- 19
- 95
- 180
19
votes
4 answers
Why does this 'at' command not print to the standard output?
I am a relative Linux novice. I am trying to learn how to use at so that I can schedule tasks to begin at a later time, without using sleep. I have been looking at this previous question for help.
My question is, in the following sample bash…
Andrew
- 16,315
- 34
- 73
- 77
19
votes
4 answers
dd: write to multiple disks?
I have 2 exactly same formatted, same size and same brand SD-cards.
I would like to dd image to /dev/disk2 and to /dev/disk3 at the same time.
Pseudocode
sudo dd bs=1m if=/Users/masi/2016-05-10-raspbian-jessie.img of={/dev/disk2,/dev/disk3}
How…
Léo Léopold Hertz 준영
- 6,788
- 29
- 91
- 193
18
votes
3 answers
Where does the output of `at` and `cron` jobs go?
Where does standard output from at and cron tasks go, given there
is no screen to display to?
It's not appearing in the directory the jobs were started from, nor in
my home directory.
How could I actually figure this out given that I don't know how…
Michael Durrant
- 41,213
- 69
- 165
- 232