Page Actions
Wiki Actions
User Actions
Submit This Story

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

Enter your comment
 
 
blog/2009/10/some_cli_tips.txt · Last modified: 2009/10/01 00:00 (external edit)     Back to top
Recent changes RSS feed Creative Commons License Powered by PHP Driven by DokuWiki