Linux zoeken naar een woord in een bestand
bijvoorbeeld zoek naar 'AuditQueue_error': find . | xargs grep 'AuditQueue_error' -slAndere snelle manier. zoek naar bestand met medewerker in de naam:
find .|grep medewerker
Zoeken naar string in alle files in directorie en subdirectories
grep -r -B 2 "zoekstring" *
-r : recursive -B 2 geef ook 2 regels erboven
Zoeken of er bestanden gewijzigd zijn in een bepaalde periode
[a] access (read the file's contents) - atime
[b] change the status (modify the file or its attributes) - ctime
[c] modify (change the file's contents) - mtime
-mtime +60 means you are looking for a file modified 60 days ago.
-mtime -60 means less than 60 days.
-mtime 60 If you skip + or - it means exactly 60 days.
voorbeeld:
find mijndirectoy -mtime -50
find -L markt2_osb_dev -mtime -1 (-L symbolic links)
Vind alle tar files ouder dan 20 dagen:
find /datapump/jmp/ -name *.tar -mtime +20
Verwijder alle files ouder dan 20 dagen
find /datapump/jmp/ -name *.tar -mtime +20 -delete
Printen alle processid's van ora-processen
ps -ef | grep ora | awk '{print $2}'
Kill alle ora processen in een commando
kill -9 `ps -ef | grep ora | awk '{print $2}'`
Sorteren list op datum
ls -lt of ls -ltr
Sorteren op filenaam extensie ls -1X Sort folders op size du --max-depth=1 . | sort -n -r
Geen opmerkingen:
Een reactie posten