I am using python command
import commands
tmp = "my command" #any command like ls
status, output = commands.getstatusoutput(tmp)
It works perfectly. Now i have few commands which may take more than 5 seconds or stuck forever. I want to kill such commands after 5 second. Any pointers.