LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to save the shell's contents to a file? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-save-the-shells-contents-to-a-file-89325/)

Xiangbuilder 09-04-2003 04:45 PM

How to save the shell's contents as a file?
 
After I run the command, locate gaim,
the information in shell is very long, I only can see the last part of the information.
How to save the information in shell as a file?
In that case I can see the complete information.
Thank you.

david_ross 09-04-2003 04:48 PM

You could use:
locate gaim > /tmp/locate_gaim.out

But it is probably easier to pipe the info into less:
locate gaim | less

If you are looking for the execuatable file try:
whereis gaim

Xiangbuilder 09-04-2003 05:44 PM

Thank you.
All the three method of looking for files are useful to me.
All are my need.

ranger_nemo 09-04-2003 07:47 PM

You can also pipe long screen prints through grep to run a search.

cat /home/longfile | grep nemo

This would print out the longfile, but not to the screen, to grep, which then searches longfile for the word nemo. Everytime it finds it, it prints out only that line.

To use it in your example, if you knew the file gaim was in a bin directory, of which there are several on your system, then you could use...

locate gaim | grep bin

If there is a dir named "gaim", and you run a simple "locate gaim", it will list every file and sub-dir and file in the gaim dir. With the grep, it will only list files that also have "bin" in them.

If I "locate apache" on my server, it lists 65 lines. If I "locate apache | grep bin", then it only lists 2.


All times are GMT -5. The time now is 11:56 AM.