Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How do I save the output of a command to a file?

Is there a way without using any software? I would like to know how.

share|improve this question
    
No sorry i didn't . i will try next time –  led-Zepp Feb 14 at 19:58
add comment

2 Answers

up vote 8 down vote accepted

Yes it is possible, just redirect the output to a file:

someCommand > someFile.txt  

Or if you want to append data:

someCommand >> someFile.txt

If you want stderr too use this:

someCommand &> someFile.txt  

or this:

someCommand &>> someFile.txt
share|improve this answer
    
This answer will not save stderr. Use &> , see stackoverflow.com/questions/637827/… and tldp.org/LDP/abs/html/io-redirection.html –  bodhi.zazen Feb 14 at 20:17
    
@bodhi.zazen I am aware of that, but perhaps I should fix it. –  Seth Feb 14 at 20:34
    
@bodhi.zazen Updated. –  Seth Feb 14 at 21:35
add comment

You can pipe the command output to a file:

your_command >/path/to/file

Or append the command output to a file

your_command >>/path/to/file
share|improve this answer
    
Thanks a lot ! is there any Limits ? like the max size of the file ? –  led-Zepp Feb 14 at 19:55
1  
The max file size is just limited through the file system –  chaos Feb 14 at 19:59
    
This answer will not save stderr. Use &> , see stackoverflow.com/questions/637827/… and tldp.org/LDP/abs/html/io-redirection.html –  bodhi.zazen Feb 14 at 20:16
1  
The OP never asked to save stderr –  chaos Feb 14 at 20:18
1  
xD, if that's the thing: script is also a software. You can use a pencil if you don't want to use software =) –  chaos Feb 14 at 21:14
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.