How to collect all output in one file?

0 votes

I want to know how to redirect output in linux from the screen to a file? i know it has something to do with using ">" operator?

Mar 1, 2019 in Linux Administration by DragonLord999
• 8,400 points
71 views

1 answer to this question.

0 votes

You can use 2> to redirect it:

foo > stdout.txt 2> stderr.txt

and if you want it in the same file just:

foo > allout.txt 2>&1

This only works in (ba)sh. If you're using a different shell, look for the syntax.

answered Mar 1, 2019 by ajs3033
• 7,280 points

Related Questions In Linux Administration

–1 vote
1 answer

How to get octal file permission in linux?

You can use this: stat -c "%a %n" ...READ MORE

answered Jan 3, 2019 in Linux Administration by Omkar
• 69,060 points
249 views
0 votes
1 answer

How to extract file base name without path and extension in bash?

You don't actually have to call the ...READ MORE

answered May 31, 2019 in Linux Administration by Shubham
• 13,380 points
1,093 views
0 votes
1 answer

How to create one new partition in my hard disk in Linux?

Hi@akhtar, To create new partition you can follow ...READ MORE

answered Apr 7 in Linux Administration by MD
• 21,340 points
36 views
0 votes
1 answer

How to create one crontab job in Linux?

Hi@akhtar, To configure crontab in your system, you ...READ MORE

answered May 13 in Linux Administration by MD
• 21,340 points
43 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How do I set variable if a specific package version is installed in CFEngine?

Here is what you can do.Just use packagesmatching to ...READ MORE

answered Jul 12, 2018 in Other DevOps Questions by Atul
• 10,240 points
141 views
+1 vote
3 answers
0 votes
1 answer

how to loop through the content of a file using bash

One of the ways to do it ...READ MORE

answered Feb 15, 2019 in Linux Administration by ajs3033
• 7,280 points
346 views
0 votes
1 answer

How t find httpd.conf file in apache?

First f all, get apache's path: $ ps ...READ MORE

answered Feb 27, 2019 in Linux Administration by ajs3033
• 7,280 points
128 views