Mac
touch .bash_profile // create the .bash_profile file on mac
Elipse:
显示空白字符设定
Window->Preferences->General->Editors->Text Editors->Show whitespace characters
想把eclipse的Tab键设置为4个空格,
Window-->Preferences-->Java-->Code Style-->Formatter
然后右边选择 Edit...按钮,在General Settings页中 Tab policy 右边的下拉框,选择Space only!
linux command collection:
scp
scp file uer@ip:/local
change the user
sudo -i -- change to root
su username -- change to normal user
sudo passwd root
ssh
ssh user@ip
exit : close the connection
look up the memory info
cat /proc/meminfo
look up the cpu info
cat /proc/cpuinfo
lscpu is a small and quick command that does not need any options. It
would simply print the cpu hardware details in a user-friendly format.
show all file and folder including the hide
Ctrl + h
PS and Kill
ps -A // ps -e
ps -p $$ //查看自己终端属于哪种shell
kill pid
Ibus
ibus-daemon -d
Vim
:set nu ---show he line number
vim +n filename --open the filename and go to n line
:n ---- n is the line number ,and click the enter you will goto here
nG ---- goto n line
:set ts=4 ---set the tab as 4 blank spaces.
:set hlsearch #选择高亮显示查找的文本,命令为
:set nohlsearch #关闭高亮显示的命令为
默认情况下 vim 的查找都是区分大小写的, 这种查找方式有利于准确快速的定位到目标, 但是有时候vim的使用者也不一定能够确认那个单词的大小写情况, 这种情况下就要用到大小写忽略了.
实现这个操作有两种方式:
方式1 指令设定:
:set ic(ignorecase 的缩写) 忽略大小写
:set noic(noignorecase 的缩写) 不忽略大小写
输入了上述指令, 当每次的查找操作都会受到当前设定的影响
方式2 查找符号设定:
/\CWord 区分大小写的查找
/\cword 不区分大小写的查找
这个操作针对当前的查找有效, 所以不必考虑下次查找操作是否会受到影响
查找并替换: :%s/four/4/g --将搜索four,并将其替换为4 “%” 范围前缀表示在所有行中执行替换。最后的 “g” 标记表示替换行中的所有匹配点。如果仅仅对当前行进行操作,
那么只要去掉%即可
清空终端屏幕
printf "\033c" -- 它的功能跟DOS里CMD.EXE提供的CLS效果很相似
工作原理:\033 == \x1B == 27 == ESC
reset,它也是清空终端屏幕,但我们仍然可以使用上下键查看历史命令
clear/CTRL+L, 没能完全清楚终端内容
sudo apt-get install
sudo apt-get install chmsee --for openning the .chm file
Find
/opt/Mask 目录下有a,b,c,d,e文件,现删除除a以外的所有文件
命令:
#find . ! -name a -exec rm -f {} /;
注:
find [起始目录] 寻找条件 操作
--寻找条件可以是由and(-a)、or(-o)、not(!)组成的复合条件,其中“-a”为系统缺省选项,“!”符表示
查找不满足所给条件的文件
--“-name”是按文件名称查找,常用的还有“-size”、“-xtype(x=b/c/d/p/f/l/s)”
--可执行的操作: -exec 命令名称 {} /;
对符合条件的文件执行所给的Linux 命令,而不询问用户是否需要执行该命令,{}
表示命令的参数即为所找到的文件;
命令的末尾必须以“ /;”结束。此外还有“-ok”、“-ls”、“fprintf”等操作。
当删除文件夹时,操作类似,#find . ! -name a -exec rm -rf {} /;
find . -name | xargs rm xx // xargs 代表find的结果,即对find的结果进行操作
find . -name foldername -type d //查找目录名为foldername的目录
grep and sed
sed -i “s/old/new/g” `grep old -rl /www` ---replace the old to new which find by
--- grep in the /www path
grep -w "hello" --word-regexp
android command collection:
logcat
adb shell logcat | grep xx | tee /local/log.log
adb shell getprop | grep -i cpu
adb shell rtt -f bt -p pid -t tid adb shell ps -t > /local/ps.log adb shell top -t -m 10 > /local/top.log adb shell logcat -v time thread -- print the time and the thread adb -s 7f1c864e shell --- ADB Shell when Multiple Devices adb shell logcat | grep -E "tag1 | tag2" --filter the tag1 and tag2 at one time
push
adb push fromPCfile toHandsetPath
pull
adb pull fromHandsetFile toPCPath
set system property
adb shell setprop prop value --prop is the system property variable
--and the value is what you want to set.
get system property value
adb shell getprop prop --prop is the system property variable
boot picture and anmiation
adb remount
adb shell boot_logo_updater //boot picture
adb shell bootanimation //boot animation
Ranking processes in order of memory usage
adb shell procrank -p
get phone density
adb shell getprop ro.sf.lcd_density
adb shell getprop | grep density
Operator the Phone
adb shell shutdown ---shutdown the devices
adb shell reboot ---reboot the devices
SQLITE
adb shell
cd data/data/com.android.providers.settings/databases
sqlite3 settings.db
>.help -- show the whole command
>.tables -- show the all tables in the database
>.header ON -- turn stats on
>select * from system;
>update system set value = 0 where name = 'test_column';
>select * from system where name = 'test_column';
>
>.quit --quit the sqlite3
exit --quit the adb shell
git
'git blame [filename]', 你就会得到整个文件的每一行的详细修改信息:包括SHA串,日期和作者:
ubuntu 下设置git 命令的字符颜色
$ git config --global color.status auto
$ git config --global color.diff auto
$ git config --global color.branch auto
$ git config --global color.interactive auto
Samba
$ sudo apt-get install system-config-samba
$ smbpasswd -a jerikc
$ sudo system-config-samba