moodLearning Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux-commandline-tips [2017/05/08 05:59]
serbizadmin
linux-commandline-tips [2019/05/28 16:29] (current)
serbizadmin [Maintenance]
Line 1: Line 1:
-  ​* looking for duplicate filenames in 2 directories +~~NOTOC~~ 
-   ​fdupes --recurse dir1/ dir2/  +====== Find  Stuff====== 
-  * find a word in a file  +  ​* looking for **duplicate** filenames in 2 directories 
-   ​grep -rnw '/​path/​to/​files/'​ -e "​pattern"​+<​code>​ 
 +fdupes --recurse dir1/ dir2/ </​code>​ 
 +  * find a **word** in a file  
 +<​code>​ 
 +grep -rnw '/​path/​to/​files/'​ -e "​pattern"​</​code>​ 
 +  * find all **socket** files your system runs 
 +<​code>​ 
 +find / -type s 
 +</​code>​ 
 +  * find the latest file in a folder/​subfolder 
 +<​code>​ 
 +find . -type f -printf '%T@ %P\n' | sort -n | awk '​{print $2}' 
 +</​code>​ 
 +====== Differences====== 
 +  * between files, showing side by side 
 +<​code>​ 
 +diff -y file1 file2 | less 
 +</​code>​ 
 +  * differences of files between directories 
 +<​code>​ 
 +diff <(ls -a /dir1/) <(ls -a /dir 2/) 
 +</​code>​ 
 +or compare  
 +<​code>​ 
 +comm <(ls -a /dir/) <(ls -a /dir2/) 
 +</​code>​ 
 +\\ 
 +====== Maintenance======
   * kill a process wholesale   * kill a process wholesale
-   kill $(ps aux | grep "​$process_term"​ | grep -v '​grep'​ | awk '​{print $2}')+<​code>​ 
 +kill $(ps aux | grep "​$process_term"​ | grep -v '​grep'​ | awk '​{print $2}')</​code>​ 
 +  * trim log. example: 
 +<​code>​ 
 +cat /dev/null > modsec_audit.log</​code>​ 
 +See also "log rotate"​ on mL wiki. 
 +  * remove everything else except... 
 +<​code>​ 
 +rm -rf !(filename)</​code>​ 
 +This works only if extglob is enabled. So 
 +<​code>​ 
 +shopt -s extglob</​code>​ 
 +\\ 
 +====== PHP====== 
 +  * View php config 
 +<​code>​ 
 +php -r "print phpinfo();"​ | grep "​.ini"​ 
 +</​code>​ 
 +or  
 +<​code>​ 
 +php -i | grep in 
 +</​code>​