系统
-
安装当前版本的linux-headers
sudo apt-get install linux-headers-$(uname -r)
-
重新配置已经安装的软件包
sudo dpkg-reconfigure dash
-
find命令
与echo, du等结合, 统计匹配目录的空间大小
find vendor/ -name ".git" ! -path "vendor/3rdParty*" -exec echo "TDIR=\`dirname {} \` && du -sh \$TDIR" \; > test.sh && chmod a+x test.sh && ./test.sh
-
查找并kill某关键字进程
pid=`ps -e | grep phone | sed 's/[ ][ ]*/,/g'|cut -d \, -f2`;echo $pid;kill $pid
ps aux | grep kama | grep -v grep | cut -c 10-14|xargs sudo kill -9
ps aux | grep kama | grep -v grep | awk ‘{print $1}’|xargs kill -9
-
shell简单循环
cat test.sh | while read line; do $line; done
-
保持系统唤醒
echo "aaa" > /sys/power/wake_lock
-
改变kernel log级别
echo 0 > /proc/sys/kernel/printk
-vim
删除行尾空格:
:%s/\s\+$//
删除行头空格:
:%s/^\s\+//
删除空行:
:%g/^$/d
将多行空行替换为一行:
:%s/\n\{3,\}/\r\r/e
pkgconfig路径:
pkg-config --variable pc_path pkg-config
添加:export PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/
网络
-
ping
ping目标主机, 指定interface ping ipv6地址
ping6 -I usb0 ipv6.sjtu.edu.cn
-
curl命令
curl -v https://www.jianshu.com
curl -v hostname [-d data or -d $file] 可携带要发送的数据 -
修改ip
ifconfig em1 192.168.1.1 netmask 255.255.255.0 up
-
查看路由表
ip路由: ip -4或ip -6查看修改对应的路由,如:
ip -6 route list table all
注:
按命令级联查看对应help,如
ip help
ip route help
-
路由策略
ip -4或ip -6查看修改对应的路由策略,如:
ip -6 rule
-
防火墙规则
查看raw表规则
iptables -nL -t raw
添加规则
iptables -t raw -A tetherctrl_raw_PREROUTING -s 10.0.10.0/24 -d 10.0.10.0/24 -j ACCEPT
禁止ping本机:
iptables -A INPUT -p icmp --icmp-type echo-request -j DROP
(iptables可参考: https://blog.csdn.net/jon_stark/article/details/80372221)
禁用usb0的dhcp地址更新:
iptables -t filter -A OUTPUT -i usb0 -p udp -s 0.0.0.0 --sport 68 -d 255.255.255.255 --dport 67 -j DROP
-
tcpdump抓包
tcpdump -i any -w test.pcap
-
wireshark
(ipv6.addr eq fd00:0:20:1::4 and ipv6.addr eq fd00:0:0:2::1) and (tcp.port eq 55951 and tcp.port eq 10815)
ip.dst == 10.0.0.172
ip.addr == 10.0.0.172 and ( tcp.flags.syn == 1 or tcp.flags.fin == 1)
Git
git config --global http.sslverify false
git config --global -e
[color]
ui = auto
[core]
editor = vim
[commit]
template = /home/aa1/gitmessage.txt
添加远程仓库然后rebase
git remote add local_name /data/ws/android32/frameworks/base/
或
git remote add local_name ssh://testuser@10.x.x.y:/data/ws/android32/frameworks/base/
git fetch local_name
git rebase --onto mbase branch_a/branch_b
clean:
repo forall -c "git reset --hard && git clean -xdf"
git show解析
列出修改文件数大于200的提交列表(包含修改文件的笔数):
git cherry -v android12 | awk '{ printf("git show %s | grep \"diff --git\" | wc -l \n",$2)}' | while read line ; do cnt=$(eval $line); if [ $cnt -gt 200 ]; then echo $line : $cnt | awk '{ printf("%s %s %s ~ %s\n",$1,$2,$3,$12)}'; fi; done;
显示修改文件数大于200的提交列表:
git cherry -v android12 | awk '{ printf("git show %s | grep \"diff --git\" | wc -l \n",$2)}' | while read line ; do cnt=$(eval $line); if [ $cnt -gt 200 ]; then echo $line | eval $(awk '{ printf("%s %s %s --pretty=oneline | head -6",$1,$2,$3)}'); fi; done;
android
- 初始化
android tools:
https://source.android.com/source/initializing.html - repo forall列出版本间差异commit
repo forall -p -c git log branch_a..branch_b --author='@test.com'
- lowmemorykiller
cat /sys/module/lowmemorykiller/parameters/minfree
- dumpsys network info
grep -rs "Switching to new default network" .
dumpsys connectivity --short | grep "Active default network"
- ndc
ndc resolver setnetdns 100 "*" 8.8.8.8 114.114.114.114
ndc resolver clearnetdns 100
其它
-
按区域截屏
sleep 3 && gnome-screenshot -a
shell执行完本命令后, 迅速跳转到待截屏界面, 待光标变十字,可选择拖动区域截屏 -
selinux
generate rules
dmesg | audit2allow -p out/target/product/a11/root/sepolicy
cat rules.txt | audit2allow
-
minicom configuration (replace SecureCRT)
http://www.cnblogs.com/pied/archive/2012/04/10/2441021.html
网友评论