apt换源 (20.04)
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak # 备份
sudo vi /etc/apt/sources.list
# 全部替换为下面 (阿里源)
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
# apt更新升级
sudo apt-get update
sudo apt-get upgrade
Git
安装并配置
sudo apt-get install git
git config --global user.name "username"
git config --global user.email xxx
查看配置
git config --list # 查看全部配置
git config user.name # 查看一个配置
ssh
安装并生成ssh key
sudo apt-get install ssh
cd ~/.ssh
ssh-keygen -o
将.pub文件中的公钥加到远程git平台的ssh配置中
vim
安装
sudo apt-get install vim
vim ~/.vimrc
配置如下
set nocompatible " 不与 Vi 兼容
syntax on " 打开语法高亮
set showmode " 在底部显示当前处于命令模式还是插入模式
set showcmd " 命令模式下,在底部显示当前键入的指令
set encoding=utf-8
" set t_Co=256 " 启用256色
set autoindent " 自动缩进
set tabstop=4 " 按下 Tab 键时,Vim 显示的空格数
set shiftwidth=4 " 在文本上按下>>、<<或者==时,每一级的字符数
set expandtab " 自动将 Tab 转为空格
set number " 显示行号
" set mouse=a " 设置鼠标可用
set relativenumber " 显示光标所在的当前行的行号,其他行都为相对于该行的相对行号
" set showmatch " 光标遇到圆括号、方括号、大括号时,自动高亮对应的另一个圆括号、方括号和大括号
set ignorecase " 搜索是忽略大小写
设置行号后鼠标复制会将行号一起复制,可复制到"+寄存器解决
ubuntu默认安装的vim没有”+寄存器,解决如下:
sudo apt-get install vim-gtk
anaconda
https://www.anaconda.com/products/individual#Downloads
pycharm
https://www.jetbrains.com/pycharm/download
添加到favorite:pycharm启动首页,右下角Configure中找到Create Desktop Entry点击,然后即可在应用中找到pycharm添加到favorite。
pip
换源
mkdir ~/.pip
vim ~/.pip/pip.conf
添加配置如下(清华源)
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn
sublime text
http://www.sublimetext.com/docs/linux_repositories.html#apt
有用的工具
sudo apt-get install tree