显示标签为“ubuntu”的博文。显示所有博文
显示标签为“ubuntu”的博文。显示所有博文

2022年2月28日星期一

Ubuntu20.04安装tmux及修改快捷键

Ubuntu 20.04.3 LTS安装tmux:

apt安装

$ sudo apt-get update
$ sudo apt install tmux
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libevent-2.1-7 libutempter0
The following NEW packages will be installed:
  libevent-2.1-7 libutempter0 tmux
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 438 kB of archives.
After this operation, 1,222 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
$ tmux -V
tmux 3.0a

编译安装

下载并解压到本地

$ wget https://github.com/tmux/tmux/releases/download/3.2a/tmux-3.2a.tar.gz
$ tar -zxvf tmux-3.2a.tar.gz
$ cd tmux-3.2a

安装所需工具

$ sudo apt install libevent-dev ncurses-dev build-essential bison pkg-config

编译

$ ./configure && make

安装

$ sudo make install
make[1]: Entering directory '/home/**/tmux-3.2a'
 /usr/bin/mkdir -p '/usr/local/bin'
  /usr/bin/install -c tmux '/usr/local/bin'
make  install-exec-hook
make[2]: Entering directory '/home/**/tmux-3.2a'
if test xmdoc = xmdoc; then \
	sed -e "s|@SYSCONFDIR@|/etc|g" ./tmux.1 \
		>./tmux.1.mdoc; \
else \
	sed -e "s|@SYSCONFDIR@|/etc|g" ./tmux.1| \
		mawk -f ./mdoc2man.awk >./tmux.1.man; \
fi
/usr/bin/mkdir -p /usr/local/share/man/man1
/usr/bin/install -c -m 644 ./tmux.1.mdoc \
	/usr/local/share/man/man1/tmux.1
make[2]: Leaving directory '/home/**/tmux-3.2a'
make[1]: Nothing to be done for 'install-data-am'.
make[1]: Leaving directory '/home/**/tmux-3.2a'
$ tmux -V
tmux 3.2a

卸载

$ sudo make uninstall

命令模式

进入tmux任一面板pane,按下前缀键 + :进入命令模式,输入命令语句执行。默认前缀键为Ctrl+b,首先同时按下Ctrl键和小写字母b键,然后同时按下Shift键和:/;键,即可。

配置

配置文件

  1. 系统级配置文件:/etc/tmux.conf

  2. 用户级配置文件:~/.tmux.conf

配置文件内容为一系列的tmux命令,在tmux server启动时依次执行配置文件中的命令语句

配置文件只有在tmux server启动时才会加载,修改了配置文件时需要重启服务或者重载配置文件

关闭服务重启

进入命令模式输入命令:

:kill-server

关闭服务后所有会话session会被关闭,重新创建session即可完成重启

重载配置文件

在命令模式下输入命令:

:source ~/.tmux.conf

即可重新加载配置文件

修改快捷键

修改前缀键(prefix key)

前缀键通过prefix选项设置,默认为C-bCtrl+b,修改为Alt-b

通过命令

进入命令模式,输入命令:

:set -g prefix M-b

通过配置文件

配置文件~/.tmux.conf加入一行:

set -g prefix M-b

进入命令模式,输入命令重新加载配置文件

:source ~/.tmux.conf

修改分屏键

通过命令

进入命令模式输入命令:

:bind-key -T root M-d split-window -h
:bind-key -T root M-D split-window

通过配置文件

配置文件~/.tmux.conf加入:

bind-key -T root M-d split-window -h
bind-key -T root M-D split-window

重新加载配置文件即可

参考

tmux README

Installing tmux

2022年2月15日星期二

Ubuntu20安装Terminator2.1.1

 

Ubuntu 20.04.3 LTS安装terminator:

PPA安装

$ sudo add-apt-repository ppa:mattrose/terminator
$ sudo apt-get update
$ sudo apt install terminator

编译安装

下载并解压到本地

$ wget https://github.com/gnome-terminator/terminator/releases/download/v2.1.1/terminator-2.1.1.tar.gz
$ tar -zxvf terminator-2.1.1.tar.gz
$ cd terminator-2.1.1

运行

如果不需要语言支持、图标等,可以直接运行:

$ python3 terminator

安装所需工具

$ sudo apt install python3-gi python3-gi-cairo python3-psutil python3-configobj gir1.2-keybinder-3.0 gir1.2-vte-2.91 gettext intltool dbus-x11
$ sudo apt-get install python3-setuptools python3-pip

编译

$ python3 setup.py build

安装

$ sudo python3 setup.py install --single-version-externally-managed --record=install-files.txt
$ terminator --version
terminator 2.1.1

生成的记录文件install-files.txt可以用来卸载

卸载

$ sudo python3 setup.py uninstall --manifest=install-files.txt

参考

Installing Terminator

2018年1月1日星期一

Android2.3源码学习01 -- 下载源码

Android源码的开发、学习,官方推荐使用UbuntumacOs系统,下面在Ubuntu 12.04LTS中学习Android 2.3源码。
首先,下载Android源码到本地:

安装git

下载Android源码需要安装git工具:
$ sudo apt-get install git
$ git --version
git version 1.7.9.5

下载repo脚本

下载repo脚本到本地,并赋予可执行权限:
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
被墙可以使用国内镜像:
$ curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
$ chmod a+x ~/bin/repo

初始化工作目录

本地建立工作目录以便下载AOSP源码:

$ cd ~
$ mdir WORKING_DIRECTORY
$ export WORKING_DIRECTORY=~/WORKING_DIRECTORY # 设置工作目录环境变量,后面方便引用
$ cd $WORKING_DIRECTORY

初始化工作目录

初始化工作目录,下载代码仓库及BUG修复的列表,默认下载master分支:
$ repo init -u https://android.googlesource.com/platform/manifest
也可以使用-b指定分支:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.7_r1
分支列表可以参看:Source Code Tags and Builds
被墙使用国内镜像:
首先修改repo脚本,将REPO_URL链接修改为:
REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
或者设置REPO_URL环境变量:
$ export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
然后执行repo init
# master
$ repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
# 分支
$ repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-2.3.7_r1
等待代码同步到本地,如果中断,下次直接执行同步命令,可以继续下载,不用重新开始。

已有仓库修改源

如果已经使用repo sync同步过代码,或者使用repo init初始化过工作目录,可以打开工作目录下配置文件.repo/manifests.git/config,将
url = https://android.googlesource.com/platform/manifest
修改为:
url = https://aosp.tuna.tsinghua.edu.cn/platform/manifest
即可切换仓库。

同步代码

执行同步命令:
$ repo sync

参考阅读

2016年10月8日星期六

安装Groovy环境

Groovy的安装可以参看官网 。可以自己手动下载Groovy压缩包自己配置环境变量,也可以使用sdkman等工具来管理安装,这里记录下安装方法:

一、使用 SDKMAN


SDKMAN的使用可以参看:使用SDKMAN软件管理开发工具SDK

$ sdk install groovy
$ groovy -version
Groovy Version: 2.4.7 JVM: 1.8.0_101 Vendor: Oracle Corporation OS: Mac OS X

二、手动安装


使用SDKMAN安装的Groovy只有二进制程序,不包含源码和文档,这里介绍下手动安装的方法:

1. 首先下载Groovy压缩包,这里我选择了二进制+源码+文档的集成包,当前最新版本2.4.7:https://bintray.com/artifact/download/groovy/maven/apache-groovy-sdk-2.4.7.zip

2. 解压到本地:$HOME/bin/groovy-2.4.7

3. 设置环境变量GROOVY_HOME,ubuntu中~/.bashrc或mac中~/.bash_profile文件中添加:

export GROOVY_HOME=$HOME/bin/groovy-2.4.7
export PATH=$GROOVY_HOME/bin:$PATH

4. 重新打开命令行窗口,查看安装是否正确:

$ groovy -version
Groovy Version: 2.4.7 JVM: 1.8.0_101 Vendor: Oracle Corporation OS: Mac OS X

Android logcat

Log等级 Android log 等级在 android/log.h 中定义如下: typedef   enum   android_LogPriority {    /** For internal use only. */ ANDROID_LOG_UNKNOWN =...