Skip to content

Tag: unix

Irregular result in zombie example

I have problems with understanding the behavior of this code: When running in a Unix shell I get this result: But sometimes its only giving me this result without any shell prompt: I know it can be solved with wait() function in parent process. But I like to know: Why is result irregular? Could someone please…

a program to alert when /var files system usage reaches threshold

I am working on a program which will send an snmp alert when /var reaches maximum threshold. I am having trouble with calculating % of /var disk usage for this. I have this command “du -hs /var” which give me usage of /var in MB and /var is in the /root directory. So to calculate total disk on whi…

Check the parameter already in server

How to check the already set parameters in Linux/Oracle. For example, as soon as I login to Linux if I type cd $AU_TOP, it directly goes to the path set in AU_TOP. Now I want to see like AU_TOP what are the other parameters is there. Answer If typing cd $AU_TOP take you to some directory – Means you hav…

Print grep Keyword if grep find a match

I have an input file Input.txt with the following sample keywords: I also have a file Text.txt to search such as: I want to print grep Keyword followed by a match if the grep finds a match. The desired output: Answer With awk you could do something like this: In a more readable format it would be:

Get last 30 minutes from log file

I have a log file that contain logs as follows 1486307866.155 is the time in unix format with corresponds to 2017-02-05 07:17:46 (Format : Y-m-d H:i:s) I need a unix command that give me the logs within last 30 minutes in the following format and discarding any details that i don’t need. 2017-02-05 07:1…