Show off your bash - .rc, that is

For interesting topics. But remember this is a Linux Forum. Do not post offensive topics that are meant to cause trouble with other members or are derogatory towards people of different genders, race, color, minors (this includes nudity and sex), politics or religion. Let's try to keep peace among the community and for visitors.

No spam on this or any other forums please! If you post advertisements on these forums, your account may be deleted.

Do not copy and paste entire or even up to half of someone else's words or articles into posts. Post only a few sentences or a paragraph and make sure to include a link back to original words or article. Otherwise it's copyright infringement.

You can talk about other distros here, but no MX bashing. You can email the developers of MX if you just want to say you dislike or hate MX.
Message
Author
Vektor
Posts: 118
Joined: Fri Jul 30, 2021 8:00 pm

Show off your bash - .rc, that is

#1 Post by Vektor »

The screenshot put up by "siamhie" in MX Respins really got me wanting more. Especially the bash mods.

So I am showing my bash in hopes others will do likewise.

If you can also show the code that would be cool too.

Code: Select all

WELCOME VEKTOR 
demo
Sat 30 Apr 2022 09:05:21 PM EDT
SHORTCUTS ===   drivetree = disk-usage = foldertree = gt5 = ncdu =
                emptydir-MNT-SDA5-PORTEUS = MX-EMPTY-DIRECTORY-STRUCTURE = 
                FOLDERS-2-TGZ-HERE = EJECT-OPICAL-DISK = 
                rclone = SSH-START = SSH-RESTART = SSH-STOP =
                SSH-DOLPHIN-COMPAQ-LILY-MX-19-4 =
                SSH-KONSOLE-COMPAQ-LILY-MX-19-4 =
                SSH-DOLPHIN-MX-1 = SSH-KONSOLE-MX-1 = 
                SSH-DOLPHIN-VIC-MX-21-1 =
                SSH-KONSOLE-VIC-MX-21-1 =
                Open-Port-Check = active-network =              
                lower-UPPER = UPPER-lower =
                APT-GET-UPDATE = APT-GET-UPGRADE = APT-GET-INSTALL =
COPY-PASTE ===  e4defrag -c target = DISK USAGE df -h --total -T --type=PICK-ONE fuse.rclone ext4 ntfs fat32 =

Code: Select all

echo "WELCOME VEKTOR 
$(whoami)
$(date)
SHORTCUTS ===   drivetree = disk-usage = foldertree = gt5 = ncdu =
                emptydir-MNT-SDA5-PORTEUS = MX-EMPTY-DIRECTORY-STRUCTURE = 
                FOLDERS-2-TGZ-HERE = EJECT-OPICAL-DISK = 
                rclone = SSH-START = SSH-RESTART = SSH-STOP =
                SSH-DOLPHIN-COMPAQ-LILY-MX-19-4 =
                SSH-KONSOLE-COMPAQ-LILY-MX-19-4 =
                SSH-DOLPHIN-MX-1 = SSH-KONSOLE-MX-1 = 
                SSH-DOLPHIN-VIC-MX-21-1 =
                SSH-KONSOLE-VIC-MX-21-1 =
                Open-Port-Check = active-network =              
                lower-UPPER = UPPER-lower =
                APT-GET-UPDATE = APT-GET-UPGRADE = APT-GET-INSTALL =
COPY-PASTE ===  e4defrag -c target = DISK USAGE df -h --total -T --type=PICK-ONE fuse.rclone ext4 ntfs fat32 = " 
# Setup color scheme <brokenman> for list call
alias ll='/bin/ls --color=auto -lF'
alias la='/bin/ls --color=auto -axF'
alias ls='/bin/ls --color=auto -xF'
# VEKTORS ALIAS
# alias =''
alias foldertree='tree --du --si'
alias gt5='gt5 --max-depth 20 --with-mounts'
alias drivetree='tree /dev/disk'
alias rclone='/usr/bin/rclone config'
alias emptydir-MNT-SDA5-PORTEUS='/mnt/sda5/porteus/2-OPTIONAL/EMPTY-DIRECTORY-STRUCTURE/EMPTY-DIRECTORY-STRUCTURE.desktop'
alias MX-EMPTY-DIRECTORY-STRUCTURE='find -type d | cpio -pd /live/boot-dev/MX/EMPTY-DIRECTORY-STRUCTURE/'
alias FOLDERS-2-TGZ-HERE='for dir in */; do
  # remove trailing slash
  dir=`echo $dir | tr -d '/'`
  tar czf "${output_path}${dir}.tgz" "$dir"
done'
alias EJECT-OPICAL-DISK='eject'
alias disk-usage='df -h --total -T'
alias Open-Port-Check='netstat -an | grep --color -i -E "listen|listening"'
alias active-network='lsof -i -P +c 0 +M | grep -i "$1"'
alias SSH-START='/etc/rc.d/rc.sshd start'
alias SSH-RESTART='/etc/rc.d/rc.sshd restart'
alias SSH-STOP='/etc/rc.d/rc.sshd stop'
alias APT-GET-UPDATE='apt-get update'
alias APT-GET-UPGRADE='apt-get upgrade'
alias APT-GET-INSTALL='apt-get install '
alias SSH-DOLPHIN-COMPAQ-LILY-MX-19-4='ssh -X demo@COMPAQ-LILY-MX-19-4.local dolphin'
alias SSH-KONSOLE-COMPAQ-LILY-MX-19-4='ssh demo@COMPAQ-LILY-MX-19-4'
alias SSH-DOLPHIN-MX-1='ssh -X demo@MX-1.local dolphin'
alias SSH-KONSOLE-MX-1='ssh demo@MX-1.local'
alias SSH-KONSOLE-VIC-MX-21-1=' ssh -X demo@VIC-MX-21-1.local'
alias SSH-DOLPHIN-VIC-MX-21-1=' ssh -X demo@VIC-MX-21-1.local dolphin'
#alias =''
#alias =''
#alias =''
#alias =''
#alias =''
#alias =''
#alias =''
#alias =''

alias lower-UPPER='for SRC in `find * -depth`
do
    DST=`dirname "${SRC}"`/`basename "${SRC}" | tr '[a-z]' '[A-Z]'`
    if [ "${SRC}" != "${DST}" ]
    then
        [ ! -e "${DST}" ] && mv -T "${SRC}" "${DST}" || echo "${SRC} was already all uppercase."
    fi
done 
'
alias UPPER-lower='for SRC in `find * -depth`
do
    DST=`dirname "${SRC}"`/`basename "${SRC}" | tr '[A-Z]' '[a-z]'`
    if [ "${SRC}" != "${DST}" ]
    then
        [ ! -e "${DST}" ] && mv -T "${SRC}" "${DST}" || echo "${SRC} was already all lowercase."
    fi
done 
'


# Append any additional sh scripts found in /etc/profile.d/:
for y in /etc/profile.d/*.sh ; do [ -x $y ] && . $y; done
unset y

# Setup shell prompt for root <wread and fanthom>
PS1='\[\033[01;31m\]\u@\h:\[\033[01;32m\]\w\$\[\033[00m\] '
PS2='> '

Thanks for any feedback,

Vektor

User avatar
figueroa
Posts: 1100
Joined: Thu Dec 20, 2018 11:20 pm

Re: Show off your bash - .rc, that is

#2 Post by figueroa »

My pleasure:

Code: Select all

$ more .bashrc
# ~/.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
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
HISTCONTROL=$HISTCONTROL${HISTCONTROL+:}ignoredups
# ... or force ignoredups and ignorespace
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)

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

# 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) 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)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\0
33[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

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[0m\]'

if [ "$UID" = 0 ]; then
    PS1="$red\u$nc@$red\H$nc:$CYAN\w$nc\\n$red#$nc "
else
    PS1="$PURPLE\u$nc@$CYAN\H$nc:$GREEN\w$nc\\n$GREEN\$$nc "
fi
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dirco
lors -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

# some more ls aliases
alias ll='ls -lh'
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

# Default parameter to send to the "less" command
# -R: show ANSI colors correctly; -i: case insensitive search
LESS="-R -i"

# 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 [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi

# Add sbin directories to PATH.  This is useful on systems that have sudo

[ -z "${PATH##*/sbin*}" ] || PATH=$PATH:/sbin:/usr/sbin

GPG_TTY=`tty`
export GPG_TTY
Note aliases:

Code: Select all

$ cat .bash_aliases
alias d="ls --color"
alias ls="ls -F --color=auto --group-directories-first"
alias ll="ls -F --color -l --group-directories-first"
alias lt='ls -Fltr'
alias lta='ls -ltra'
alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'
alias bye='exit'

#UNSET THE FOLLOWING from /etc/bash.bashrc
unalias ag
unalias agc
unalias agd
unalias agu
I spend a lot of time with BASH. This is the way I like it. That's my only excuse.
Andy Figueroa
Using Unix from 1984; GNU/Linux from 1993

Vektor
Posts: 118
Joined: Fri Jul 30, 2021 8:00 pm

Re: Show off your bash - .rc, that is

#3 Post by Vektor »

Whoa figueroa, much of it is like an alien language. I feel like navel lint. Awesome.

Vektor

User avatar
figueroa
Posts: 1100
Joined: Thu Dec 20, 2018 11:20 pm

Re: Show off your bash - .rc, that is

#4 Post by figueroa »

Vektor wrote: Sat Apr 30, 2022 11:46 pm Whoa figueroa, much of it is like an alien language. I feel like navel lint. Awesome.
Don't feel intimidated. A lot of it is boilerplate and comments, and a lot is from the default .bashrc. I just change things for the look and feel that I want or to make certain things work (like gnupg in vim).

Before tweaking your own .bashrc, make a permanent backup. In fact, backups of EVERYTHING solve a lot of problems. In case you no longer have the original, you can always get one from a live-usb.
Andy Figueroa
Using Unix from 1984; GNU/Linux from 1993

Vektor
Posts: 118
Joined: Fri Jul 30, 2021 8:00 pm

Re: Show off your bash - .rc, that is

#5 Post by Vektor »

My middle name is BACKUP. I have so many backups I get confused sometimes. I did learn the hard way.

Vektor

User avatar
LU344928
Posts: 309
Joined: Wed Nov 14, 2018 11:40 pm

Re: Show off your bash - .rc, that is

#6 Post by LU344928 »

Vektor wrote: Sun May 01, 2022 12:51 am My middle name is BACKUP. I have so many backups I get confused sometimes. I did learn the hard way.
http://taobackup.com/
Machine: Type: Laptop System: Acer product: Aspire AL14-31P
Distro: MX-23.6_KDE_x64 Libretto

Vektor
Posts: 118
Joined: Fri Jul 30, 2021 8:00 pm

Re: Show off your bash - .rc, that is

#7 Post by Vektor »

I have had that site bookmarked for a long time. So cool.

Vektor

Vektor
Posts: 118
Joined: Fri Jul 30, 2021 8:00 pm

Re: Show off your bash - .rc, that is

#8 Post by Vektor »

So... I was kinda hopin for more cool bash stuff... Like shortcuts or killer ways to access cool things.

Maybe this is as good as it gets...

Vektor

Post Reply

Return to “General”