Ubuntu 基础设置,包括终端、Vim、程序快捷方式、Git等。
主题设置
- 修改终端颜色
- 修改图标大小
- 修改壁纸
终端设置
终端路径名称太长
修改配置文件 vim ~/.bashrc
中小写 w 为大写 W,source ~/.bashrc
1 | if [ "$color_prompt" = yes ]; then |
Vim 设置
显示行号
- 临时显示行号
:set number
或者:set nu
- 永久显示行号
- 查找配置文件
find / -name vimrc 2>&1 | grep -v "Permission denied"
- 编辑
sudo vim /etc/vimrc
,添加set number
- 查找配置文件
程序设置
软链接
1 | ln -s /path/to/soure/file /path/to/target/file |
桌面快捷方式
- 打开 application 文件夹
1 | cd /usr/share/applications |
- 创建应用快捷方式
touch myapp.desktop
1 | [Desktop Entry] |
- 增加权限
chmod +x myapp.desktop
,注意执行时如果出现闪退,则在终端中直接执行/path/to/myapp
查看出错信息并修复
配置 Git
安装
安装 Git
1 | sudo apt-get update |
配置 Git 用户名和邮箱
1 | git config --global user.name git_name |
生成 SSH 密钥,设置默认
1 | ssh-keygen -t rsa -C git_email@email.com |
提示信息
1 | Your identification has been saved in ~/.ssh/id_rsa |
查看公钥内容并复制到 SSH keys 中,在 Github -> Setting -> SSH and GPG keys -> new SSH key
新建key并输入 title 和 key 即可
1 | cat ~/.ssh/id_rsa.pub |
检查是否设置成功 Testing your SSH connection,对比公钥指纹是否一致
1 | ssh -T git@github.com |
VSCode
拉取项目 git clone https://github.com/xxxxx.git/
,首次可能报错
1 | fatal: unable to access 'https://github.com/xxxxx.git/': gnutls_handshake() failed: The TLS connection was non-properly terminated. |
设置代理或 gnutls 包原因 Ubuntu error: gnutls_handshake(),后者可采用 openssl
编译或更换更为稳定的代理
1 | git config --global http.https://github.com.proxy http://127.0.0.1:7890 |
克隆私有仓库可能报错,参考 Stackoverflow Message
1 | remote: Support for password authentication was removed on August 13, 2021. |
apt 添加代理
apt 设置代理
1 | # 清除缓存 |
终端设置代理 Blog-Ubuntu 配置clash的四种方式
1 | # 在终端使用代理 |
设置输入法
在Linux系统上,常见的输入法框架(Keyboard input method system)有三种:
- IBus(Intelligent Input Bus)
- Fcitx(FlexibleInput Method Framework)
- XIM(X Input Method)
选择 Setting > System > Region & Language > System
中选择 Manage Installed Language > Language > Keyboard input method system
选项,可以看到在Ubuntu 24.02 LTS系统中,已安装 IBus 和 XIM 输入法框架,默认为 IBus 框架.
选择 Setting > Keyboard > Input Sources
选择中文输入法为 Chinese(Intelligent Pinyin)
.
选择 Chinese(Intelligent Pinyin) > Preference
修改智能输入选项.
- 在
Pinyin mode
面板中打开Cloud Input Option > Enable Cloud Input > Baidu
- 在
Dictionary Option
面板中选择需要导入的字典