【记录】Ubuntu 16.04 Config and Installing

发表于2017-06-04    类别: 技术(66)    标签: 记录(27) Ubuntu(11)

Recorded my private settings and softwares often used in Ubuntu.

1 add following to .bashrc

alias gd='git diff'
export PATH=/home/clean/bin:/home/clean/bin/repo:$PATH

up () 
{ 
	LIMIT=$1;
	if [ -z "$LIMIT" ]; then
		LIMIT=1;
	fi;
	P=$PWD;
	for ((i=1; i <= LIMIT; i++))
	do
		P=$P/..;
	done;
	cd $P;
	export MPWD=$P
}

c  ()
{
mkdir -p $HOME/.dhs
recpwd
cd $1
recpwd
sort $HOME/.dhs/dhsty -o $HOME/.dhs/dhsty
}

cg ()
{
	choosehisdir
	str=`cat $HOME/.dhs/wantedpath`
	rm $HOME/.dhs/wantedpath
	cd $str
}

bap ()
{
	adb remount
	sorthiscmd
	push
	cat $HOME/.dhs/wantedcmd
	str=`cat $HOME/.dhs/wantedcmd`
	g=${str#*/system/}
	f=${g%/system/*}
	h="adb pull /system/$f && $str"
	echo
	echo $h
	eval $h
	rm $HOME/.dhs/wantedcmd
	mr
	echo "mediaserver restarted!"
}

ap ()
{
	adb remount
	sorthiscmd
	push
	cat $HOME/.dhs/wantedcmd
	str=`cat $HOME/.dhs/wantedcmd`
	eval $str
	rm $HOME/.dhs/wantedcmd
	mr
	echo "mediaserver restarted!"
}

st ()
{
        echo
        if [ -z "$ORIG" ]; then
                ORIG=$PS1
        fi
        TITLE="\[\e]2;$*\a\]"
        PS1=${ORIG}${TITLE}
}

al ()
{
adb logcat -v threadtime | tee l
}

fap ()
{
echo $1
f=$1
g=${f#*/system/}
h="adb pull /system/$g"
echo $h
#eval $h
j="adb push $OUT/system/$g /system/$g"
echo $j
#eval $h
echo "$h && $j"
eval "$h && $j"
echo $j >> $HOME/.dhs/cmdhist
mr
echo "mediaserver restarted"
}

mr ()
{
adb shell stop media
adb shell start media
adb shell stop cameraserver
adb shell start cameraserver
}

savecmd ()
{
cp $HOME/.dhs/cmdhist $HOME/.dhs/tmp
if [ -z "$1" ]; then
history | grep "adb push\|grep" | cut -c 8- > $HOME/.dhs/tmp2
sort $HOME/.dhs/tmp2 | uniq
cat $HOME/.dhs/tmp2 >> $HOME/.dhs/tmp
rm $HOME/.dhs/tmp2
else
echo $1
echo $1 >> $HOME/.dhs/tmp
fi
sort $HOME/.dhs/tmp | uniq > $HOME/.dhs/cmdhist
rm $HOME/.dhs/tmp
}

sorthiscmd ()
{
cp $HOME/.dhs/cmdhist $HOME/.dhs/tmp
sort $HOME/.dhs/tmp | uniq > $HOME/.dhs/cmdhist
rm $HOME/.dhs/tmp
}

Or download: bashrcap, and add to the end of .bashrc

cd ~
cat bashrcap >> .bashrc

2 Extract the bin.tar.gz in home directory: bin.tar.gz

cd ~
tar xzvf bin.tar.gz

Main command inside is: adb, fastboot, repo

And the commands defined by myself:

  • setupcs: to prepare code analysis in Ubuntu
  • choosehisdir, hiscmd, recpwd: records of command, directory

3 Installing Java and other needed components for Android source building

sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip

4 Installing Vim

sudo apt-get vim

Then extract the vim.tar.gz in home directory: vim.tar.gz

cd ~
tar xzvf vim.tar.gz

5 Installing and initilizing others

sudo apt-get install cscope
sudo apt-get install ctags
sudo apt-get install meld
sudo apt-get install tree
sudo apt-get install gitk
sudo apt-get install virtualbox
git config --global user.email "clean_li@yahoo.com"
git config --global user.name "clean_li"
git config --global core.editor vim

6 Installing Jekyll

sudo apt-get install ruby
sudo apt-get install ruby-dev
ruby -v
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
gem -v
2.5.1
sudo gem install jekyll
sudo gem install bundler
sudo gem install jekyll-paginate
sudo gem install addressable -v 2.5.0
sudo gem install sass -v 3.4.23
sudo gem install jekyll-feed
sudo gem uninstall addressable -v 2.5.1
sudo gem uninstall sass -v 3.4.24
git clone https://github.com/cleanli/cleanhome.git
cd cleanhome/
jekyll serve

相关文章

   2023-12-31 【记录】浮点数存储方式
   2021-01-05 【转载】使用iotop监控磁盘I/O
   2017-06-26 【记录】调整ext4分区大小
   2017-06-10 【转载】如何启用Ubuntu的休眠模式
   2017-06-09 【记录】Ubuntu 16.04安装Android Studio
   2017-06-04 【记录】Ubuntu 16.04安装中文输入法
   2017-05-29 【收藏】一些命令收集(持续更新)
   2017-05-22 【收藏】自己修改编译ubuntu终端
   2017-05-22 【记录】Setup Samba server on ubuntu 16.04
   2017-05-19 【收藏】Ubuntu16.04下设置终端的标题