Suppose there are hundreds of job processes running in Linux server and one of those processes creating a specific file having the prefix ‘SALES_DATA’ plus concatenating current date and time and then the extension name of the file, for example, SALES_DATA_20190312011030.csv.
Now your job is to find that process which is creating the file mentioned above. Then what will you do?
Actually, it is very simple. Every job process in Linux must be running a script which can be a shell script (.sh file), SQL script (.sql file), etc. Now what is required to be done is to find that script file because that script should be containing the prefix string.
Now you know what needs to be done, right? Yes, you can use grep command to check which file is containing that prefix (‘SALES_DATA’), so that you can find that job process running that script file.
To run grep command, goto the script directory in Linux server and give the command as shown below:
grep -il "SALES_DATA" *.*
This will list out the files having ‘SALES_DATA’ string in it. You can check more details grep command and its switches using the following link grep Manual.