x01.os.22: ubuntu 常用设置

新组装了个 64 位电脑,i5 CPU,进入 ubuntu 后,又是一通搜索设置,整理如下,以备后用。

WinXP 中 Vim 配置 python

ubuntu 中使用 vundle,略

1. 下载 Exuberant Ctags
  将 ctags.exe 复制到 Vim/vim81/  # Vim 为安装目录
2. 下载 Taglist
  将 talist.vim 复制到 Vim/vim81/plugin/
3. 下载 Pydiction
  将 python_pydiction.vim、complete_dict和pydiction.py 复制到 Vim/vim81/ftplugin/
4. 配置 _vimrc

source $VIMRUNTIME/vimrc_example.vim

set diffexpr=MyDiff()
function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg1 = substitute(arg1, '!', '!', 'g')
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg2 = substitute(arg2, '!', '!', 'g')
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  let arg3 = substitute(arg3, '!', '!', 'g')
  if $VIMRUNTIME =~ ' '
    if &sh =~ '<cmd'
      if empty(&shellxquote)
        let l:shxq_sav = ''
        set shellxquote&
      endif
      let cmd = '"' . $VIMRUNTIME . 'diff"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . 'diff"'
    endif
  else
    let cmd = $VIMRUNTIME . 'diff'
  endif
  let cmd = substitute(cmd, '!', '!', 'g')
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
  if exists('l:shxq_sav')
    let &shellxquote=l:shxq_sav
  endif
endfunction

let Tlist_Ctags_Cmd='ctags.exe'
let Tlist_Auto_Open=1
let g:pydiction_location='E:/program/Vim/vim81/ftplugin/complete_dict'
let g:pydiction_menu_height=20
_vimrc

中文字体

将中文字体 copy 到 /usr/share/fonts/zh_CN 后,运行 sudo fc-cahce 即可

下载插件

https://addons.mozilla.org/zh-CN/firefox/addon/baidu-pan-exporter/

杀死进程

 pkill -9 procname

vi 常用命令

替换  :%s/
//g
查找  :/word

配置JDK

# sudo vi /etc/profile
export JAVA_HOME=/usr/local/lib/jdk-10
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH={JAVA_HOME}/bin:$PATH

更新默认jdk
# sudo update-alternatives --install /usr/bin/java java /usr/local/lib/jdk-10/bin/java 300
# sudo update-alternatives --install /usr/bin/javac javac /usr/local/lib/jdk-10/bin/javac 300
# sudo update-alternatives –config java
# sudo update-alternatives –config javac

 Ubuntu 死机

1. Ctl+Alt+F1 进入 tty1,top 找出问题进程,kill 杀死
2. Ctl+Alt+F7 回到桌面

安装 OpenGL

sudo apt install build-essential
sudo apt install libgl1-mesa-dev
sudo apt install libglu1-mesa-dev
sudo apt install freeglut3-dev

 Python3 添加引用路径

1. 推荐在 /usr/local/lib/python3.5/dist-packages/ 目录中添加文件 mypath.pth,将所需引用目录写入保存即可。
2. 在 sys.path 中附加所需引用目录, 例如:
	import os,sys
	sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

 默认目录改为英文

 export LANG=en_US
 xdg-user-dirs-gtk-update 

阅读 .azw3 电子书

sudo apt install calibre

md 语法

title: # h1, ## h2 ...
picture: ![Alt text](/path/img)
strong: *斜体* **粗体** ***斜粗体***
code: ``` multi-line ```  ` one-line `
换行: 两个空格+回车
引用: > 一级引用, >> 二级引用
链接: [Markdown](http://address)
分割线: *** or --- or ___
列表: 1. or * or - 加空格
表格:  |head|head|head|
       |-|-|-|
       |cell|cell|cell|
删除线: ~~content~~
转义:  加 \`~*_-+.~! 之一

 安装 goldendict

sudo apt install goldendict
sudo cp [dictionary]  /usr/share/goldendict/

 安装 .dep 包

sudo dpkg -i [filename.dep]

安装 flash 插件

下载 flashplayer,解压进入后运行如下命令:
sudo cp libpepflashplayer.so /usr/lib/chromium-browser/plugins/
修改/etc/chromium-browser/default,修改CHROMIUM_FLAGS,修改后大致如下:
CHROMIUM_FLAGS="--ppapi-flash-path=/usr/lib/chromium-browser/plugins/libpepflashplayer.so --ppapi-flash-version=25.0.0.171"

 自动上网链接(DSL)

sudo pppoeconf
sudo pon dsl-provider
sudo poff

又:安装无线路由后不能上网解决办法:

1. 更改/etc/NetworkManager/NetworkManager.conf中的managed=true
2. 更改/etc/network/interfaces,只保留
  auto lo
  iface lo inet loopback
3. 然后 sudo /etc/init.d/network-manager restart

OK!完美解决,原来的 DSL 也可以删除了。

 获取 Ubuntu 版本信息

cat /etc/issue
sudo lsb_release -a

 Use Fiddler

 1. 安装 mono
      sudo apt install mono-complete 
 2. 下载 Fiddler for linux
 3. 进入 Fiddler 文件夹,运行命令
     mono Fiddler.exe
 

PowerShell Install - Ubuntu 16.04

# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

# Register the Microsoft Ubuntu repository
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh
原文地址:https://www.cnblogs.com/china_x01/p/6159439.html