Thursday, December 22, 2011

First session of Some of basic UNIX commands that are useful very frequently


Hi Folks,

In this blog i want to discuss some of basic unix/linux commands that are useful very frequently.

If you want to display total,used and free RAM of your machine in size of MB then run below command.

free -m

If you want to see more options that are available for this command then you can run below command

man free

Some of useful options in free command:

free -t - This option will also displays data containing the totals for physical memory and swap space along with RAM.

free -ms 5 - This option i.e. '-s' followed by an integer will display commands output i.e. total,used and free RAM in MB available in your machine for every 5 seconds.

watch free - Usage of this command is same as above but in an interval of 2 seconds. When you time this command and then press enter then a new screen will be opened and automatically refresh total,used and free available of RAM in KBs. If you press 'CTRL + C' then newly opened screen will be closed and you will be returned to your command ran screen.

watch -n 1 -d free - This is can be taken as advanced version of above command. Here '-d' option is for highlighting the changes in memory usage and '-n' is for interval. For example in this command '1' is followed by '-n' so, for every one second its going to display RAM usage in KB as we didn't mention '-m' option.

Please try these when you are free. In our next session we can discuss some other commands.

No comments: