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.

There has been several situations where I needed to save the output of a given command line directly to a text file.

Is there a way to save the output of any command line I run on Terminal into a text file ?

share|improve this question

marked as duplicate by Sylvain Pineau, Radu Rădeanu, Aditya, Florian Diesch, Avinash Raj May 22 at 2:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
command > /path/file.txt –  Avinash Raj May 21 at 6:27

2 Answers 2

up vote 1 down vote accepted

Try

command > file

Example

dir > something.txt

Output from command will be in file

share|improve this answer

Try

Command > output.txt

Output from command will be in file

Exmaple

ls -ld > output.txt

Multiple command in same file.

command >> output.txt

Exmaple

mdkir -p dir1/dir2/dir2 > output.txt
share|improve this answer

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