Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.