Category: bash

PHP Script uses bash command to find file created within mins ago

$dir = “/home/ec2-user/julius/tmp/”; $file_type = “json”; $min = “5”; #Created How Many Min Ago $output = shell_exec(“find $dir -cmin -$min -type f -name ‘*.$file_type'”); $json_file = explode(“\n”,$output); array_pop($json_file); # To remove last \n if(empty($json_file)){exit();}...

SSH Trick

How To SSH run command without key-in password again echo < password > | ssh username@host ‘sudo -S < command >’ Running Two SSH Command line for sqldump ssh -t username@host ‘mysqldump -u {DB_USER}...

Linux Grep Command

#$ grep -r –exclude-dir={path1,path2,path3,path4} -i –include=\*.php ‘ keyword ‘ /path/to/dir/ Explaination :- -r : recursive –exclude-dir=PATTERN : Exclude specific directory -i, –ignore-case ignore case distinctions –include=FILE_PATTERN : search only files that match FILE_PATTERN #Extras...