LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-20-2012, 03:05 AM   #1
SkM007
LQ Newbie
 
Registered: Jun 2011
Distribution: Oracle, BackTrack
Posts: 28

Rep: Reputation: Disabled
How to Copy Terminal Output to a File


I am using backtrack & a particular s/w (fierce) generates a lot of output on the terminal. I actually want to get this entire output to a txt file but i don't know how to do it. I know i can redirect the output to a file but i dn't want to do it for every command. also the output is very large (varies from 50 - 1000 lines based on the command) that most of the time i can't do copy-paste thing, as earlier commands are not visible (i hope u understood)
if u'll use putty or HT in windows, it has options by which all the activities on the terminal can be saved in txt file.

is there anything i can do???
 
Old 04-20-2012, 07:03 AM   #2
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
If you're using the terminal then the only option is to direct the output of commands in files.
 
Old 04-20-2012, 11:39 AM   #3
ratotopi
Member
 
Registered: Dec 2011
Posts: 114

Rep: Reputation: 6
use the tee command eg
ls -l /root | tee /tmp/rootls
this will out put your command to screen and files but if you want to create file only then do
ls -l /root >> /tmp/rootls
 
Old 04-20-2012, 12:01 PM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 19,878

Rep: Reputation: 6734Reputation: 6734Reputation: 6734Reputation: 6734Reputation: 6734Reputation: 6734Reputation: 6734Reputation: 6734Reputation: 6734Reputation: 6734Reputation: 6734
maybe the script command is what you are looking for
 
Old 04-20-2012, 04:49 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,641

Rep: Reputation: 3551Reputation: 3551Reputation: 3551Reputation: 3551Reputation: 3551Reputation: 3551Reputation: 3551Reputation: 3551Reputation: 3551Reputation: 3551Reputation: 3551
Use of fierce.

"It provides different techniques to gather information about your victim."
 
Old 04-20-2012, 04:53 PM   #6
unkn(0)wn
Member
 
Registered: Aug 2011
Distribution: Slackware 14, Debian 7.0.0 Wheezy, Windows 7, Windows 8
Posts: 117

Rep: Reputation: Disabled
just use ">" between output command and desired filename.

eg. if you want output of a.out in file output.txt, use
Quote:
./a.out > output.txt
and to append use ">>"

hope it helps!

Last edited by unkn(0)wn; 04-20-2012 at 04:59 PM.
 
Old 04-21-2012, 05:43 AM   #7
SkM007
LQ Newbie
 
Registered: Jun 2011
Distribution: Oracle, BackTrack
Posts: 28

Original Poster
Rep: Reputation: Disabled
Ok, then i m left with the option of redirecting & appending the output

anyway, thanks everyone
 
Old 01-01-2016, 03:55 PM   #8
aim.dubey@gmail.com
LQ Newbie
 
Registered: Jan 2016
Posts: 2

Rep: Reputation: Disabled
Save console output in a file:

By-the-way, it was an informative session for me and basically from this, what I learned is given as follow:

A) "tee" command
user@admin:~ $ ps -ax >> processes_info
Saves, all the output of cmd "ps -ax" into a file named as "processes_info" in "tmp" folder. It automatically creates file "processes_info"

user@admin:~$ ps -ax | tee processes_info
It's do the same as above but "tee" cmd also display the output on the console simultaneously.

B) "script" command
user@admin:~$ script my_console_output.txt
This creates a file named as "my_console_output.txt" and will open a subshell and records all information through this session.
After this, script get started and whatever the console output, it will get stored in the file "my_console_output.txt";

unless and until the script ends when the forked shell exits. (e.g., when the user types "exit" or when "CTRL-D" is typed.)

user@admin:~$ script -c "ps ax" processes_info.txt
It starts the script; creates the file "processes_info.txt"; store console output into file; end the script.

Other example:
script -c 'echo "Hello, World!"' hello.txt

Thanks & Regards
Amit
 
1 members found this post helpful.
Old 01-02-2016, 10:31 PM   #9
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
Using your email address as a forum ID is a bad idea.
 
Old 01-03-2016, 10:06 AM   #10
aim.dubey@gmail.com
LQ Newbie
 
Registered: Jan 2016
Posts: 2

Rep: Reputation: Disabled
Kindly suggest me how to change this

Quote:
Originally Posted by sgosnell View Post
Using your email address as a forum ID is a bad idea.
Hello Sir,

I tried to alter it, but don't find the exact location. Could you help in this.
Kindly suggest me how to change this.
 
Old 01-03-2016, 04:17 PM   #11
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
Delete the account, and make a new one. There may be other ways, but that's probably the easiest.
 
  


Reply

Tags
backtrack, terminal


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
copy/paste output from shell (not terminal) bluegospel Linux - Newbie 13 07-21-2010 01:37 PM
file copy by terminal manomohan Ubuntu 6 05-29-2007 09:44 PM
file copy by terminal manomohan Linux - Networking 1 05-24-2007 07:04 AM
Redirect terminal output to file AND terminal shan Linux - General 3 09-29-2006 08:36 AM
Copy output of Terminal Buffer tryangle Debian 2 08-08-2005 04:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:40 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
Open Source Consulting | Domain Registration