I used top command to print this on Linux box:
[root@localhost ~]# top top - 23:38:38 up 361 days, 12:16, 2 users, load average: 0.09, 0.06, 0.01 Tasks: 129 total, 2 running, 126 sleeping, 1 stopped, 0 zombie Cpu(s): 0.0% us, 0.2% sy, 0.0% ni, 96.5% id, 3.4% wa, 0.0% hi, 0.0% si Mem: 2074712k total, 1996948k used, 77764k free, 16632k buffers Swap: 1052248k total, 1052248k used, 0k free, 331540k cached
I am not sure what Swap:0k
free means in the last line.
Is this normal behavior for a linux box to have value of 0
Linux divides its physical RAM (random access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory and the swap space is the amount of virtual memory available.
If you really want more than 1gb (this is a lot) then you can create a file with the command
dd and make Linux use that file for swap (usually a partition is used for swap).
This will create a 2gb swap file and activate it:
dd if=/dev/zero of=/swapfile bs=1M count=2048 chmod 600 /swapfile mkswap /swapfile swapon /swapfile
Then put this in /etc/fstab:
/swapfile none swap defaults 0 0
Swap is ‘the same’ as ‘virtual memory/pagefile’ in windows. It is stuff that ought to be in RAM if possible, but must be put on disk either cause there isn’t enough RAM or because the programmers just made the program use swap to be extra careful (makes things a bit slower even in last case).