My linux cheat sheet

Dima

Search files containing string

grep -rnw ./ -e "string"

Totally override destination with source

rsync -avh --delete (--dry-run) /path/to/source/ /path/to/destination/

Find services that uses specific file

#Quick way, process id list
fuser /path/to/file

#Versatile way, more info list
lsof /path/to/file

What files does specific process id uses

lsof -p 12345 

What files does process name(s) use

lsof -c apache2 -c mysqld

Leave a Reply

Your email address will not be published. Required fields are marked *