做个备份,以备不时之需 :D
//found all files end with bak and remove all these files
find -iname "*.bak" | xargs --no-run-if-empty rm
//check core file path
cat /proc/sys/kernel/core_pattern #//sysctl kernel.core_pattern
//retrieve content of keyword before & after 5 line
grep -A5 -B5 'keyword.*' $log | less
//diff file in linux
for file in $(ls $direcotry); do
str="$file"
#echo $str
#echo "===========$file";
diff <(sort $directory1) <(sort directory2) > out
done
cat a b | sort | uniq -u
//vi
crtl+f next page
crtl+b pre page
?word search word up
/word search word down
n: continue search the key
u: page up
gg:go to top
shift+g:go to end
#replace content -- replace abc with 123
%s#abc#123#g
//count file under specific path
ls -lR $directory | grep "^-" | wc -l
//count folder under specific path
ls -lR /$directory | grep "^d" | wc -l
//the 4th field splited by '|' in traget file and then count how many time this value appeared.
cut -d\| -f4 $fileName | uniq -c
//windows terminate hanging process
netstat -noa #find particular process id
taskkill /F /pid 8404
//grant particular user permission to tagret folder
setfacl -m u:username:rwx /temp
//add user
useradd -d /directory -g group chroot -s /bin/false username
//change password
echo username | passwd --stdin passwd