Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 09-04-2003, 04:45 PM   #1
Registered: Apr 2003
Location: Shandong province China
Distribution: fedora core 1.0
Posts: 206

Rep: Reputation: 30
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.

Last edited by Xiangbuilder; 09-04-2003 at 04:47 PM.
Old 09-04-2003, 04:48 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 68
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
Old 09-04-2003, 05:44 PM   #3
Registered: Apr 2003
Location: Shandong province China
Distribution: fedora core 1.0
Posts: 206

Original Poster
Rep: Reputation: 30
Thank you.
All the three method of looking for files are useful to me.
All are my need.
Old 09-04-2003, 07:47 PM   #4
Senior Member
Registered: Feb 2003
Location: N'rn WI -- USA
Distribution: Kubuntu 8.04, ClarkConnect 4
Posts: 1,142

Rep: Reputation: 47
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.


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
Mozilla 1.7 - No File Save / File Open dialogs on Slackware 10.0 jayseye Slackware 8 08-10-2004 05:52 AM
cutting down contents of text file kam_kenneth Linux - Newbie 2 05-22-2004 01:16 AM
showing contents of a tar.Z file jpostma Linux - General 1 11-12-2003 05:14 AM
Delete contents of the file, but not file? mikeshn Linux - General 9 05-28-2003 06:47 AM
List the contents of a directory to a file MasterC Linux - General 19 11-26-2002 10:09 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:21 PM.

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