Some CLI tips
Some tips I collected through the web.
tips
# 去掉配置文件里的注释 egrep -v '^[[:space:]]*(#|$)' .or. sed '/ *#/d; /^ *$/d' #做http url链接 echo $1 | sed -e h -e 's@/@\\@g' -e G -e 's@\([^\n]*\)\n\(.*\)@\1@' #Python 自带当前目录的Http Server python -m SimpleHTTPServer #寻找所有不可读的文件 find -type f ! -perm -444 #寻找不可访问的目录 find -type d ! -perm -111 #Tar拷贝目录下的所有文件到目录/where/to/并保持文件属性 ( cd /copy/from && tar -c . ) | ( cd /copy/to/ && tar -x -p ) #Tar拷贝目录到远程目录并保持文件属性 ( tar -c /copy/from ) | ssh -C user@remote 'cd /copy/to/ && tar -x -p'

Discussion