January 1, 2010

Few linux Tips.. Its really helpful to you.

Please go through the following tips in linux. I am sure that it will helpful to you guys.


1.) Flush DNS cache in Linux

You registered a domain and you can’t access it, it may be your DNS cache that holds the problem. Here’s how to flush DNS cache in Linux

/etc/rc.d/init.d/nscd restart


2.) Find files that are older than X years using Linux

If you want to find out what files are older than - let’s say - ten years and still residing on your hard drive, do a

cd /
find . -mtime +3650

This will search for such files on all your Linux partition and display them in verbose mode at the end of the search. In this case, 3650 stands for the number of days to go back.




Limit the CPU usage of a certain application in Linux

You can do this by installing cpulimit. You can limit a certain running application either by name or by process ID:

cpulimit -e firefox -l 30

This won’t let Firefox go beyond a 30% CPU usage limit.

Limit the cpu usage by process ID

cpulimit -p 3493 -l 40

This will limit process number 3493 to 40% CPU consumption.






What uses your resources?



By using top you can find out what processes are using your resources and in what amount. Another way to do this is by executing the following command:

ps -eo pcpu,pid,user,args | sort -r -k1 | more

This will output something like

6.5 6077 user pidgin
6.5 5535 root /usr/X11R6/bin/X :0 -br -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7
6.1 7027 user transmission
5.7 6563 user /usr/lib/firefox-3.0.5/firefox
1.2 9 root [events/0]
0.7 6070 user nautilus --no-desktop --browser
0.4 29888 user gedit
0.2 6555 user /usr/lib/thunderbird/thunderbird-bin

…nicely formatted and structured.



Make the lights of your NIC blink

If you work on a large network and you get sent to the server room to check out a certain network card, you might get lost in the multitude of network hardware. To find your certain NIC, SSH to the machine in question and do a

sudo ethtool -o eth0

The lights of the network card should start blinking repeatedly.

No comments:

Post a Comment