Skip to content

Linux

Linux – grep

Display filenames only: grep -l dba *.trc          (lowercase letter l as switch) Display filenames and matches grep -H dba *.trc Recursively find files and executes grep on each: find . -name “*.trc*” -exec -l dba… 

Linux – Memory

Linux free command info Play with Linux memory watch -d=cumulative vmstat -d # disk watch -d=cumulative vmstat -a # free active and inactive memory

Powershell – Recursive Search for Strings in Files

To search for a string (grep) in files recursively with Powershell (example): gci -recurse -include *.sql|%{gc $_} | %{$_|select-string “dba”} To get the filename(s): gci -recurse -include *.txt|%{$Filename=$_;gc $_} | %{$res=$_|select-string “dba”;if ($res) {Write-Host “$Filename”}}