The following script is meant to output "vmstat" for example every 15 seconds, but for some reason it only does this if there's activity or when I kill the script, in other cases it just sits there.
#!/bin/bash
#!/bin/sh
ps -ef | grep -v grep | grep "vmstat 15" | awk '{ print $2 }' | xargs kill
ps -ef | grep -v grep | grep "iostat 15" | awk '{ print $2 }' | xargs kill
ps -ef | grep -v grep |
Hello,
My objective is to make a tar file (a backup) of all files smaller then 5M.
This file should exclude file in the backup/YY subdirectory and all hidden
files. Some of the file name contain whitespaces.
I attempted this with the commands below. This resulted in an
empty archive. Taking it piecemeal grep isn't working correctly.
I have a malware on my server.
So I've figured out how to find all that malicious files
grep -r --include*.php "Some String from files" .
That seems work fine!
but how to delete them?
I've tried using xargs
grep -r --include=*.php "FilesMan" .
I'm trying to find all files that are of a certain type and do not contain a certain string. I am trying to go about it by piping find to grep -v
example:
find -type f -name '*.java' | xargs grep -v "something something"
This does not seem to work. It seems to be just returning all the files that the find command found.
Hi,
I have created a shell script for Server Log Automation Process. I have used
find xargs grep command to search the string.
for Example,
Code:
find -name | xargs grep "816995225" > test.txt
.
Here my problem is,
We have lot of records and we want to grep the string 4-5 times.
I found an SO called using Find/Grep to search files between specific time of day
Based on that and a Unix SE called Grep command to find files containing text string and move them I ended up with:
find . -type f -mtime -20 | grep -v -e " \(0[012345]\|18\|19\|2[0123]\)" | xargs mv -t daytime/
But it's moving ALL the files.
My desired outcome is the following: to recursively search a directory looking for a given string in all found files. The following command is my usual port of call:
find ./ | xargs grep -ns 'foobar'
However, when foobar has quotes the command fails and gives me a > prompt in the shell.
I didn't change httpd.conf after installation of apache2, so it looks like .htaccess-files are enabled by default, because if I generate a .htaccess-file with garbage in it, I find an "invalid command" for the .htaccess-file in the error.log.
I have a directory of lots of .PDF and .JPG files.
There should be a .JPG file for each .PDF with the same name.
I'm trying to use a command to find .PDF files that doesn't have a .JPG file.