{"id":27371115,"url":"https://github.com/viridityzhu/my_linux_setup","last_synced_at":"2026-05-01T19:33:47.302Z","repository":{"id":158074902,"uuid":"620678877","full_name":"viridityzhu/my_linux_setup","owner":"viridityzhu","description":"Set up a fresh install of Linux, nicely but lightly configuring bash, tmux and vim, and plugins.","archived":false,"fork":false,"pushed_at":"2024-01-08T11:32:24.000Z","size":97,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-01-08T13:24:00.918Z","etag":null,"topics":["linux-shell","vim"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/viridityzhu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-03-29T06:50:38.000Z","updated_at":"2023-07-16T06:58:31.000Z","dependencies_parsed_at":"2024-01-08T13:10:21.211Z","dependency_job_id":"f22ad31e-cdbc-4466-a6e1-232b7a1dce15","html_url":"https://github.com/viridityzhu/my_linux_setup","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viridityzhu%2Fmy_linux_setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viridityzhu%2Fmy_linux_setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viridityzhu%2Fmy_linux_setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/viridityzhu%2Fmy_linux_setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/viridityzhu","download_url":"https://codeload.github.com/viridityzhu/my_linux_setup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248692664,"owners_count":21146628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linux-shell","vim"],"created_at":"2025-04-13T09:39:25.949Z","updated_at":"2026-05-01T19:33:47.289Z","avatar_url":"https://github.com/viridityzhu.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# My Linux Setup\n\nThis repo is for me to set up a fresh install of Linux with basic and useful customizations.\n\n## Features\n\n- Set up a fresh install of Linux nicely and lightly (within 10 mins).\n- Customized appearances and keybinds for bash, tmux, and vim.\n- Light but cool plugins, such as ranger, tldr, and bashmarks.\n- Suitable for vim+tmux+conda users.\n\n## Download Useful Softwares\n\n- ~~Conda~~ I find [uv](https://github.com/astral-sh/uv) as a more modern alternative.\n\n  Download a latest Miniconda `.sh` installer: [https://docs.conda.io/en/latest/miniconda.html#linux-installers](https://docs.conda.io/en/latest/miniconda.html#linux-installers);\n  Alternately, directly download use wget:\n  ```bash\n  wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh\n  ```\n  Then install:\n  ```bash\n  sh Miniconda3-latest-Linux-x86_64.sh\n  ```\n  *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.*\n\n- [pipx](https://pypa.github.io/pipx/): install and run end-user applications written in Python, providing isolated environment.\n  *You may need to reload your server to let conda refresh before going to the following steps.*\n  ```bash\n  python3 -m pip install --user pipx\n  python3 -m pipx ensurepath\n  python3 -m pip install --user --upgrade pipx\n  ```\n\n- ~~[Ranger](https://github.com/ranger/ranger): A VIM-inspired filemanager for the console. **Now you have a colorful and structural file manager!**~~ Although I still love ranger, its successor, [Yazi](https://github.com/sxyazi/yazi), is written in Rust, faster, and more modern, so I have moved on. And there is no need to write installation instructions anymore; just ask AI to handle it.\n  ```bash\n  pipx install ranger-fm\n  ```\n  Usage: Use command `ranger` to open a file system window that is very cool.\n  \n  Tip: If you are also using iTerm2 on MacOS, you can easily **preview images** in ranger by following the steps below:\n  1. In the menu bar of iTerm2, select `iTerm2 -\u003e Install Shell Integration`. (In a session which is connected to your remote Linux server via ssh)\n  2. Config ranger:\n     ```bash\n     ranger --copy-config=rc\n     ```\n     Then open `~/.config/ranger/rc.conf` and edit Line 74 to `set preview_images true` and Line 117 to `set preview_images_method iterm2`.\n  If you are not using iTerm2, there are also many other plugins supported by ranger for image preview. Just check out its [readme](https://github.com/ranger/ranger).\n  \n  ![image](https://user-images.githubusercontent.com/39082096/229707017-516f3dd9-d278-4522-ae49-9c1d946291f4.png)\n  \n- [gpustat](https://github.com/wookayin/gpustat): A simple command-line utility for querying and monitoring GPU status. (colorful and just less than `nvidia-smi`)\n  ```bash\n  pipx install gpustat\n  ```\n  ![image](https://user-images.githubusercontent.com/39082096/235125924-21a18062-808e-4dc1-855c-899c5a551938.png)\n  **If you have `nvtop` on your server, then forget all the others!**\n  \n- [imgcat](https://github.com/danielgatis/imgcat): Display images and gifs in your terminal emulator\n  ```bash\n  curl \"https://iterm2.com/utilities/imgcat\" \u003e imgcat\n  chmod +x imgcat\n  mv imgcat ~/.local/bin\n  ```\n\n- [tldr](https://github.com/tldr-pages/tldr): too long; don't read. A helper for command usages.\n  ```bash\n  pipx install tldr\n  ```\n  Usage: `tldr [command]` then it will teach you the common usage of the command.\n  \n  ![tldr](https://github.com/tldr-pages/tldr/blob/main/images/tldr-dark.png)\n\n- [bashmarks](https://github.com/huyng/bashmarks): Tag directories and jump quickly.\n  ```bash\n  git clone https://github.com/huyng/bashmarks.git\n  cd bashmarks\n  make install\n  echo 'source ~/.local/bin/bashmarks.sh' \u003e\u003e ~/.bashrc\n  ```\n  Usage: `s [tagname]` to set a tag name for the current dir; `g [tagname]` to jump to the specified dir.\n\n- [vundle](https://github.com/VundleVim/Vundle.vim): Plugin manager for Vim\n  ```bash\n  git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim\n  ```\n  *required to clone into `~/.vim/bundle`*\n  \n- *\\[Optional\\]* [gh](https://cli.github.com/manual/): Github's client.\n\n  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.\n  ```bash\n  conda install gh --channel conda-forge\n  ```\n  Run `gh auth login` to authenticate with your GitHub account.\n  \n\n## Configuration Files\nClone this repo to get the configuration files:\n```bash\ncd\ngit clone https://github.com/viridityzhu/my_linux_setup.git\n```\n\n- `.vimrc`: `vim` configuration file.\n  ```bash\n  cp my_linux_setup/.vimrc ~\n  ```\n  To install Vim plugins from command line: \n  ```bash\n  vim +PluginInstall +qall\n  ```\n\n- `.bashrc`: bash configuration file.\n  **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`.**\n  ```bash\n  cp my_linux_setup/.bashrc ~\n  ```\n\n  *\\[optional\\] Uncomment `force_color_prompt=yes` at around line 46.*\n\n  In this file, I predefined some useful functions:\n  1. An aliases for `CUDA_VISIBLE_DEVICES=xxx` by simply using `gpu 0`, `gpu 1,2`, etc before commands.\n  2. To ring a bell after finishing a task: `notify_me [command]`\n\n- `.tmux.conf`: `tmux` configuration file. \n  ```bash\n  git clone https://github.com/gpakosz/.tmux.git\n  ln -s -f .tmux/.tmux.conf\n  cp my_linux_setup/.tmux.conf.local ~\n  ```\n  This `.tmux.conf` config is borrowed from [gpakosz/.tmux](https://github.com/gpakosz/.tmux), containing appearance and shortcut modifications. Do read the source project for better usage.\n  My own modifications are separated in `.tmux.conf.local`.\n  \n  My tmux appearance:\n  ![image](https://user-images.githubusercontent.com/39082096/229707926-2f3a6482-a18e-4383-8da2-781472df7f96.png)\n\n  If you are new to `tmux`, I strongly recommend this tutorial: [Tmux使用手册](https://louiszhai.github.io/2017/09/30/tmux/) (in Chinese).\n\n \n## Set Accessibility of your home\n\nFinally, set the accessibility of your home dir. `700` means only yourself can read/write.\n```bash\nchmod 700 -R .\n```\n\n## Set Git global user info\n\n```bash\ngit config --global user.name \"John Doe\"\ngit config --global user.email johndoe@example.com\n```\n\n## My Setup v2.0 - zsh shell\n\n\u003e I am now more familiar with zsh rather than bash. Luckily I left brief notes for the zsh setup. Let me copy it here.\n\n### Install zsh\n\n1. Installation requires root permission. You can still check if there is already zsh installed via: `cat /etc/shell`. For example, you may find: `/usr/bin/zsh`\n2. Use `chsh --shell zsh` to change user's default shell.\n3. However, this requires you to have real user permission. If you don't even have that, for example, on a lab cluster, you can use this semi-permanent way: add this to the end of `~/.bashrc`:\n\t```bash\n\t# If this terminal is interactive, switch to zsh\n\tif [[ $- == *i* ]]; then\n\t    exec zsh\n\tfi\n\t```\n4. Before jumping into zsh, let's install `oh-my-zsh` to ease the configuration of everything. It will replace your default `.zshrc` file with its fancy template that is easy to start with.\n\n\n### Configure zsh\n\n#### 1. old configs\n\nThe first thing is to copy the useful configs in `.bashrc` into the new config file: `.zshrc`. For example, conda initialization, and your self-defined functions.\n\n#### 2. zsh theme/prompt\n\n- The original zsh already supports thousands of themes, and you can easily change them by altering `ZSH_THEME='xxx'`. Go to their website to find a favorite.  It even supports randomly selecting a theme each time you log in:\n- Otherwise, `powerlevel10k` is all you need. It is faster than the original themes, is easy to configure, and supports proper customization.\n\n#### 3. zsh plugins\n\nIn the `.zshrc` file, easily enable plugins like this:\n\n```bash\nplugins=(git zsh-syntax-highlighting zsh-autosuggestions autojump fd fzf)\n```\n\n`zsh-syntax-highlighting`, `zsh-autosuggestions`, and `fzf` are almost necessary. Search for them and install one by one, and do nothing since oh-my-zsh will help load them.\n\n#### 4. others\n\n1. `fzf` is for fuzzy finder. It needs additional configurations to be more powerful\n2. install `bat` for better highlighted `cat [file]`. But it seems not easy to install if I have not root permission ;)\n\n## Useful commands\n  \n- Check cuda version\n  ```bash\n  nvcc -V\n  ```\n\n- Check gpu status\n  ```bash\n  nvidia-smi\n  ```\n  or\n  ```bash\n  nvtop\n  ```\n\n- Check cpu usage: \n  ```bash\n  htop\n  ```\n \n- List all softwares\n  ```bash\n  dpkg --get-selections\n  ```\n\n- Output the results to a `.txt` file by `\u003e`\n  ```bash\n  dpkg --get-selections \u003e installed-software.txt\n  ```\n\n- An alias for `CUDA_VISIBLE_DEVICES=xxx` by simply using `gpu 0`, `gpu 1,2`, etc before commands.\n  \n- To ring a bell after finishing a task:\n  ```bash\n  notify_me [command]\n  ```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviridityzhu%2Fmy_linux_setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fviridityzhu%2Fmy_linux_setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fviridityzhu%2Fmy_linux_setup/lists"}