Useful Linux commands

To search for any string with a directory and its sub folders

 

find . -type f -exec grep ‘string to search here’  {} \; -print

find . -type f -exec grep -i ‘string to search here’ {} \; -print

find . -type f -exec grep -i ‘ferns todo’ {} \; -print

You may need to add {} again when pasting in linux due to ascii isssue.

 

Mysql backup

First store the username/password in ~/.my.cnf
[mysqldump]
user = mysqluser
password = secret

mysqldump -u [DB-NAME] -h localhost [DBNAME] >/home/xxxxx/public_html/xxxx/mysqlback`date +\%A`

 

FTP to remote server – command line

curl -T todo25.tar ftp://girishg.net –user user:passwd

curl -T todo25.tar ftp://girishg.net/public_html/girishg.net/ –user user:passwd

Method 2

vi ~/.netrc

machine girishg.net
login xxxxx
password xxxx

chmod 0600 ~/.netrc

$> echo put [filename] |ftp girishg.net

 

more info

Automated File backup and FTP to remote server using cron