- The target audience for this project:
Linux
system administrators- Personal
Mac
users
- This project aims to provide a better terminal usage experience:
- For administrators:
- Simplify the user distribution process (including permission isolation, group setting, key distribution, configuration of commonly used tools such as
zsh/vim/tmux
, etc.); - Provide convenient user broadcast function;
- Simplify the user distribution process (including permission isolation, group setting, key distribution, configuration of commonly used tools such as
- For users:
- Rely on
oh-my-zsh
and its plugin ecosystem to get a convenient and comfortableShell
experience. - Rely on the scripts provided by the
shell
programming of this project to implement a series of functions such as fuzzy jumping and history record fuzzy search.
- Rely on
- For administrators:
- This project has a total of
3
branches:linux
Branch: Suitable for mainstreamLinux
systems withLinux kernel >= 5
, providing administrators with complete functions.linux-minimum
Branch: Suitable for mainstreamlinux
systems withLinux kernel < 5
, providing administrators with some functions.mac-personal
Branch: Suitable formacOS
, providing individual users with some functions.
Branch Name | Adapted System | Administrator Functions | User Functions |
---|---|---|---|
linux | Ubuntu(>= 19.04) Debian/Raspbian >= 10.0 |
1. User distribution; 2. User broadcast | 1. Common tool configuration 2. Convenience enhancement script |
linux-minimum | Ubuntu(< 19.04) Debian/Raspbian < 10.0 CentOS7/8 |
1. User distribution; 2. User broadcast | 1. Common user configuration |
mac-personal | MacOS >= 11.0 |
No | 1. Convenience enhancement script |
The fuzzy jumping function largely relies on the two modern tools
fzf
andfd
. This project is only a stitching tool for the glue layer.
- The administrator's user distribution function is fully interactive and can choose a series of functions such as user grouping, user permission
visudo
settings, user key distribution, etc.
- The essence of user broadcasting is that all users will load
/opt/lab-server-ops/lso_user/script_broadcast/broadcast.sh
- Administrators only need to modify this file to implement the user broadcast function.
#.zshrc
# ------------------- broadcast ---------------------
bash "/opt/lab-server-ops/lso_user/script_broadcast/broadcast.sh"
- Users generated through distribution have pre-configured basic tools
- The
.vimrc/.zshrc/.tmux.conf
under the user's directory have been pre-configured - The public and private keys under the user's directory
.ssh
have been pre-configured
- You can make fuzzy jumps and edits between directories
- You can fuzzy query the history record
- Please make sure your system is one of
Deiban/Raspbian/Ubuntu/CentOS/MacOS
. - If your system is
Ubuntu(>= 19.04)
orDebian/Raspbian >= 10.0
, please execute
git checkout linux
- If your system is
Ubuntu(< 19.04)
orDebian/Raspbian < 10.0
orCentOS7/8
, please execute
git checkout linux-minimum
- If your system is
macOS
please execute
git checkout mac-personal
This project has the function of automatically detecting the operating system. If the branch does not meet the requirements, automatic switching will be performed
- Pull the project
git clone https://github.com/Albert26193/lab-server-ops.git
# branch: linux
git checkout linux
- Install dependencies
# enter project
cd ./install
# install dependency
sudo bash install_dependency.sh
The following dependencies will be installed
local install=(
"tmux"
"vim"
"git"
"curl"
"wget"
"tree"
"fd-find"
"fzf"
"bat"
"exa"
"nvim"
)
- Install the project
sudo bash install.sh
- Add administrator command entry
Please add the following command to your
.zshrc/.bashrc
according to your actual situation
source "/opt/lab-server-ops/lso_admin/lso.sh"
Then execute the following command to reload the configuration file
source ~/.zshrc
# or source ~/.bashrc
- Pull the project
git clone https://github.com/Albert26193/lab-server-ops.git
# branch: linux-minimum
git checkout linux-minimum
- Install dependencies
# enter project
cd ./install
# install dependency
sudo bash install_dependency.sh
The following dependencies will be installed
local install=(
"tmux"
"vim"
"git"
"curl"
"wget"
"tree"
)
- Install the project
sudo bash install.sh
- Add administrator command entry
Please add the following command to your
.zshrc/.bashrc
according to your actual situation
source "/opt/lab-server-ops/lso_admin/lso.sh"
Then execute the following command to reload the configuration file
source ~/.zshrc
# or source ~/.bashrc
- Pull the project
git clone https://github.com/Albert26193/lab-server-ops.git
# branch: mac-personal
git checkout mac-personal
- Install dependencies
- 🛑 You need to ensure that
brew
is installed locally in advance
# enter project
cd ./install
# install dependency
bash install_dependency.sh
The following dependencies will be installed
local install=(
"tmux"
"vim"
"git"
"curl"
"wget"
"tree"
"fd"
"fzf"
"bat"
"exa"
"nvim"
)
- Install the project
bash install.sh
- After the installation is complete, your
.zshrc
or.bashrc
should have added the command entry
source "/opt/lab-server-ops/lso_admin/lso.sh"
- Then, execute the following command
lso_admin
- The output is as follows
-
In the interactive panel, you will have two options
- Add new users:
useradd
, enter1
- Add
zsh
related configuration for existing users:addzsh
, enter2
- Add new users:
-
Then, you can interactively select user settings (grouping, key, creating symbolic links, etc.) 🍺️
- The commands that ordinary users can get can be viewed in
.zshrc
# ~/.zshrc
# ------------------ lab-server-ops ----------------
source "${HOME}/.lso.env"
source "/opt/lab-server-ops/lso_user/lso.sh"
alias "fs"="lso_fuzzy_search"
alias "fj"="lso_fuzzy_jump"
alias "fe"="lso_fuzzy_edit"
alias "hh"="lso_fuzzy_history"
alias "pon"="lso_proxy_on"
alias "poff"="lso_proxy_off"
fs
:fuzzy search
fuzzy search, accepts two parameters, can perform fuzzy matching on directories, its configuration please refer to~/.lso.env
fj
:fuzzy jump
fuzzy jump, accepts two parameters, can perform fuzzy jump on directories, its configuration please refer to~/.lso.env
fe
:fuzzy edit
fuzzy edit, accepts two parameters, can perform fuzzy edit on directories, its configuration please refer to~/.lso.env
, the editor defaults tovim
, you can replace it with other editors.hh
:fuzzy history
fuzzy history match, accepts two parameters, can perform fuzzy search and match on allzsh
history records.pon
:proxy on
, can forward the currentshell
traffic, accepts two parameters, parameter 1 is the target server IP address, parameter 2 is the target server portpoff
:proxy off
, turn off proxy
If there are no related commands in
.zshrc
, it means that theLinux
version is not enough, and thelinux-minimum
related commands are loaded
- The configuration part is for the
.lso.env
file, this file controls the range of fuzzy adjustment and indexing, you can freely addignore
directories and query range directories. - The default configuration is as follows
#!/bin/bash
# in which dir to search
lso_search_dirs=(
"${HOME}"
#"CodeSpace"
)
# within search range, which dir to ignore
lso_search_ignore_dirs=(
# "Downloads"
# "Desktop"
# "Documents"
".git"
".local"
".m2"
".gradle"
".wns"
".nvm"
".npm"
".nrm"
".red-hat"
".redhat"
".oh-my-zsh"
".github"
".cache"
".cargo"
".rustup"
".vscode"
".vscode-insiders"
".vscode-server-insiders"
".vscode-server"
".vscode-oss"
".vscode-oss-insiders"
"lib"
"node_modules"
"pkg"
"bin"
"dist"
"pkgs"
"from-github"
"assets"
"image"
"images"
"static"
"data"
"raycast"
"obsidian-*"
"zlt-*"
"anaconda3"
"Applications"
"Library"
"Movies"
"Music"
"Pictures"
"Public"
"Remote"
"Zotero"
"EVPlayer2_download"
)
# search preview or not, true: preview | false: not preview
# if your machine is not powerful enough(RAM <= 1GiB), set it to false
# otherwise, set it to true(Recommend)
lso_search_preview=true
#lso_search
- Add command audit function
- Add administrator functions related to deleting users
- Add administrator functions related to network and disk