Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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 '14 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.

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

2 Answers 2

up vote 1 down vote accepted


command > file


dir > something.txt

Output from command will be in file

share|improve this answer


Command > output.txt

Output from command will be in file


ls -ld > output.txt

Multiple command in same file.

command >> output.txt


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.