欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Linux Configurations

程序员文章站 2022-03-02 22:47:07
...

Linux Configurations

Add PATH variable

# example for add Moeditor PATH
# add PATH for all usrs
sudo vim /etc/profile
export PATH="/home/jarvis/usr/moeditor:$PATH"
# add PATH for your usr
sudo vim ~/.bashrc
export PATH="/home/jarvis/usr/moeditor:$PATH"
# update
source /etc/profile
source ~/.bashrc

Turn on the IPV6

Get the IPV6-hosts from LAOD websites

  1. firefox and chrome can’t open 六维空间 , Google, Youtube, Google Scholar
  2. Then suddenly I can open the 洛樱
  3. Then the 六维空间 , Google, Youtube, Google Scholar are available

Change the Pycharm path without uninstall it

  1. find the pycharm path file in /usr/local/bin/charm.py
  2. then modify the PATH to fit your real path
# see com.intellij.idea.SocketLock for the server side of this interface
RUN_PATH = u'/home/jarvis/usr/pycharm-2017.2.4/bin/pycharm.sh'
CONFIG_PATH = u'/home/jarvis/.PyCharm2017.2/config'
SYSTEM_PATH = u'/home/jarvis/.PyCharm2017.2/system'

Install the “deb” program

we can learn from the CSDN blog

dpkg -i <package.deb>
# 1.安装一个 Debian 软件包,如你手动下载的文件。
dpkg -c <package.deb>
# 2.列出 <package.deb> 的内容。
dpkg -I <package.deb>
# 3.从 <package.deb> 中提取包裹信息。
dpkg -r <package>
# 4.移除一个已安装的包裹。
dpkg -P <package>
# 5.完全清除一个已安装的包裹。和 remove 不同的是,remove 只是删掉数据和可执行文件,purge 另外还删除所有的配制文件。
dpkg -L <package>
# 6.列出 <package> 安装的所有文件清单。同时请看 dpkg -c 来检查一个 .deb 文件的内容。
dpkg -s <package>
# 7.显示已安装包裹的信息。同时请看 apt-cache 显示 Debian 存档中的包裹信息,以及 dpkg -I 来显示从一个 .deb 文件中提取的包裹信息。
dpkg-reconfigure <package>
# 8.重新配制一个已经安装的包裹,如果它使用的是 debconf (debconf 为包裹安装提供了一个统一的配制界面)。

The VIM using tips

  1. A perfect VIM commands explanation

    :sh "暂时退出VIM,按<CTRL+d>回来
    

Configure The powerful VIM editor

  1. Install the K-VIM from the github, and the Chinese Configure steps from explanation
  2. The colorscheme is solarized dark
  3. Autoinstall the plugins e.g. YouCompleteMe,etc

Configure the Terminal

  1. change the default shell from bash to zsh,and install the oh-my-zsh, and custom the plugins and themes in the the ~/.zshrc file

    sudo apt-get install zsh
    sudo apt-get install zsh -y #install zsh
    git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
    #将默认的shell切换成zsh
    chsh -s /bin/zsh 
    # 新建一个.zshrc配置文件,和.bashrc作比较
    cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
    
  2. Then install the tmux to realize splitting the terminal to multiple tasks, configuration is in the file ~/.tmux.conf. Then I find these in the website

    # 只用了下面一句代码安装了tmux,从网上找的.tmux.conf
    sudo apt-get install tmux -y
    mkdir -p ~/.tmux
    git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
    

Configure the Git and send code to Github

  1. Install the git and new a repository on Github, and send my code to the remote repository.

    # Some git basic commands, waitting for update
    git init
    git status
    git add <filename>
    git commit -m 'comment info'
    git branch <branch name>
    git checkout <branch name>
    git checkout -b <branch name>
    git merge <branch name>
    git branch -d <branch name>
    git branch -D <branch name>
    git tag <v1.0 or v2.0>
    
  2. Send code to remote repository

    # use rsa algorithm to create ssh key, path: `~/.ssh/id_rsa.pub`
    # then add it on the Github remote repository setting
    ssh-****** -t rsa
    # check the SSH key
    ssh -T [email protected]
    git clone [email protected]:JarvisTao/test.git
    # build a remote repository, and find an error, so first pull it 
    # into local repository, then it will combine with the local 
    # repository. Then push, it will work
    git remote add origin [email protected]:JarvisTao/test.git
    git remote rm origin
    git pull origin master
    git push origin master
    git remote -v
    
  3. configure the git use command like git config --global ***

    git config --global user.name "JarvisTao"
    git config --global user.email "[email protected]"
    git config --global core.editor "vim"
    git config --global color.ui true
    git config --global core.quotepath false
    git config -l
    
  4. My git configuration.~/.gitconfig

    [user]
    name = JarvisTao
    email = [email protected]
    [core]
    editor = vim
    quotepath = false
    [color]
    ui = true
    [alias]
    st = status
    co = checkout
    ci = commit
    br = branch
    lg = log --graph --pretty=format:'%Cred%h%Creset-%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
    psm = push origin master
    plm = pull origin masher
    
  5. Connecting Logitech K480 Keyboard to Deepin OS

    # Turn on the bluetooth
    sudo service bluetooth start
    # Get in the bluetoothctl
    bluetoothctl
    # Then pair the MAC direction
    power on 
    agent on 
    default-agent
    scan on
    pair #your Device MAC
    # input the pair password, then pair successfully!!
    

Some commands studying on Ubuntu18.04

  1. 2>&1 : redirection command and tee

    Refer to:

    http://linux.tedu.cn/workplace/351526.html

    https://www.cnblogs.com/sos-blue/p/6798810.html

    https://blog.csdn.net/yufenghyc/article/details/45671373

    In bash or zsh,

    0: STDIN_FILENO(default: keyboard),

    1: STDOUT_FILENO(default: terminal)

    2: STDERR_FILENO(default: error info output)

    command > file : redirection the std output info from terminal into file, and left the error info

    command > file 2>&1: redirection the std output and std error output info into file

    command 2>&1 | tee file : redirection all the info into file and left all info too

    we use test.sh to test the process:

    # test.sh
    date #打印当前时间
    while true #死循环
    do #每隔2秒打印一次 
        sleep 2 
        whatthis #不存在的命令 
        echo -e "std output"
    done
    

    when type: sh test.sh > test.txt, there only left the error info on the terminal, and std output info are in test.txt

    when type: sh test.sh > test.txt 2>&1, there left nothing, and all info are in test.txt

    when type: sh test.sh 2>&1 | tee test.txt, there left all info and redirection them to test.txt