From c1137c7804cc32f9a3de91b3e121fbba3a7ffbb9 Mon Sep 17 00:00:00 2001 From: dandrews Date: Mon, 14 Sep 2026 17:28:31 -0500 Subject: [PATCH 1/2] Personalize .bashrc: editor defaults, pager, and alias cleanup Documents the local customizations to the tracked .bashrc in this clone (~/linuxtoolbox/mybash), which is the live file via the ~/.bashrc symlink created by setup.sh. Relative to upstream main: 35 insertions, 63 deletions. Interactive-shell guard - Add an early `[[ $- != *i* ]] && return` so non-interactive shells leave the file before running interactive-only setup. Editor defaults (nvim -> gedit) - EDITOR/VISUAL: nvim -> gedit. - pico/spico now map to gedit; nano/snano map to nano. - Add `alias vi='nvim'` alongside the existing `alias vim='nvim'`. Aliases - ls: `ls -aFh` -> `ls -laFh --color=always` (long format by default). - less: add `-R --use-color -Dd+r -Du+b`. - man: add `alias man="man -P most"`. - svi: now `sudo nvim`; add `findall="sudo find / | grep "`. - ebrc -> editrc (`gedit ~/.bashrc`). - Re-enable the GREP_OPTIONS block and the `grep` alias. - Remove the `freshclam`, `web`, and `hug` (hugo server) aliases. Pager and man-page colors - Relocate the LESS_TERMCAP_* definitions to the tail of the file, switch them from `$'\E[...'` to `printf '\e[...'`, adjust the md/so/us colors, and add `export PAGER="most"`. Startup hooks - Add `. "$HOME/.atuin/bin/env"` after `atuin init bash`. Removals - Drop the redundant `install_bashrc_support()` helper. Known issues carried in this change, deliberately not fixed here: - `export sgedit='sudo gedit'` creates an environment variable rather than an alias, so `sgedit` is not invocable from an interactive shell. - `alias nano='nano'` is a self-referential no-op. - GREP_OPTIONS was removed in GNU grep 2.21; this host ships 3.11, so the re-enabled GREP_OPTIONS block has no effect. - `man -P most` and `PAGER=most` depend on the `most` package. Verified: `bash -n .bashrc` passes. gedit, most, nvim, starship, zoxide, atuin, and trash are all present on this host, and ~/.atuin/bin/env exists. Co-Authored-By: Warp --- .bashrc | 98 +++++++++++++++++++++------------------------------------ 1 file changed, 35 insertions(+), 63 deletions(-) diff --git a/.bashrc b/.bashrc index cec3a70..53710ac 100644 --- a/.bashrc +++ b/.bashrc @@ -1,4 +1,7 @@ #!/bin/bash +# If not running interactively, don’t do anything +[[ $- != *i* ]] && return + iatest=$(expr index "$-" i) ####################################################### @@ -52,13 +55,15 @@ if [[ $iatest -gt 0 ]]; then bind "set completion-ignore-case on"; fi if [[ $iatest -gt 0 ]]; then bind "set show-all-if-ambiguous On"; fi # Set the default editor -export EDITOR=nvim -export VISUAL=nvim -alias pico='edit' -alias spico='sedit' -alias nano='edit' -alias snano='sedit' +export EDITOR=gedit +export VISUAL=gedit +export sgedit='sudo gedit' +alias pico='gedit' +alias spico='gedit' +alias nano='nano' +alias snano='nano' alias vim='nvim' +alias vi='nvim' # Replace batcat with cat on Fedora as batcat is not available as a RPM in any form if command -v lsb_release >/dev/null; then @@ -74,18 +79,8 @@ fi # To have colors for ls and all grep commands such as grep, egrep and zgrep export CLICOLOR=1 export LS_COLORS='no=00:fi=00:di=00;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:*.xml=00;31:' -#export GREP_OPTIONS='--color=auto' #deprecated -alias grep="/usr/bin/grep $GREP_OPTIONS" -unset GREP_OPTIONS - -# Color for manpages in less makes manpages a little easier to read -export LESS_TERMCAP_mb=$'\E[01;31m' -export LESS_TERMCAP_md=$'\E[01;31m' -export LESS_TERMCAP_me=$'\E[0m' -export LESS_TERMCAP_se=$'\E[0m' -export LESS_TERMCAP_so=$'\E[01;44;33m' -export LESS_TERMCAP_ue=$'\E[0m' -export LESS_TERMCAP_us=$'\E[01;32m' +export GREP_OPTIONS='--color=auto' +alias grep="grep $GREP_OPTIONS" ####################################################### # MACHINE SPECIFIC ALIAS'S @@ -95,7 +90,7 @@ export LESS_TERMCAP_us=$'\E[01;32m' # alias SERVERNAME='ssh YOURWEBSITE.com -l USERNAME -p PORTNUMBERHERE' # Alias's to change the directory -alias web='cd /var/www/html' +#alias web='cd /var/www/html' # Alias's to mount ISO files # mount -o loop /home/NAMEOFISO.iso /home/ISOMOUNTDIR/ @@ -108,12 +103,15 @@ alias web='cd /var/www/html' # To temporarily bypass an alias, we precede the command with a \ # EG: the ls command is aliased, but to use the normal ls command you would type \ls +# Color Man Pages using Most instead of more +alias man="man -P most" + # Add an "alert" alias for long running commands. Use like so: # sleep 10; alert alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' # Edit this .bashrc file -alias ebrc='edit ~/.bashrc' +alias editrc='gedit ~/.bashrc' # Show help for this .bashrc file alias hlp='less ~/.bashrc_help' @@ -128,13 +126,12 @@ alias rm='trash -v' alias mkdir='mkdir -p' alias ps='ps auxf' alias ping='ping -c 10' -alias less='less -R' +alias less='less -R --use-color -Dd+r -Du+b' alias cls='clear' alias apt-get='sudo apt-get' alias multitail='multitail --no-repeat -c' -alias freshclam='sudo freshclam' alias vi='nvim' -alias svi='sudo vi' +alias svi='sudo nvim' alias vis='nvim "+set si"' # Change directory aliases @@ -153,7 +150,7 @@ alias rmd='/bin/rm --recursive --force --verbose ' # Alias's for multiple directory listing commands alias la='ls -Alh' # show hidden files -alias ls='ls -aFh --color=always' # add colors and file type extensions +alias ls='ls -laFh --color=always' # add colors and file type extensions alias lx='ls -lXBh' # sort by extension alias lk='ls -lSrh' # sort by size alias lc='ls -lcrh' # sort by change time @@ -184,6 +181,7 @@ alias topcpu="/bin/ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10" # Search files in the current folder alias f="find . | grep " +alias findall="sudo find / | grep " # Count all files (recursively) in the current folder alias countfiles="for t in files links directories; do echo \`find . -type \${t:0:1} | wc -l\` \$t; done 2> /dev/null" @@ -414,41 +412,6 @@ ver() { esac } -# Automatically install the needed support files for this .bashrc file -install_bashrc_support() { - local dtype - dtype=$(distribution) - - case $dtype in - "redhat") - sudo yum install multitail tree zoxide trash-cli fzf bash-completion fastfetch - ;; - "suse") - sudo zypper install multitail tree zoxide trash-cli fzf bash-completion fastfetch - ;; - "debian") - sudo apt-get install multitail tree zoxide trash-cli fzf bash-completion - # Fetch the latest fastfetch release URL for linux-amd64 deb file - FASTFETCH_URL=$(curl -s https://api.github.com/repos/fastfetch-cli/fastfetch/releases/latest | grep "browser_download_url.*linux-amd64.deb" | cut -d '"' -f 4) - - # Download the latest fastfetch deb file - curl -sL $FASTFETCH_URL -o /tmp/fastfetch_latest_amd64.deb - - # Install the downloaded deb file using apt-get - sudo apt-get install /tmp/fastfetch_latest_amd64.deb - ;; - "arch") - sudo paru multitail tree zoxide trash-cli fzf bash-completion fastfetch - ;; - "slackware") - echo "No install support for Slackware" - ;; - *) - echo "Unknown distribution" - ;; - esac -} - # IP address lookup alias whatismyip="whatsmyip" function whatsmyip () @@ -528,8 +491,6 @@ mysqlconfig() { sudo updatedb && locate my.cnf fi } - - # Trim leading and trailing spaces (for scripts) trim() { local var=$* @@ -571,15 +532,26 @@ function hb { ####################################################### # Set the ultimate amazing command prompt ####################################################### - -alias hug="hugo server -F --bind=10.0.0.97 --baseURL=http://10.0.0.97" +# Make Fuzzy File Finder fire up with CTRL-F Key bind '"\C-f":"zi\n"' export PATH=$PATH:"$HOME/.local/bin:$HOME/.cargo/bin:/var/lib/flatpak/exports/bin:/.local/share/flatpak/exports/bin" +# Colorful Man Pages +export LESS_TERMCAP_mb=$(printf '\e[01;31m') # enter blinking mode - red +export LESS_TERMCAP_md=$(printf '\e[01;35m') # enter double-bright mode - bold, magenta +export LESS_TERMCAP_me=$(printf '\e[0m') # turn off all appearance modes (mb, md, so, us) +export LESS_TERMCAP_se=$(printf '\e[0m') # leave standout mode +export LESS_TERMCAP_so=$(printf '\e[01;33m') # enter standout mode - yellow +export LESS_TERMCAP_ue=$(printf '\e[0m') # leave underline mode +export LESS_TERMCAP_us=$(printf '\e[04;36m') # enter underline mode - cyan +export PAGER="most" + # Install Starship - curl -sS https://starship.rs/install.sh | sh eval "$(starship init bash)" eval "$(zoxide init bash)" [[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh eval "$(atuin init bash)" + +. "$HOME/.atuin/bin/env" From 1faac98f0bf6c6b31284288d274e52400b756442 Mon Sep 17 00:00:00 2001 From: dandrews Date: Mon, 14 Sep 2026 17:39:44 -0500 Subject: [PATCH 2/2] Fix broken aliases, dead GREP_OPTIONS, and dangling sedit references Follow-up to the .bashrc customization commit. Addresses defects introduced by that change plus one pre-existing upstream breakage. - sgedit: `export sgedit='sudo gedit'` defined an environment variable rather than an alias, so `sgedit` was not invocable. Now an alias. - grep: drop the GREP_OPTIONS export and the alias that expanded it. GREP_OPTIONS is ignored by GNU grep >= 2.21 (this host has 3.11), so the block was dead code. Replaced with `alias grep='grep --color=auto'`. - nano: drop `alias nano='nano'`, a self-referential no-op, now that /usr/bin/nano is confirmed to be on PATH. - spico/snano: apply the s-prefix-means-sudo convention already used by svi and sgedit. `spico` was an exact duplicate of `pico`; it is now `sudo gedit`, and `snano` is now `sudo nano`. - sedit: 13 call sites across apacheconfig(), phpconfig() and mysqlconfig() invoked a command defined nowhere on the system (no alias, no function, no binary), so all three functions were broken. They were equally broken upstream, which only ever referenced sedit without defining it. Repointed at the `sgedit` alias, which is also semantically correct: every target is a root-owned file under /etc. - most: `alias man='man -P most'` and `export PAGER='most'` assumed the `most` package, which setup.sh does not install. Both now sit behind a `command -v most` guard, so `man` falls back to its default pager instead of failing on a machine without it. Verified: `bash -n .bashrc` passes; each corrected alias resolves when sourced in a clean `bash --norc` shell; `type -a nano` resolves to /usr/bin/nano. On this host `most` is installed, so pager behavior is unchanged from before this commit. Co-Authored-By: Warp --- .bashrc | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/.bashrc b/.bashrc index 53710ac..04a2071 100644 --- a/.bashrc +++ b/.bashrc @@ -57,11 +57,10 @@ if [[ $iatest -gt 0 ]]; then bind "set show-all-if-ambiguous On"; fi # Set the default editor export EDITOR=gedit export VISUAL=gedit -export sgedit='sudo gedit' +alias sgedit='sudo gedit' alias pico='gedit' -alias spico='gedit' -alias nano='nano' -alias snano='nano' +alias spico='sudo gedit' +alias snano='sudo nano' alias vim='nvim' alias vi='nvim' @@ -79,8 +78,7 @@ fi # To have colors for ls and all grep commands such as grep, egrep and zgrep export CLICOLOR=1 export LS_COLORS='no=00:fi=00:di=00;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:*.xml=00;31:' -export GREP_OPTIONS='--color=auto' -alias grep="grep $GREP_OPTIONS" +alias grep='grep --color=auto' ####################################################### # MACHINE SPECIFIC ALIAS'S @@ -103,9 +101,6 @@ alias grep="grep $GREP_OPTIONS" # To temporarily bypass an alias, we precede the command with a \ # EG: the ls command is aliased, but to use the normal ls command you would type \ls -# Color Man Pages using Most instead of more -alias man="man -P most" - # Add an "alert" alias for long running commands. Use like so: # sleep 10; alert alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' @@ -442,9 +437,9 @@ apachelog() { # Edit the Apache configuration apacheconfig() { if [ -f /etc/httpd/conf/httpd.conf ]; then - sedit /etc/httpd/conf/httpd.conf + sgedit /etc/httpd/conf/httpd.conf elif [ -f /etc/apache2/apache2.conf ]; then - sedit /etc/apache2/apache2.conf + sgedit /etc/apache2/apache2.conf else echo "Error: Apache config file could not be found." echo "Searching for possible locations:" @@ -455,15 +450,15 @@ apacheconfig() { # Edit the PHP configuration file phpconfig() { if [ -f /etc/php.ini ]; then - sedit /etc/php.ini + sgedit /etc/php.ini elif [ -f /etc/php/php.ini ]; then - sedit /etc/php/php.ini + sgedit /etc/php/php.ini elif [ -f /etc/php5/php.ini ]; then - sedit /etc/php5/php.ini + sgedit /etc/php5/php.ini elif [ -f /usr/bin/php5/bin/php.ini ]; then - sedit /usr/bin/php5/bin/php.ini + sgedit /usr/bin/php5/bin/php.ini elif [ -f /etc/php5/apache2/php.ini ]; then - sedit /etc/php5/apache2/php.ini + sgedit /etc/php5/apache2/php.ini else echo "Error: php.ini file could not be found." echo "Searching for possible locations:" @@ -474,17 +469,17 @@ phpconfig() { # Edit the MySQL configuration file mysqlconfig() { if [ -f /etc/my.cnf ]; then - sedit /etc/my.cnf + sgedit /etc/my.cnf elif [ -f /etc/mysql/my.cnf ]; then - sedit /etc/mysql/my.cnf + sgedit /etc/mysql/my.cnf elif [ -f /usr/local/etc/my.cnf ]; then - sedit /usr/local/etc/my.cnf + sgedit /usr/local/etc/my.cnf elif [ -f /usr/bin/mysql/my.cnf ]; then - sedit /usr/bin/mysql/my.cnf + sgedit /usr/bin/mysql/my.cnf elif [ -f ~/my.cnf ]; then - sedit ~/my.cnf + sgedit ~/my.cnf elif [ -f ~/.my.cnf ]; then - sedit ~/.my.cnf + sgedit ~/.my.cnf else echo "Error: my.cnf file could not be found." echo "Searching for possible locations:" @@ -545,7 +540,11 @@ export LESS_TERMCAP_se=$(printf '\e[0m') # leave standout mode export LESS_TERMCAP_so=$(printf '\e[01;33m') # enter standout mode - yellow export LESS_TERMCAP_ue=$(printf '\e[0m') # leave underline mode export LESS_TERMCAP_us=$(printf '\e[04;36m') # enter underline mode - cyan -export PAGER="most" +# Use `most` for man pages and general paging when it is available +if command -v most >/dev/null 2>&1; then + alias man='man -P most' + export PAGER='most' +fi # Install Starship - curl -sS https://starship.rs/install.sh | sh eval "$(starship init bash)"