Help in SORT command

I am using sort command in a script but that script gives error if the generated file size is more than 4GB and it can't sort it ..i wanna know whether sort uses /tmp or /var/tmp area because i don't have 4GB space in those areaplz give me how sort command works where it create the temp file i mean while sorting..

sort uses the directory specified by the environment variable TMPDIR. If it is not set sort then uses /tmp (consult your man page for sort some may use /var/tmp). A few versions of sort accept a

-T <directory>

option as well to redirect temp files.

Hi.

The man page usually discusses how to specify the location where temporary files are placed. For example:

However, you may be running into problems with large files:

The Solaris sort knows how to deal with such files, but not all commands do.

Best wishes ... cheers, drl

tahnk u very much..