Skip to content

viridityzhu/my_linux_setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Linux Setup

This repo is for me to set up a fresh install of Linux with basic and useful customizations.

Features

  • Set up a fresh install of Linux nicely and lightly (within 10 mins).
  • Customized appearances and keybinds for bash, tmux, and vim.
  • Light but cool plugins, such as ranger, tldr, and bashmarks.
  • Suitable for vim+tmux+conda users.

Download Useful Softwares

  • Conda

    Download a latest Miniconda .sh installer: https://docs.conda.io/en/latest/miniconda.html#linux-installers; Alternately, directly download use wget:

    wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

    Then install:

    sh Miniconda3-latest-Linux-x86_64.sh

    If you don't have root permission, and you don't even have a pip3 not to say an apt, then installing conda is essential, because after this you can use pip3.

  • pipx: install and run end-user applications written in Python, providing isolated environment. You may need to reload your server to let conda refresh before going to the following steps.

    python3 -m pip install --user pipx
    python3 -m pipx ensurepath
    python3 -m pip install --user --upgrade pipx
  • Ranger: A VIM-inspired filemanager for the console. Now you have a colorful and structural file manager!

    pipx install ranger-fm

    Usage: Use command ranger to open a file system window that is very cool.

    Tip: If you are also using iTerm2 on MacOS, you can easily preview images in ranger by following the steps below:

    1. In the menu bar of iTerm2, select iTerm2 -> Install Shell Integration. (In a session which is connected to your remote Linux server via ssh)
    2. Config ranger:
      ranger --copy-config=rc
      Then open ~/.config/ranger/rc.conf and edit Line 74 to set preview_images true and Line 117 to set preview_images_method iterm2. If you are not using iTerm2, there are also many other plugins supported by ranger for image preview. Just check out its readme.

    image

  • gpustat: A simple command-line utility for querying and monitoring GPU status. (colorful and just less than nvidia-smi)

    pipx install gpustat

    image If you have nvtop on your server, then forget all the others!

  • imgcat: Display images and gifs in your terminal emulator

    curl "https://iterm2.com/utilities/imgcat" > imgcat
    chmod +x imgcat
    mv imgcat ~/.local/bin
  • tldr: too long; don't read. A helper for command usages.

    pipx install tldr

    Usage: tldr [command] then it will teach you the common usage of the command.

    tldr

  • bashmarks: Tag directories and jump quickly.

    git clone https://github.com/huyng/bashmarks.git
    cd bashmarks
    make install
    echo 'source ~/.local/bin/bashmarks.sh' >> ~/.bashrc

    Usage: s [tagname] to set a tag name for the current dir; g [tagname] to jump to the specified dir.

  • vundle: Plugin manager for Vim

    git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

    required to clone into ~/.vim/bundle

  • [Optional] gh: Github's client.

    The server that I am using blocks SSH connection. So I insteadly use this gh to login to my github. This is even more convenient than generate a SSH key and put to public key to the github account.

    conda install gh --channel conda-forge

    Run gh auth login to authenticate with your GitHub account.

Configuration Files

Clone this repo to get the configuration files:

cd
git clone https://github.com/viridityzhu/my_linux_setup.git
  • .vimrc: vim configuration file.

    cp my_linux_setup/.vimrc ~

    To install Vim plugins from command line:

    vim +PluginInstall +qall
  • .bashrc: bash configuration file. Note that it is dangerous and unnecessary to directly copy this bash config, because it will replace the original one. Only do this with confidence. Otherwise, it is recommended to copy and paste required configurations from the .bashrc file, e.g., the alias for gpu [num] and notify_me.

    cp my_linux_setup/.bashrc ~

    [optional] Uncomment force_color_prompt=yes at around line 46.

    In this file, I predefined some useful functions:

    1. An aliases for CUDA_VISIBLE_DEVICES=xxx by simply using gpu 0, gpu 1,2, etc before commands.
    2. To ring a bell after finishing a task: notify_me [command]
  • .tmux.conf: tmux configuration file.

    git clone https://github.com/gpakosz/.tmux.git
    ln -s -f .tmux/.tmux.conf
    cp my_linux_setup/.tmux.conf.local ~

    This .tmux.conf config is borrowed from gpakosz/.tmux, containing appearance and shortcut modifications. Do read the source project for better usage. My own modifications are separated in .tmux.conf.local.

    My tmux appearance: image

    If you are new to tmux, I strongly recommend this tutorial: Tmux使用手册 (in Chinese).

Set Accessibility of your home

Finally, set the accessibility of your home dir. 700 means only yourself can read/write.

chmod 700 -R .

Set Git global user info

git config --global user.name "John Doe"
git config --global user.email johndoe@example.com

Useful commands

  • Check cuda version

    nvcc -V
  • Check gpu status

    nvidia-smi

    or

    nvtop
  • Check cpu usage:

    htop
  • List all softwares

    dpkg --get-selections
  • Output the results to a .txt file by >

    dpkg --get-selections > installed-software.txt
  • An alias for CUDA_VISIBLE_DEVICES=xxx by simply using gpu 0, gpu 1,2, etc before commands.

  • To ring a bell after finishing a task:

    notify_me [command]

About

Set up a fresh install of Linux, nicely but lightly configuring bash, tmux and vim, and plugins.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published