Linux 个性配置

1. vimrc

全局:/etc/vimrc
个人:~/.vimrc

set nu
set ai                                                                      
set paste
set hlsearch
syntax on
set cursorline

autocmd BufNewFile *.sh exec ":call SetTitle()"
func SetTitle()
    if expand("%:e") == 'sh'
    call setline(1,"#!/bin/bash")
    call setline(2,"#")
    call setline(3,"# ***************************************************************")
    call setline(4,"# Author:              kirk")
    call setline(5,"# Blog:                https://www.cnblogs.com/keye/")
    call setline(6,"# Date:                ".strftime("%Y/%m/%d %H:%M:%S"))
    call setline(7,"# FileName:            ".expand("%"))
    call setline(8,"# Description:         Knowledge is infinite!")
    call setline(9,"# Copyright(C):        ".strftime("%Y/%m ")."All rights reserved")
    call setline(10,"# ****************************************************************")
    call setline(11,"")
    endif
endfunc
autocmd BufNewFile * normal G

 
配置文件:永久有效
全局:/etc/vimrc
个人:~/.vimrc
扩展模式:当前vim进程有效
(1) 行号
显示:set number, 简写为set nu
取消显示:set nonumber, 简写为set nonu
(2) 忽略字符的大小写
启用:set ic
不忽略:set noic
(3) 自动缩进
启用:set ai
禁用:set noai
(4) 复制保留格式
启用: set paste
禁用: set nopaste
(5) 高亮搜索
启用:set hlsearch
禁用:set nohlsearch
(6) 语法高亮
启用:syntax on
禁用:syntax off
(7) 显示Tab和换行符 ^I 和$显示
启用:set list
禁用:set nolist
(8) 文件格式
启用windows格式:set fileformat=dos
启用unix格式:set fileformat=unix
简写: set ff=dos|unix
(9) 设置文本宽度
启用: set textwidth=65 (vim only)
禁用: set wrapmargin=15
(10) 设置光标所在行的标识线
启用:set cursorline,简写cul
禁用:set no cursorline

2. bashrc

对所有用户有效:/etc/bashrc

仅对当前用户:~/.bashrc

PS1="[e[1;32m][[e[0m][e[1;33m]u[e[36m]@h[e[1;31m] W[e[1;32m]][e[0m]\$ "

source /etc/bashrc
或
source ~/.bashrc

3. linux 登录后佛祖保佑

vim /etc/motd

                  o8888888o                                                                        
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O  -  /O  
               ____/`---'\____
             .'  \|     |//  `.  
            /  \|||  :  |||// 
           /  _||||| -:- |||||- 
           |   | \  -  /// |   |   
           | \_|  ''---/''  |   |   
             .-\__  `-`  ___/-. /
         ___`. .'  /--.--  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;` _ /`;.`/ - ` : | |
       `-.   \_ __ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         学海无涯       大道至简

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
将上面复制在motd文件即可。

4. 桥接网卡配置方法

    vim /etc/sysconfig/network-scripts/ifcfg-ens33
    # 静态IP
    BOOTPROTO="static"
    ONBOOT="yes"
    IPADDR="192.168.175.100"    # 物理机网段IP
    NETMASK="255.255.255.0"    # 子网掩码
    GATEWAY="192.168.175.2"  # 网关
    DNS1="114.114.114.114"  # DNS
    service network restart  # 重启网卡    



5. 安装 Anconda

    bash Anaconda3-2019.03-Linux-x86_64.sh  # 逐步安装即可
    # 配置环境变量
    vim ~/.bashrc
    export PATH=/root/anaconda3/bin:$PATH 
    source ~/.bashrc 
    conda info  # 查看Conda环境配置
    # 创建子环境:(子环境名为 py27,Python版本为3.6.6)
    conda create --name py366 python=3.6.6
    conda info --envs # 查看已有的子环境
    # 激活环境:(从其他环境切换至需要环境)
    source activate 
    conda activate py366
    # 退出当前环境
    conda deactivate
原文地址:https://www.cnblogs.com/keye/p/15219267.html