diff --git a/README.md b/README.md
index d8346f1..b5ab587 100644
--- a/README.md
+++ b/README.md
@@ -1,25 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## The Devil Is In The Defaults
+
> If you hold a unix shell up to your ear, can you hear the C?
-# The Devil Is In The Defaults
+Setup server shell with `vscode`, `nvim`, `nu`, `bun`, `node`, `helix`, `starship prompt`, `pacstall installer`, and other dev tools.
-`vscode`, `nvim`, `nu`, `bun`, `node`, `helix`, `starship prompt` and other dev tools.
+## Install: Bash Script to Setup Shell
-## System Info When Opening Shell
+```bash
+sudo bash -c "$( wget -q https://raw.githubusercontent.com/vtempest/server-shell-setup/refs/heads/master/install-shell.sh -O -)"
+```
- 👤 user@XPS15 🔝 0% fish 📁 1% 🌎 130.212.146.39 👮 California State University 📈 Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz 💻 Debian GNU/Linux 12 (bookworm) 🔧 5.15.90.1-microsoft-standard-WSL2 🚀 apt docker git npm pip
+Note: Launch Ubuntu server instance, connect and on first time login run `sudo passwd $USER` to set password. You need to enter sudo password when running this setup
-`wget -qO- https://raw.githubusercontent.com/vtempest/server-shell-setup/master/systeminfo.sh | bash`
+## Example: System Info When Opening Shell
+```bash
+👤 user@XPS15 🔝 0% fish 📁 1% 🌎 130.212.146.39 👮 California State University
+📈 Intel(R) Core(TM) i5-7300HQ CPU @ 2.50GHz 💻 Debian GNU/Linux 12 (bookworm)
+🔧 5.15.90.1-microsoft-standard-WSL2 🚀 apt docker git npm pip
+```
-## Reference Docs - 🪄 Magic Spells for Open Sourcery
+## Reference Docs: 🪄 Magic Spells for Open Sourcery
- [nushell Docs](https://www.nushell.sh/book/)
- [Fish Features Overview](https://medium.com/the-glitcher/fish-shell-3ec1a6cc6128)
- [Fish Playground](https://rootnroll.com/d/fish-shell/)
- [Bun.js Runtime Docs](https://bun.sh/docs)
- [Node.js Best Packages](https://github.com/sindresorhus/awesome-nodejs)
-- [nvm Node Installer](https://github.com/nvm-sh/nvm)
+- [Volta Node Installer](https://docs.volta.sh/guide/)
- [pnpm Package Installer](https://pnpm.io/pnpm-cli)
- [Starship Prompt](https://starship.rs/guide/#%F0%9F%9A%80-installation)
- [VSCode Docs](https://code.visualstudio.com/docs)
diff --git a/clean-server-disk.sh b/clean-server-disk.sh
new file mode 100644
index 0000000..7619327
--- /dev/null
+++ b/clean-server-disk.sh
@@ -0,0 +1,215 @@
+#!/bin/bash
+
+# Comprehensive Disk Space Cleanup Script
+# WARNING: This script performs aggressive cleanup. Review before running.
+# Run with sudo privileges
+
+# Color definitions
+RED='\033[0;31m'
+GREEN='\033[0;32m'
+YELLOW='\033[1;33m'
+BLUE='\033[0;34m'
+NC='\033[0m'
+
+# Check for root privileges
+if [ "$EUID" -ne 0 ]; then
+ echo -e "${RED}Error: Please run as root (sudo)${NC}"
+ exit 1
+fi
+
+# Function to print section headers
+print_header() {
+ echo -e "\n${BLUE}=== $1 ===${NC}"
+}
+
+# Function to print success messages
+print_success() {
+ echo -e "${GREEN}✓ $1${NC}"
+}
+
+# Function to format sizes
+format_size() {
+ local size=$1
+ if [ $size -gt 1073741824 ]; then
+ echo "$(awk "BEGIN {printf \"%.2f\", $size/1024/1024/1024}") GB"
+ elif [ $size -gt 1048576 ]; then
+ echo "$(awk "BEGIN {printf \"%.2f\", $size/1024/1024}") MB"
+ elif [ $size -gt 1024 ]; then
+ echo "$(awk "BEGIN {printf \"%.2f\", $size/1024}") KB"
+ else
+ echo "${size} B"
+ fi
+}
+
+# Get initial disk usage
+initial_usage=$(df -B1 / | awk 'NR==2 {print $3}')
+
+print_header "Starting Aggressive Disk Cleanup"
+echo -e "${YELLOW}⚠️ This will perform a thorough system cleanup${NC}"
+sleep 2
+
+# 1. Package Manager Cleanup
+print_header "Package Manager Cleanup"
+
+if command -v apt-get &> /dev/null; then
+ # APT cleanup
+ apt-get clean -y
+ apt-get autoremove -y
+ apt-get autoclean -y
+ rm -rf /var/lib/apt/lists/*
+ print_success "APT cache and unused packages cleaned"
+
+elif command -v yum &> /dev/null; then
+ # YUM cleanup
+ yum clean all
+ yum autoremove -y
+ print_success "YUM cache and unused packages cleaned"
+
+elif command -v dnf &> /dev/null; then
+ # DNF cleanup
+ dnf clean all
+ dnf autoremove -y
+ print_success "DNF cache and unused packages cleaned"
+fi
+
+# 2. Docker Cleanup (if installed)
+print_header "Docker Resource Cleanup"
+
+if command -v docker &> /dev/null; then
+ docker system prune -af --volumes
+ docker builder prune -af
+ rm -rf ~/.docker/buildx
+ print_success "Docker resources cleaned"
+fi
+
+# 3. Log File Cleanup
+print_header "Log Cleanup"
+
+# System logs
+find /var/log -type f -name "*.log" -exec truncate -s 0 {} \;
+find /var/log -type f -name "*.gz" -delete
+find /var/log -type f -name "*.old" -delete
+find /var/log -type f -name "*.1" -delete
+find /var/log -type f -name "*.2" -delete
+find /var/log -type f -name "*.rotated" -delete
+
+# Journal logs
+if command -v journalctl &> /dev/null; then
+ journalctl --vacuum-time=3d
+ journalctl --vacuum-size=100M
+fi
+
+print_success "System logs cleaned"
+
+# 4. Cache Cleanup
+print_header "Cache Cleanup"
+
+# Browser caches (for all users)
+find /home -type f -path "*/cache/*" -delete
+find /home -type f -path "*/.cache/*" -delete
+find /root -type f -path "*/cache/*" -delete
+find /root -type f -path "*/.cache/*" -delete
+
+# Thumbnail cache
+find /home -type f -path "*/.thumbnails/*" -delete
+rm -rf ~/.thumbnails/*
+
+# Font cache
+fc-cache -f
+
+# Man page cache
+if command -v mandb &> /dev/null; then
+ rm -rf /var/cache/man/*
+ mandb
+fi
+
+print_success "System caches cleaned"
+
+# 5. Temp Files Cleanup
+print_header "Temporary Files Cleanup"
+
+# System temp directories
+rm -rf /tmp/*
+rm -rf /var/tmp/*
+
+# User specific temp files
+find /home -type f -name "*.tmp" -delete
+find /home -type f -name "*.temp" -delete
+find /home -type f -name "tmp.*" -delete
+
+# Crash reports and core dumps
+rm -rf /var/crash/*
+rm -rf /var/cores/*
+echo "kernel.core_pattern=|/bin/false" > /etc/sysctl.d/50-coredump.conf
+sysctl -p /etc/sysctl.d/50-coredump.conf
+
+print_success "Temporary files cleaned"
+
+# 6. Old Kernel Cleanup
+print_header "Kernel Cleanup"
+
+# Keep only the current and one previous kernel version
+if command -v dpkg &> /dev/null; then
+ current_kernel=$(uname -r | sed 's/-*[a-z].*//g' | sed 's/-$//')
+ dpkg -l 'linux-*' | sed '/^ii/!d;/'"${current_kernel}"'/d' | awk '{print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e '[0-9]' | xargs apt-get -y purge
+fi
+
+print_success "Old kernels cleaned"
+
+# 7. Application Specific Cleanup
+print_header "Application Specific Cleanup"
+
+# Clean pip cache
+if command -v pip3 &> /dev/null; then
+ pip3 cache purge
+fi
+
+# Clean npm cache
+if command -v npm &> /dev/null; then
+ npm cache clean --force
+fi
+
+# Clean yarn cache
+if command -v yarn &> /dev/null; then
+ yarn cache clean
+fi
+
+# Clean snapd cache
+if command -v snap &> /dev/null; then
+ snap set system refresh.retain=2
+ rm -rf /var/lib/snapd/cache/*
+fi
+
+# Clean flatpak unused runtimes
+if command -v flatpak &> /dev/null; then
+ flatpak uninstall --unused -y
+fi
+
+print_success "Application caches cleaned"
+
+# 8. User Cleanup
+print_header "User Directory Cleanup"
+
+# Clean user Downloads folders older than 30 days
+find /home/*/Downloads -type f -atime +30 -delete 2>/dev/null
+
+# Remove old bash history
+find /home -type f -name ".bash_history" -exec sh -c 'echo "" > {}' \;
+
+print_success "User directories cleaned"
+
+# Calculate space freed
+final_usage=$(df -B1 / | awk 'NR==2 {print $3}')
+space_freed=$((initial_usage - final_usage))
+formatted_space=$(format_size $space_freed)
+
+print_header "Cleanup Complete"
+echo -e "${GREEN}Total space freed: $formatted_space${NC}"
+
+# Show current disk usage
+echo -e "\n${YELLOW}Current Disk Usage:${NC}"
+df -h / | awk 'NR==1{print} NR==2{print}'
+
+# Optional: Sync disks and clear RAM cache
+sync
+echo 3 > /proc/sys/vm/drop_caches
diff --git a/install-shell.sh b/install-shell.sh
index 61b0c7e..0b063f7 100644
--- a/install-shell.sh
+++ b/install-shell.sh
@@ -3,48 +3,72 @@
# setup shell with best dev tools on Ubuntu
# fish, nushell, nvim, helix, node, bun, pacstall, docker
+# sudo passwd ${USER} # set password for user
+# INSTALL:
+# sudo bash -c "$( wget -q https://raw.githubusercontent.com/vtempest/server-shell-setup/refs/heads/master/install-shell.sh -O -)"
+
setup_shell(){
#add fish nvim helix to ubuntu PPA
- sudo apt-add-repository ppa:fish-shell/release-3
- sudo add-apt-repository ppa:neovim-ppa/stable
- sudo add-apt-repository ppa:maveonair/helix-editor
+ echo -e '\n' | sudo apt-add-repository ppa:fish-shell/release-3
+ echo -e '\n' | sudo add-apt-repository ppa:neovim-ppa/stable
+ echo -e '\n' | sudo add-apt-repository ppa:maveonair/helix-editor
sudo apt update
sudo apt install -y fish neovim git wget curl helix
- # fish plugins config
- curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install | fish
- omf install fzf nvm
#bun
curl -fsSL https://bun.sh/install | bash
- #node
- wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash;
- nvm install node
-
+ #node with volta
+ bash -c "$(curl -sS https://get.volta.sh )"
+
+ source ~/.bashrc
+ bash -c "volta install node"
+
#install nushell
npm i -g pnpm nushell
#nvim config
git clone https://github.com/LazyVim/starter ~/.config/nvim
+
+ #install greeting
+ sudo wget https://raw.githubusercontent.com/vtempest/server-shell-setup/refs/heads/master/systeminfo.sh -O ~/.config/systeminfo.sh
+ sudo chmod +x ~/.config/systeminfo.sh
+ sudo echo "bash ~/.config/systeminfo.sh" >> ~/.bashrc
+ sudo echo "bash ~/.config/systeminfo.sh" >> ~/.config/fish/config.fish
+
+
+ #pacstall - discover 3rd party deb packages
+ yes | sudo bash -c "$(curl -fsSL https://pacstall.dev/q/install || wget -q https://pacstall.dev/q/install -O -)"
+
#clear default greeting
- sudo rm /etc/motd; sudo rm -rf /etc/update-motd.d; touch ~/.hushlogin;
+ fish -c "set -U fish_greeting \"\""
+ sudo rm -f /etc/motd; sudo rm -rf /etc/update-motd.d; touch ~/.hushlogin;
+
+
+ # fish plugins config - goes into fish
+ curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install > omf-install.sh
+ chmox +x omf-install.sh
+ fish -c "./omf-install.sh --path=~/.local/share/omf --config=~/.config/omf"
+ fish -c "omf install fzf nvm"
+ rm -f omf-install.sh
- #starship prompt
- curl -sS https://starship.rs/install.sh | sh
+
+ #starship prompt -- needs manual setup
+ sudo sh -c "$(curl -sS https://starship.rs/install.sh )"
#install prompt into nu shell
- echo "mkdir ~/.cache/starship; starship init nu | save -f ~/.cache/starship/init.nu" >> (/home/$USER/.config/nushell/env.nu)
- echo "use ~/.cache/starship/init.nu" >> (/home/$USER/.config/nushell/config.nu)
+ echo "mkdir ~/.cache/starship; starship init nu | save -f ~/.cache/starship/init.nu" >> /home/$USER/.config/nushell/env.nu
+ echo "use ~/.cache/starship/init.nu" >> /home/$USER/.config/nushell/config.nu
#install prompt into fish shell
echo "starship init fish | source" >> ~/.config/fish/config.fish
- #pacstall - discover 3rd party deb packages
- curl -fsSL https://pacstall.dev/q/install | bash
+
+
}
@@ -73,3 +97,4 @@ setup_root(){
#run main
setup_shell
+setup_docker
\ No newline at end of file
diff --git a/systeminfo.sh b/systeminfo.sh
index bb1a42f..92f071b 100644
--- a/systeminfo.sh
+++ b/systeminfo.sh
@@ -7,7 +7,10 @@
system_info(){
#user
- echo -ne "\e[31m👤 $(whoami)\e[0m@\e[91m$(hostname)"
+ echo -ne "\e[31m👤$(whoami) "
+
+ #hostname
+ echo -ne "\e[91m🏠$(hostname)"
#top_process
export TOP_PROC=$(ps -eo pcpu,comm --sort=-%cpu --no-headers \
@@ -18,18 +21,18 @@ system_info(){
export DISK_USED=$(df | grep '/$' | awk '{print $5}')
echo -ne "\e[35m 📁 $DISK_USED"
- #ip
- INFO=$(wget -qO- -T1 ipinfo.io)
- export IP=$(echo $INFO | grep -oP 'ip\": "\K[^"]+')
- echo -ne "\e[32m 🌎 $IP"
+ # Get IP info or exit with error message
+ INFO=$(wget -qO- -T1 ipinfo.io 2>/dev/null) || { echo -e "\033[31m ❌ No internet connection"; exit 1; }
- #city
- export CITY=$(echo $INFO | grep -oP 'city\": "\K[^"]+')
- echo -ne "\e[32m 🌎 $CITY"
+ # Extract info (IP and city will show regardless of domain presence)
+ IP=$(echo "$INFO" | grep -oP 'ip"\s*:\s*"\K[^"]+' 2>/dev/null)
+ CITY=$(echo "$INFO" | grep -oP 'city"\s*:\s*"\K[^"]+' 2>/dev/null)
+ DOMAIN=$(echo "$INFO" | grep -oP 'hostname"\s*:\s*"\K[^"]+' 2>/dev/null)
- #domain (if available)
- export DOMAIN=$(echo $INFO | grep -oP 'hostname\": "\K[^"]+')
- if [ $DOMAIN ]; then echo -ne "\e[37m 🤖 $DOMAIN"; fi
+ # network ip and external isp domain name
+ [ -n "$IP" ] && echo -ne "\033[32m 🌎 ${IP:-No IP}"|| echo -ne "\033[37m 🌎 No Network"
+ [ -n "$CITY" ] && echo -ne "\033[32m 📍 ${CITY:-No City}"
+ [ -n "$DOMAIN" ] && echo -ne "\033[37m 🔗 http://$DOMAIN"
#isp
export ISP=$(echo $INFO | grep -oP 'org\": "\K[^"]+' | cut -f 1 -d ' ' --complement)
@@ -43,7 +46,7 @@ system_info(){
#os
export OS=$([ -f /etc/os-release ] && grep -oP "^NAME=\"\K[^\"]+" /etc/os-release)
- echo -ne "\e[34m 💻 $OS"
+ echo -ne "\e[34m ⚡ $OS"
#device
if test -f /sys/devices/virtual/dmi/id/product_name; then
@@ -58,11 +61,10 @@ system_info(){
# package managers - system and languages
# remove less common ones to save load time
echo -ne "\e[31m 🚀"
- for cmd in "apt" "npm" "pip" "docker"\
- \ "hx" "nvim" "bun"
+ for cmd in "apt" "npm" "pip" "docker" "hx" "nvim" "bun" \
# \ "pkg" "flatpak" "yum" "snap" "pacman"\
- # \ "apk" "brew" "bun"
- do
+ # \ "apk" "brew" "yarn" "pnpm" "cargo" "gem" "go"
+ do
if [ -x "$(command -v $cmd)" ]; then
echo -ne " "$cmd;
fi