From 5a41da5881a11ba3fdc3890c342aa3b7eb53e0cf Mon Sep 17 00:00:00 2001 From: Mohammad Reza Karimi Date: Tue, 16 Dec 2025 13:27:11 -0500 Subject: add initial version (incomplete) --- bash/README.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 bash/README.md (limited to 'bash/README.md') diff --git a/bash/README.md b/bash/README.md new file mode 100644 index 0000000..7262dbf --- /dev/null +++ b/bash/README.md @@ -0,0 +1,64 @@ +# Notes for using bash as root + +You can copy the gentoo color script to the root user: + +```sh +sudo cp ~/dotfiles/bash/dot-config/bash/gentoo-color.bash /root/.gentoo-color.bash +sudo cp /etc/skel/.bash_profile /root/ +``` + +and set its `bashrc` as follows: + +```bash +# +# /root/.bashrc +# + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +source "$HOME"/.gentoo-color.bash + +ls() +{ + if ((gentoo_color > 0)); then + command ls --color=auto "$@" + else + command ls "$@" + fi +} + +# coreutils +alias cp='cp -riv' +alias la='ls -la' +alias ll='ls -lah' +alias l='ls -l' +alias ls='ls -p -hN --group-directories-first' +alias mkdir='mkdir -pv' +alias mv='mv -iv' +alias rm='rm -iv' +alias ..='echo "cd .."; cd ..' +alias ...='echo "cd ../.."; cd ../..' + +alias SS='systemctl' +alias p='pacman' +alias v='nvim' + +lf() +{ + export LF_CD_FILE=/tmp/.lfcd-root-$$ + command lf "$@" + if [ -s "$LF_CD_FILE" ]; then + local DIR + DIR="$(realpath "$(cat "$LF_CD_FILE")")" + if [ "$DIR" != "$PWD" ]; then + echo "cd to $DIR" + cd "$DIR" || exit + fi + command rm "$LF_CD_FILE" + fi + unset LF_CD_FILE +} + +bind '"\C-o":"\C-ulf\C-m"' +``` -- cgit v1.2.3-71-gdd5e