LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-27-2009, 12:47 PM   #1
mr_aliagha
LQ Newbie
 
Registered: Dec 2008
Posts: 25

Rep: Reputation: 0
Question How to send command output to file?!


Hey everybody,
I am looking for a way to send command output to a file.
for example i want to send "ls" output command to file "output.txt" so i can read it in feature...
Regards.

Last edited by mr_aliagha; 02-27-2009 at 12:48 PM.
 
Old 02-27-2009, 12:53 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Use redirection. The symbol > redirect the output to a file, overwriting any previous content of the file, while the symbol >> append the output to an existing file.
Code:
$ ls > output.txt
$ ls >> output.txt
Both create the file if not existent.

Last edited by colucix; 02-27-2009 at 12:54 PM.
 
Old 02-27-2009, 01:06 PM   #3
mr_aliagha
LQ Newbie
 
Registered: Dec 2008
Posts: 25

Original Poster
Rep: Reputation: 0
Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
send output of namp scan to CSV file rsmccain Linux - Networking 11 04-18-2009 08:31 PM
Send file output to 'kill' command jkarp2112 Linux - Newbie 4 06-25-2008 05:17 PM
Make a program can collect linux command output regularly and send to a tftp server fragon Programming 2 04-07-2008 04:49 PM
IS it possible to send command output to a file as well as the screen helptonewbie Programming 6 09-16-2007 01:13 PM
Send ALL output streams to file? Nuvious Linux - General 1 04-22-2007 02:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration