Tips of Linux commands

# 文件按行逆序输出
tail -r filename

# grep: 查看不包含foo的行
grep -v foo *.v

# grep ignorecase
grep -i filename

# copy to clipboard
cat filename | xclip

# read from clipboard
xclip -o > filename

# 大小写转换
tr '[A-Z]' '[a-z]'

# 发送邮件
echo "mail body" | mailx -s "mail title" xxx@xxx.com 

# Find
find -L . -maxdepth N -name '*' 
find /dir1/dir2 -type f -name "FILE.*" -newer /dir1/dir2/afterme.txt -exec cp {} /dir1/dir2/dir3 \;

# 查看大文件
sed -n ‘{$line0,line1}p’ filename

# 替换文件中的变量${xxx}
setenv
cat filename | envsubst > new_filename

# 打开新terminal并运行
xterm -hold -e xxx.sh
xterm -hold -e “cd ..; make xxx”

     

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s