Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

What have you added to bashrc?

Here you can discuss every aspect of Debian. Note: not for support requests!
Post Reply
Message
Author
User avatar
craigevil
Posts: 5391
Joined: 2006-09-17 03:17
Location: heaven
Has thanked: 28 times
Been thanked: 39 times

What have you added to bashrc?

#1 Post by craigevil »

This is what I have added to my .bashrc

Code: Select all

## Added Options ##

# Powerline 
# Powerline is a statusline plugin 
# https://github.com/powerline/powerline
. /usr/share/powerline/bindings/bash/powerline.sh

# Midnight Commander
# GNU Midnight Commander is a visual file manager
# https://midnight-commander.org/
. /usr/lib/mc/mc.sh

# ibus-typing-booster
# Description: Completion input method to speedup typing
# https://mike-fabian.github.io/ibus-typing-booster/documentation.html#adding-to-desktop
export GTK_IM_Module=ibus
export XMODIFIERS=@im=ibus
export QT_IM_Modules=ibus

# thefuck https://github.com/nvbn/thefuck
# Description: spelling corrector of console commands
eval $(thefuck --alias)
# You can use whatever you want as an alias, like for Mondays:
# eval $(thefuck --alias ****)
# Experimental mode https://github.com/nvbn/thefuck#experimental-instant-mode
# eval $(thefuck --alias --enable-experimental-instant-mode)

# fzf https://github.com/junegunn/fzf#fuzzy-completion-for-bash-and-zsh
# fzf is a general-purpose command-line fuzzy finder
# Info /usr/share/doc/fzf/README.Debian
# Enable fzf keybindings for Bash 
source /usr/share/doc/fzf/examples/key-bindings.bash
# Enable fuzzy auto-completion for Bash (Not needed on Debian)
#source /usr/share/doc/fzf/examples/completion.bash

# Fix PATH
PATH=$PATH:/home/pi/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/pi/.local/bin:

# yarn node package manager https://yarnpkg.com/
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"

# nvm Nodejs version manager https://github.com/nvm-sh/nvm
. ~/.node_bashrc
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

### Added by surfraw. https://gitlab.com/surfraw/Surfraw 
### To remove use surfraw-update-path -remove
	export PATH=$PATH:/usr/lib/surfraw
### End surfraw addition.
Last edited by craigevil on 2022-03-18 14:56, edited 3 times in total.
Raspberry PI 400 Distro: Raspberry Pi OS Base: Debian Sid Kernel: 5.15.69-v8+ aarch64 DE: MATE Ram 4GB
Debian - "If you can't apt install something, it isn't useful or doesn't exist"
My Giant Sources.list

southern_admin
Posts: 9
Joined: 2021-11-12 20:58
Has thanked: 1 time
Been thanked: 2 times

Re: What have you added to bashrc?

#2 Post by southern_admin »

I like to live on the edge:

Code: Select all

me@here:~$ cat .bashrc
cat: .bashrc: No such file or directory
me@here:~$

User avatar
Bloom
df -h | grep > 90TiB
df -h | grep > 90TiB
Posts: 503
Joined: 2017-11-11 12:23
Been thanked: 26 times

Re: What have you added to bashrc?

#3 Post by Bloom »

Mine is this:

Code: Select all

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

red='\e[0;31m'
RED='\e[1;31m'
blue='\e[0;34m'
BLUE='\e[1;34m'
cyan='\e[0;36m'
CYAN='\e[1;36m'
green='[\e[0;32m'
GREEN='\e[1;32m'
yellow='\e[0;33m'
YELLOW='\e[1;33m'
PURPLE='\e[1;35m'
purple='\e[0;35m'
nc='\e[00m'

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

#EDITORS
export EDITOR='/usr/bin/leafpad'
export VISUAL=$EDITOR
export PAGER='/usr/bin/less'

# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
	# We have color support; assume it's compliant with Ecma-48
	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
	# a case would tend to support setf rather than setaf.)
	color_prompt=yes
    else
	color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    #PS1="${debian_chroot:+($debian_chroot)}$GREEN\u@\h$nc:$BLUE\w$nc\$ "
    #PS1='${debian_chroot:+($debian_chroot)}\[$GREEN\]\u@\h\[$nc\]:\[$BLUE\]\w\[$nc\]\$ '
    #PS1="$GREEN\u@\h$nc:$BLUE$(WD=$PWD;[[ $PWD = /home/$USER ]] && WD='~';if [[ ${#PWD} > 20 ]];then WD='...'${PWD: -20};fi;echo $WD)$nc\$"
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    #alias grep='grep --color=auto'
    #alias fgrep='fgrep --color=auto'
    #alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi
export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
[ -d "$JAVA_HOME/bin" ] && export PATH="$JAVA_HOME/bin;$PATH"
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
  if  [ ! $(echo $PATH|grep $HOME) ]; then
     export PATH="$HOME/bin:$PATH"
  fi
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi
clear
if [ ! -r ~/bin/bigtimegreet.sh ]; then
  . ~/doliz
fi
~/bin/bigtimegreet.sh
The most important modifications by me are inclusion of my own bin directory into the system PATH, checking if the bigtimegreet.sh exists in my home bin and if not, starting my LizardFS mounts which include my home bin and working directories like Documents, Pictures, Music, Videos and Downloads: they reside all on my central storage system. Bigtimegreet.sh is run at the start of each terminal opening and shows a greeting in big characters.
It uses figlet (that's in the standard Debian repos) and looks like this:

Code: Select all

#!/bin/sh
hourOfDay=$(date +%H)
dayPart="nacht"
if [ $hourOfDay -ge 6 ] 
 then 
   if [ $hourOfDay -lt 12 ]
    then
      dayPart="morgen" 
    else
      if [ $hourOfDay -lt 18 ]
       then
	 dayPart="middag"    
       else
 	if [ $hourOfDay -lt 24 ]
         then
	  dayPart="navond"
	fi
      fi
   fi
fi
figlet Goede$dayPart
If presents a greeting in Dutch like this:

Code: Select all

  ____                _                                           
 / ___| ___   ___  __| | ___ _ __ ___   ___  _ __ __ _  ___ _ __  
| |  _ / _ \ / _ \/ _` |/ _ \ '_ ` _ \ / _ \| '__/ _` |/ _ \ '_ \ 
| |_| | (_) |  __/ (_| |  __/ | | | | | (_) | | | (_| |  __/ | | |
 \____|\___/ \___|\__,_|\___|_| |_| |_|\___/|_|  \__, |\___|_| |_|
                                                 |___/ 
Which means "good morning" in Dutch.

User avatar
donald
Debian Developer, Site Admin
Debian Developer, Site Admin
Posts: 1041
Joined: 2021-03-30 20:08
Has thanked: 185 times
Been thanked: 240 times

Re: What have you added to bashrc?

#4 Post by donald »

Lots of new users will attempt to modify their setups in ignorance, so to ease the plethora of 'Help me' threads, ideally when sharing a setup in this thread you need to explicitly detail what the changes and benefits are. Please edit where applicable.

The below loads my SSH keys at the first bash prompt for all of my remote systems, this keeps my ssh remotes in queue for ease of use. Be mindful of this preload on any public or shared computer, it will not end well.

Code: Select all

# start the ssh-agent
function start_agent {
            echo "Initializing new SSH agent..."
        # spawn ssh-agent
    /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
    echo succeeded
    chmod 600 "${SSH_ENV}"
    . "${SSH_ENV}" > /dev/null
    /usr/bin/ssh-add $HOME/.ssh/id_rsa $HOME/.ssh/id_rsa_$FOO
    }

   if [ -f "${SSH_ENV}" ]; then
   . "${SSH_ENV}" > /dev/null
   ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
   start_agent;
    }
   else
  start_agent;
   fi
This will also pick up 2nd, 3rd, and all keys in that DIR. Be careful with this "cheat" for SSH key preloads.
Typo perfectionish.


"The advice given above is all good, and just because a new message has appeared it does not mean that a problem has arisen, just that a new gremlin hiding in the hardware has been exposed." - FreewheelinFrank

reinob
Posts: 1189
Joined: 2014-06-30 11:42
Has thanked: 97 times
Been thanked: 45 times

Re: What have you added to bashrc?

#5 Post by reinob »

@donald,

I had a similar setup to yours to pre-load my ssh keys...
.. until I discovered keychain (# apt install keychain).

Now my .bashrc_local (run from .bashrc)
has this

Code: Select all

KEYS=$(cd ~/.ssh; ls -1 id_* | grep -v ".pub\$")
eval $(keychain --eval --quiet $KEYS)
and it works like a charm.

User avatar
canci
Global Moderator
Global Moderator
Posts: 2497
Joined: 2006-09-24 11:28
Has thanked: 135 times
Been thanked: 134 times

Re: What have you added to bashrc?

#6 Post by canci »

Thanks for this post! It reminds me to tidy up my .bashrc one of these days. xD

That's why I'll just share just a few highlights from mine:

Vim mode in my terminal (going dw on misspelled commands is pure heaven):

Code: Select all

set -o vi
and my PS1:

Code: Select all

export PS1="\[\e[32m\]\u\[\e[m\]\[\e[32m\]@\[\e[m\]\[\e[32m\]\h\[\e[m\]  | \[\e[32m\]\\$\[\e[m\] | \[\e[33m\]\w\[\e[m\] | "
which yields this:

Image
Image Stable / Asus VivoBook X421DA / AMD Ryzen 7 3700U / Radeon Vega Mobile Gfx (Picasso) / 8 GB RAM / 512GB NVMe

READ THIS:

* How to Post a Thread Here
* Other Tips and Great Resources

CwF
Global Moderator
Global Moderator
Posts: 2625
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 190 times

Re: What have you added to bashrc?

#7 Post by CwF »

canci wrote: 2021-11-15 15:22 which yields this:
Neato!

I lost track of a mod I liked, now can't figure it out?

How can we seed the prompt with a space so that the command is not entered into history, unless we intentionally backspace the space...?

My attempts just add a space, that is part of the prompt and not a "user" space entry to be backspaced if needed.

User avatar
NorthEast
Posts: 348
Joined: 2018-11-18 04:35
Has thanked: 12 times
Been thanked: 30 times

Re: What have you added to bashrc?

#8 Post by NorthEast »

Because I sometimes forget all the aliases I have set in .bashrc, I included this one:
alias aliases='grep alias /home/tom/.bashrc'
It includes the commented out aliases which "alias" alone doesn't show.
Last edited by NorthEast on 2022-03-21 23:44, edited 3 times in total.

User avatar
Zoot
df -h | grep > 90TiB
df -h | grep > 90TiB
Posts: 163
Joined: 2010-01-12 15:27
Location: Ireland
Has thanked: 5 times
Been thanked: 3 times

Re: What have you added to bashrc?

#9 Post by Zoot »

Here's what I've added:

Code: Select all

############################
# Added Config
############################
# Directory Sizes, Paths, Copy Aliases
############################
alias lf='readlink -f'
alias cp_dir='rsync -av --info=progress2'
alias dir-sizes='du -hs * | sort -rh'
alias dir-sizes10='du -hs * | sort -rh | head -10'
alias file-count='ls | wc -l'

##########################
# Ping Commands
##########################
# Stop after sending after 5 packets
alias ping='ping -c 5'

###########################
# Alias to Quickly Identify Media-Pool Drives
###########################
alias list-drives='/home/administrator/scripts/hdd/list-drives'

###########################
# Aliases to Call the Backup Scripts
###########################
#alias df='df -h | sort -k 6'
#alias backup_storage1='/home/administrator/scripts/backups/storage1/backup-storage1'
#alias backup_media1='/home/administrator/scripts/backups/media1/backup-media1'
#alias mirror_media1='/home/administrator/scripts/backups/media1/mirror-media1'
#alias backup_media2='/home/administrator/scripts/backups/media2/backup-media2'
#alias mirror_media2='/home/administrator/scripts/backups/media2/mirror-media2'
#alias backup_media3='/home/administrator/scripts/backups/media3/backup-media3'
#alias mirror_media3='/home/administrator/scripts/backups/media3/mirror-media3'
#alias backup_media4='/home/administrator/scripts/backups/media4/backup-media4'
#alias mirror_media4='/home/administrator/scripts/backups/media4/mirror-media4'

###########################
# SnapRAID Script Aliases
###########################
snapraid-sync='/Appdata/snapraid/snapraid-daily/snapraid-daily'
snapraid-scrub='/Appdata/snapraid/snapraid-scrub/snapraid-scrub'

###########################
# Aliases to call file downloading
# scripts directly
###########################
alias download_files='/home/administrator/scripts/download/download_files'
alias batch_download_files='/home/administrator/scripts/download/batch_download_files'

###########################
# Livbirt alias for managing Qemu/KVM
# as a user other than root
###########################
alias virsh='virsh --connect qemu:///system'

###########################
# PS Commands
##########################
alias ps="ps auxf"

# Get top process eating cpu
alias pscpu="ps auxf | sort -nr -k 3"
alias pscpu10="ps auxf | sort -nr -k 3 | head -10"

# Get top process eating memory
alias psmem="ps auxf | sort -nr -k 4"
alias psmem10="ps auxf | sort -nr -k 4 | head -10"

# Free and Used Ram
alias meminfo="free -m -l -t"
alias free="free -mt"

###########################
# Pimp the Bash Prompt
###########################
export PS1="\[\e[01;33m\]\u : \[\e[m\]\[\e[01;36m\]\h\[\e[m\] @ \[\e[01;32m\]\w\[\e[m\] $ "

sirfer
Posts: 32
Joined: 2013-05-15 23:13
Location: Auckland, New Zealand
Has thanked: 14 times
Been thanked: 2 times

Re: What have you added to bashrc?

#10 Post by sirfer »

Code: Select all

PATH=$PATH:/sbin
Pisses me off every time I do a fresh install that this isn't in the PATH variable by default :lol:

User avatar
donald
Debian Developer, Site Admin
Debian Developer, Site Admin
Posts: 1041
Joined: 2021-03-30 20:08
Has thanked: 185 times
Been thanked: 240 times

Re: What have you added to bashrc?

#11 Post by donald »

Again, please detail what your addition to bashrc does. We may be experienced but some new users will plug things into their systems and break their systems with unexpected behaviours.
Typo perfectionish.


"The advice given above is all good, and just because a new message has appeared it does not mean that a problem has arisen, just that a new gremlin hiding in the hardware has been exposed." - FreewheelinFrank

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1398
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 78 times
Been thanked: 173 times

Re: What have you added to bashrc?

#12 Post by steve_v »

Very little, but here's a few quick and dirty functions/aliases I find handy:

Quicky tar (with zstd) up a directory, appending the current date/time:

Code: Select all

function tardate() { IFS=$'\t' tar --zstd -cvf "${1}"-$(date +%d%m%y-%H%M%S).tar.zst "${1}"; }
Lowercase stuff:

Code: Select all

alias tolower="rename 'y/A-Z/a-z/' ${1}"
Automate bind mounting stuff for chroots:

Code: Select all

function chrootmount() {
    if [ -d "${1}" ]; then
        mount -v -t proc /proc "${1}"/proc
        mount -v --rbind /sys "${1}"/sys
        mount -v --rbind /dev "${1}"/dev
        cp -v /etc/resolv.conf "${1}"/etc/resolv.conf
    else echo "Argument is not a directory."
    fi
}
Map ATA disk IDs (i.e. model & serial) to /dev/sd[x] names, and print useful SMART stats:

Code: Select all

alias diskids='ls -l /dev/disk/by-id/ata-* | grep -v part | awk "{print \$11,\$9;}" | cut -d"/" -f3- | sort'

alias diskchk='for disk in $(diskids | cut -d" " -f1); do echo --- $disk ---; smartctl -a /dev/$disk | egrep "Model|Serial|health|Power_On|Load_Cycle|194 Temperature|Reallocated_Event|Pending|Uncorrectable|# 1"; echo -e -----------\\n\\n; done'
Stream system audio over HTTP (to an MPD server in another room):

Code: Select all

alias loopstream='printf "Streaming system audio on port 8080\n"; ffmpeg -hide_banner -f alsa -acodec pcm_s24le -i loop -listen 1 -f ogg -c:a flac http://:8080'
SSH into ancient machines:

Code: Select all

alias oldssh='ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-dss -c aes128-cbc'
... Also a bunch of Gentoo specific stuff, but that's irrelevant here :P
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

User avatar
sunrat
Administrator
Administrator
Posts: 6382
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 115 times
Been thanked: 456 times

Re: What have you added to bashrc?

#13 Post by sunrat »

sirfer wrote: 2022-03-13 10:23

Code: Select all

PATH=$PATH:/sbin
Pisses me off every time I do a fresh install that this isn't in the PATH variable by default :lol:
I don't understand. Whose PATH do you expect it to be in? It is definitely in my root PATH by default. /sbin is now a symlink to /usr/sbin BTW.

Code: Select all

# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
It is not and should not be in user PATH. /usr/sbin/ only contains executables which need admin privileges.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

sirfer
Posts: 32
Joined: 2013-05-15 23:13
Location: Auckland, New Zealand
Has thanked: 14 times
Been thanked: 2 times

Re: What have you added to bashrc?

#14 Post by sirfer »

sunrat wrote: 2022-03-13 11:48 I don't understand. Whose PATH do you expect it to be in? It is definitely in my root PATH by default. /sbin is now a symlink to /usr/sbin BTW.

Code: Select all

# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
It is not and should not be in user PATH. /usr/sbin/ only contains executables which need admin privileges.
Sorry I meant the path for root user and it is definitely *never* in the default root PATH on any install I have done in the last few years. FYI I always use a netinst and roll openbox etc from there.

Every install I've done in the last forever, due to upgrading hardware etc, does not have /sbin in the root PATH variable...and I always forget so if I type "fdisk -l" for e.g. I get "command not found" until I add "PATH=$PATH:/sbin" into /root/.bashrc

Of course I would never dream of putting /sbin or /usr/sbin in a user $PATH

Code: Select all

# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
Is my root user PATH if I don't add /sbin, and I thought this was a known thing as read a few bits about it since /sbin was excluded from the root PATH from Debian 10(??) anyways I find it annoying AF, but hey if I hated it that much I could always ask for a refund :P

User avatar
sunrat
Administrator
Administrator
Posts: 6382
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 115 times
Been thanked: 456 times

Re: What have you added to bashrc?

#15 Post by sunrat »

sirfer wrote: 2022-03-13 22:20Is my root user PATH if I don't add /sbin, and I thought this was a known thing as read a few bits about it since /sbin was excluded from the root PATH from Debian 10(??) anyways I find it annoying AF, but hey if I hated it that much I could always ask for a refund :P
Root PATH was not changed to exclude /sbin. What was changed since Buster is the way to change to root environment now needs to be made with su - . If you do su without the dash it elevates privileges but retains the user environment.
Read this:
viewtopic.php?f=16&t=142973
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

sirfer
Posts: 32
Joined: 2013-05-15 23:13
Location: Auckland, New Zealand
Has thanked: 14 times
Been thanked: 2 times

Re: What have you added to bashrc?

#16 Post by sirfer »

sunrat wrote: 2022-03-13 22:55 Root PATH was not changed to exclude /sbin. What was changed since Buster is the way to change to root environment now needs to be made with su - . If you do su without the dash it elevates privileges but retains the user environment.
Read this:
viewtopic.php?f=16&t=142973
Why thank you sir! TIL lol

I vaguely recall reading somewhere that /sbin was excluded from the root PATH for security reasons, but thanks for setting me straight on that score.

CwF
Global Moderator
Global Moderator
Posts: 2625
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 190 times

Re: What have you added to bashrc?

#17 Post by CwF »

sunrat wrote: 2022-03-13 22:55 Read this:
viewtopic.php?f=16&t=142973
...just wanted to mention that the recommendation from the sick pig is even more accurate today.
polkit (pkexec) can, and for me does, entirely negate su, su -, and even sudo. In the years since that post most of the missing details have been completed. It works best WITH a root account present, main difference...

Post Reply