Tag Archives: LINUX

Increasing number of threads per process

There is no direct limit on number of threads a process can have. Rather, this is calculated using following formula:

number of threads = total virtual memory / (stack size*1024*1024)

Thus, the number of threads per process can by increasing total virtual memory or by decreasing stack size. Decreasing stack size can lead to code failure due to stack overflow while max virtual memory is equal to the swap memory.

Check you machine:

Total Virtual Memory: ulimit -v (default isĀ unlimited, thus you need to increase swap memory to increase this)

Total Stack Size: ulimit -s (default is 8Mb)

Command to increase these values:

ulimit -s newvalue

ulimit -v newvalue

replace new value with the value you want to put as limit.

How to increase swap memory?


Tagged , , , , , , , , , , , , , , ,

Running C curl code on LINUX/UBUNTU

Apart from default installations following is required:
apt-get update
apt-get install libcurl4-openssl-dev

How to run the code?
gcc code_filename -l curl -o compiled_filename

– l is used to link the compiler with curl. This shall make sure there is no curl.h import error.


Tagged , , , , ,

Email via UNIX Command


mail -s “subject” to-email@id.com -a “Reply-To” <<“Your Message”


Press enter to change line, ‘\n’
etc wont work


mail -s “URLBroker Process Failure” utsav.sabharwal@nextag.com,jyadav@nextag.com -a “”<<< “Hie Team”

Tagged , , , , ,

LINUX Basic Commands

Count a string in many files without opening them

cat * | grep -c string

Count the number of files in a directory

ls -l . | egrep -c ‘^-‘

Compressing a file in tar.bz2 format

tar jcvf .tar.bz2 dir1 dir2 file1 file2 …

Decompressing a fileĀ in tar.bz2 format

tar -xjvf example.tar.bz2

All files and directory would be compressed in the same folder

Counting Number of files in a folder

ls | wc -l


What exactly is bash?