diff --git a/tasks/files/command-picker/command-picker.sh b/tasks/files/command-picker/command-picker.sh index 4dd2b55..b853926 100644 --- a/tasks/files/command-picker/command-picker.sh +++ b/tasks/files/command-picker/command-picker.sh @@ -1,10 +1,14 @@ # Command picker using fzf commands() { - local cmd - cmd=$(grep -vE '^[[:space:]]*#|^[[:space:]]*$' ~/.config/commands/linux.txt | + local selection cmd + + selection=$(grep -vE '^[[:space:]]*#|^[[:space:]]*$' ~/.config/commands/linux.txt | fzf --height 50% --layout=reverse --border --prompt='Command: ') - if [[ -n "$cmd" ]]; then + if [[ -n "$selection" ]]; then + cmd=$(printf '%s\n' "$selection" | sed 's/[[:space:]]*#.*$//') + cmd="${cmd%"${cmd##*[![:space:]]}"}" + READLINE_LINE="$cmd" READLINE_POINT=${#READLINE_LINE} fi diff --git a/tasks/files/command-picker/linux.txt b/tasks/files/command-picker/linux.txt index abffe6c..9c1f723 100644 --- a/tasks/files/command-picker/linux.txt +++ b/tasks/files/command-picker/linux.txt @@ -1,27 +1,136 @@ -# ===== Proxmox ===== -pveversion -v -qm list -pct list -pvesm status +# SYSTEM -# ===== Docker ===== -docker ps -docker compose ps -docker compose logs -f -docker stats +hostname # Show hostname +hostnamectl # Show system hostname and OS information +uptime # Show system uptime and load +uname -a # Show kernel information +cat /etc/os-release # Show Linux distribution information +whoami # Show current username +id # Show current user and group IDs +date # Show current date and time +timedatectl # Show system time and timezone +free -h # Show memory usage +nproc # Show number of CPU cores +lscpu # Show CPU information -# ===== Disk ===== -lsblk -f -df -h -du -sh * -sudo smartctl -a /dev/sda +# STORAGE -# ===== Network ===== -ip addr -ip route -ss -tulpn +df -h # Show filesystem disk usage +df -hT # Show filesystem usage and filesystem types +du -sh * # Show sizes of items in current directory +lsblk # List block devices +lsblk -f # List block devices with filesystem information +blkid # Show block device UUIDs and filesystem types +findmnt # Show mounted filesystems +mount # Show mounted filesystems +sudo fdisk -l # List disk partitions -# ===== Files ===== -ls -lah -find . -maxdepth 2 -type f -rsync -avh --progress SOURCE/ DEST/ +# NETWORK + +ip addr # Show network interfaces and IP addresses +ip -br addr # Show concise network interface information +ip route # Show routing table +ip -br link # Show concise link status +ss -tulpn # Show listening TCP and UDP ports +ss -tunap # Show active network connections +ping -c 4 8.8.8.8 # Test network connectivity +curl -I https://example.com # Show HTTP response headers +dig example.com # Query DNS +resolvectl status # Show DNS resolver status +hostname -I # Show local IP addresses + +# SYSTEMD + +systemctl --failed # Show failed systemd units +systemctl list-units --type=service --state=running # Show running services +systemctl list-units --type=service --state=failed # Show failed services +systemctl status docker # Show Docker service status +journalctl -xe # Show recent system journal errors +journalctl -b # Show logs from current boot +journalctl -p err -b # Show errors from current boot +journalctl --disk-usage # Show journal disk usage + +# PROCESSES + +ps aux # Show all running processes +ps aux --sort=-%cpu | head # Show top CPU-consuming processes +ps aux --sort=-%mem | head # Show top memory-consuming processes +top # Interactive process monitor +htop # Interactive process monitor +pgrep -a process-name # Find processes by name +lsof -i # Show network connections by process + +# PACKAGES + +apt list --upgradable # Show available package updates +apt policy package-name # Show package version information +dpkg -l # List installed packages +dpkg -l | grep package-name # Search installed packages +apt-cache search package-name # Search available packages + +# FILES + +ls -lah # List files with details +pwd # Show current directory +find . -maxdepth 1 -type f # Find files in current directory +find . -type f -name "*.log" # Find log files recursively +du -sh ./* # Show sizes of items in current directory +stat filename # Show file metadata +file filename # Identify file type +namei -l /path/to/file # Show path permissions + +# USERS + +who # Show logged-in users +w # Show logged-in users and activity +last # Show recent logins +getent passwd # List local and directory users +getent group # List groups +groups # Show current user's groups +sudo -l # Show current user's sudo privileges + +# DOCKER + +docker ps # List running containers +docker ps -a # List all containers +docker images # List Docker images +docker volume ls # List Docker volumes +docker network ls # List Docker networks +docker stats # Show container resource usage +docker system df # Show Docker disk usage +docker compose ps # Show Compose container status +docker compose images # Show Compose images +docker compose logs -f # Follow Compose logs + +# GIT + +git status # Show repository status +git log --oneline -10 # Show last 10 commits +git log --oneline --decorate -10 # Show recent commits with branch information +git branch # Show local branches +git branch -a # Show all branches +git remote -v # Show Git remote URLs +git diff # Show uncommitted changes + +# HARDWARE + +lspci # List PCI devices +lsusb # List USB devices +lsmem # Show memory information +lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS # Show detailed storage layout +sudo dmidecode -t system # Show system hardware information + +# SSH + +sshd -T # Show effective SSH server configuration +ssh -v localhost # Test SSH connection with verbose output +lastlog # Show last login for users + +# DISK / FILESYSTEM DIAGNOSTICS + +sudo dmesg -T | tail -50 # Show recent kernel messages +sudo dmesg -T | grep -i error # Search kernel messages for errors +sudo journalctl -k -b # Show kernel logs from current boot +sudo smartctl --scan # Detect available SMART devices +sudo smartctl -H /dev/sdX # Show SMART health status +sudo smartctl -a /dev/sdX # Show complete SMART information