General
cancel
Showing results for 
Search instead for 
Did you mean: 

How does sort command work in HP UX. ?

hpnovice_1
Occasional Visitor

How does sort command work in HP UX. ?

Does it use /var file system ? and if we are sorting a very big file then do we need to have enough space in /var to complete the sort.
5 REPLIES
Zinky
Honored Contributor

Re: How does sort command work in HP UX. ?

From the HP-UX sort MAN Page:

-y [kmem] The amount of main memory used by the sort can have a
large impact on its performance. If this option is
omitted, sort begins using a system default memory
size, and continues to use more space as needed. If
this option is presented with a value, kmem, sort
starts using that number of kilobytes of memory,
unless the administrative minimum or maximum is
violated, in which case the corresponding extremum
will be used. Thus, -y 0 is guaranteed to start with
minimum memory. By convention, -y (with no argument)
starts with maximum memory.

So it likely uses whatever ulimit values for data you have (segsize?). Unsure though.

But for heavy sorting needs - you should really look at products like Syncsort.

Hakuna Matata

Favourite Toy:
AMD Athlon II X6 1090T 6-core, 16GB RAM, 12TB ZFS RAIDZ-2 Storage. Linux Centos 5.6 running KVM Hypervisor. Virtual Machines: Ubuntu, Mint, Solaris 10, Windows 7 Professional, Windows XP Pro, Windows Server 2008R2, DOS 6.22, OpenFiler
Matti_Kurkela
Honored Contributor

Re: How does sort command work in HP UX. ?

Welcome to ITRC Forums!

If you are sorting a very big file, you may need a lot of RAM/swap *and* a lot of disk space for temporary files.

If the standard environment variable TMPDIR is defined and points to a valid directory, sort uses that directory for its temporary files.

For example, if you need to sort a really big file and have a lot of free disk space at /big/empty/filesystem, you might use this command before starting the sort:

export TMPDIR=/big/empty/filesystem

If TMPDIR is not defined, sort uses /var/tmp; this is the most common case. If /var/tmp is not accessible, sort uses /tmp instead.

(You could have found this information yourself by using the command "man sort" on your HP-UX system.)

MK
MK
Terry.giblin
Frequent Advisor

Re: How does sort command work in HP UX. ?

Dear hpnovice,

"How does sort command work in HP UX. ?"

'Sort' is a very short word but a very large subject in computing.

'sorting a very big file' takes planning and will probably require at least one or more reboots, depending on your current configuration.
hpnovice_1
Occasional Visitor

Re: How does sort command work in HP UX. ?

Thanks for your response MK. It certainly did help.
hpnovice_1
Occasional Visitor

Re: How does sort command work in HP UX. ?

I have incresed the size of the /var filesystem.