This repo is for me to set up a fresh install of Linux with basic and useful customizations.
- 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.
-
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 anapt
, 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:
- In the menu bar of iTerm2, select
iTerm2 -> Install Shell Integration
. (In a session which is connected to your remote Linux server via ssh) - Config ranger:
Then open
ranger --copy-config=rc
~/.config/ranger/rc.conf
and edit Line 74 toset preview_images true
and Line 117 toset 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.
- In the menu bar of iTerm2, select
-
gpustat: A simple command-line utility for querying and monitoring GPU status. (colorful and just less than
nvidia-smi
)pipx install gpustat
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. -
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.
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 forgpu [num]
andnotify_me
.cp my_linux_setup/.bashrc ~
[optional] Uncomment
force_color_prompt=yes
at around line 46.In this file, I predefined some useful functions:
- An aliases for
CUDA_VISIBLE_DEVICES=xxx
by simply usinggpu 0
,gpu 1,2
, etc before commands. - To ring a bell after finishing a task:
notify_me [command]
- An aliases for
-
.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
.If you are new to
tmux
, I strongly recommend this tutorial: Tmux使用手册 (in Chinese).
Finally, set the accessibility of your home dir. 700
means only yourself can read/write.
chmod 700 -R .
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
-
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 usinggpu 0
,gpu 1,2
, etc before commands. -
To ring a bell after finishing a task:
notify_me [command]