- 实时输出文件最后几行
tail -n 10 -f /path/to/file.log
- 在当前目录下查找指定字符串
find . -type f -name "*.mk" | xargs grep -Hn --color=auto "core_base"
- 忽略
git
记录中文件权限变更或mode改变导致的diff
冗余信息 git config --add core.filemode false
- 批量解压
cat rk3328_sdk.tar.gz* | tar -xzv
- 切换java环境
sudo tar zxvf jre-8u73-linux-x64.tar.gz
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jre1.8.0_391/bin/java 1000
sudo update-alternatives --config java
- 当编译时提示java版本和javac版本不一致时,一般是javac没有配置到可选列表
************************************************************
You are attempting to build with the incorrect version
of javac.
Your version is: javac 1.8.0_45-internal.
The correct version is: 1.6.
Please follow the machine setup instructions at
https://source.android.com/source/download.html
************************************************************
duanxuesong@ubuntu:~/test/sprd_sharkle_sl8521et_19.34.5$ sudo update-alternatives --config javac
[sudo] password for duanxuesong:
There are 2 choices for the alternative javac (providing /usr/bin/javac).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/bin/javac 1051 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 manual mode
duanxuesong@ubuntu:/usr/lib/jvm/jdk1.6.0_45/bin$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 3
duanxuesong@ubuntu:/usr/lib/jvm/jdk1.6.0_45/bin$ update-alternatives --list javac
/usr/lib/jvm/java-7-openjdk-amd64/bin/javac
/usr/lib/jvm/java-8-openjdk-amd64/bin/javac
/usr/lib/jvm/jdk1.6.0_45/bin/javac
duanxuesong@ubuntu:/usr/lib/jvm/jdk1.6.0_45/bin$ sudo update-alternatives --config javac
There are 3 choices for the alternative javac (providing /usr/bin/javac).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/bin/javac 1051 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 manual mode
3 /usr/lib/jvm/jdk1.6.0_45/bin/javac 3 manual mode
Press enter to keep the current choice[*], or type selection number: 3