UbuntuThis forum is for the discussion of Ubuntu Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
when I open a term it gets my path statements so I know it is reading my .bashrc but no matter where I add a prompt change does it change the prompt. echo $SHELL /bin/bash
confused.
Code:
# ~/.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
[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources
#add favorite editor
export VISUAL="nano"
[[ -d ~/bin ]] && PATH=$PATH:~/bin
[[ -d ~/bin/userstartups ]] && PATH=~/bin/userstartups:$PATH
[[ -d ~/bin/imagescripts ]] && PATH=~/bin/imagescripts:$PATH
[[ -d ~/bin/EtermScripts ]] && PATH=~/bin/EtermScripts:$PATH
[[ -d ~/bin/fbsd ]] && PATH=~/bin/fbsd:$PATH
# 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
#ipE=$(dig +short myip.opendns.com @resolver1.opendns.com)
ramT=$(a=$(cat /proc/meminfo | grep MemTotal | awk '{print $2}'); i=$((a/1024)); echo $i" MB")
ramC=$(a=$(cat /proc/meminfo | grep Cached | awk '{print $2}' |awk -F: 'NR == 1'); i=$((a/1024)); echo $i)
ramF=$(a=$(cat /proc/meminfo | grep MemFree | awk '{print $2}'); i=$((a/1000)); echo $i)
#aptI=$(awk '/apt-get install/{print $4}' /var/log/apt/history.log | xargs)
cores=$(cat /proc/cpuinfo | grep processor | wc -l)
cpu=$(cat /proc/cpuinfo | grep 'model name' | awk 'NR==1' | awk -F': ' '{print $2}')
os=$(cat /etc/os-release | grep 'PRETTY_NAME' | sed -e s/PRETTY_NAME=//g | sed -e s/\"//g)
graphic=$(sudo lspci | grep VGA | awk -F': ' '{print $2}')
errors=$(sudo find /var/log/syslog -type f -mtime -1 | sudo xargs grep -r -w 'error' | wc -l)
warnings=$(sudo find /var/log/syslog -type f -mtime -1 | sudo xargs grep -r -w 'warning' | wc -l)
#output to terminal
# 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\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
PS1='\u@\H\w\r<<\\$' #<<----- new prompt thingy
else
# PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
PS1='\u@\H\w\r<<\\$' #<<----- new prompt thingy
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"
PS1='\u@\H\w\r<<\\$' #<<----- new prompt thingy
;;
*)
;;
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 "
PS1='\u@\H\w\r<<\\$' #<<----- new prompt thingy
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 "$(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
# some more ls aliases
alias yt=yaourt
alias ytr='yaourt -Rsn'
alias ll='ls -lh'
alias la='ls -A'
alias l='ls -CF'
alias sf='screenfetch'
alias nf='neofetch'
alias ponce='sudo sboconfig -r https://github.com/Ponce/slackbuilds'
alias sboup='sudo sboconfig -r git://git.slackbuilds.org/slackbuilds.git'
alias snapme='sudo sbosnap update'
alias makemenu='obmenu-generator -p -i'
alias xp='sudo xbps-install -Suy '
alias xq='sudo xbps-query -Rs '
alias sbi='sudo sboinstall '
alias slackup='sudo slackpkg update'
alias slacknew='sudo slackpkg install-new'
alias slackall='sudo slackpkg upgrade-all'
alias update-grub='sudo grub-mkconfig -o /boot/grub/grub.cfg'
alias reboot='sudo reboot'
#youtube-dl
alias yta-aac="youtube-dl --extract-audio --audio-format aac "
alias yta-best="youtube-dl --extract-audio --audio-format best "
alias yta-flac="youtube-dl --extract-audio --audio-format flac "
alias yta-m4a="youtube-dl --extract-audio --audio-format m4a "
alias yta-mp3="youtube-dl --extract-audio --audio-format mp3 "
alias yta-opus="youtube-dl --extract-audio --audio-format opus "
alias yta-vorbis="youtube-dl --extract-audio --audio-format vorbis "
alias yta-wav="youtube-dl --extract-audio --audio-format wav "
alias ytv-best="youtube-dl -f bestvideo+bestaudio "
# 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
#functions
show_info()
{
echo "
------------------------------------------------------------------
$os
`hostname`
IP Address `hostname -i` external: `hostname -I | awk '{print $1}'`
Kernel `uname -r`
Uptime `uptime | sed 's/.*up ([^,]*), .*/1/'`
CPU $cpu
RAM $ramT : $ramC : $ramF
Graphics Card "["${graphic#* [}
Warnings : $warnings : Errors : $errors
------------------------------------------------------------------"
}
#CHANGE GRUB BOOT IMAGE USING IMAGES IN /BOOT/GRUB/IMAGES DIRECTORY
update-grub-wp()
{
file=/etc/default/grub
location="/boot/grub/images"
[[ ! -d "$location" ]] && { echo "$location : not present" ; return ; }
mapfile -t images < <(ls /boot/grub/images)
#printf "%s\n" "${images[@]}"
img=${images[$RANDOM % ${#images[@]} ]}
img=$location/$img
echo "
using ..
$img"
echo
sudo sed -i 's|GRUB_BACKGROUND.*|GRUB_BACKGROUND='"\"$img\""'|' $file
sudo grub-mkconfig -o /boot/grub/grub.cfg
}
update-grub-paper()
{
favimages=/media/storage/wallpaper/grub-images
holding=/media/storage/wallpaper/grub-images-holding
[[ ! -d $favimages ]] && { echo "no $favimages " ; return ; }
empty=$(find $favimages -type f | wc -l)
case $empty in
0)
holdingimg=$(find $holding -type f | wc -l)
if [[ $holdingimg -gt '0' ]] ; then
mv -v $holding/* $favimages/
echo "Images moved to $favimages"
elif [[ $holdingimg -le '0' ]] ; then
echo "
no images to be found in
$favimages
or
$holding
exiting ..."
exit
fi
;;
1)
img=$favimages/$(ls $favimages)
;;
esac
mapfile -t images < <(find "$favimages" \( -type f -name "*.jpg" -o -type f -name "*.png" \))
img=${images[$RANDOM % ${#images[@]} ]}
#if jpg change to png
#uefi grub boot on mine
#does not work with jpg
if [[ "$img" =~ 'jpg' ]] ;
then
#add absolute path
#img=$holding/$img
#convert jpg -2- png
convert $img ${img/%jpg/png}
#swap the extension in the variable from
#jpg to png to match
img=${img/%.*}.png
mvimg=$img
rmimg=${img/%png/jpg}
echo "rmimg= $rmimg"
rm -v "$rmimg"
else
mvimg=$img
fi
mv -v "$mvimg" "$holding"
mvimg=${img/$favimages/$holding}
sudo sed -i -r 's|GRUB_BACKGROUND=.*|GRUB_BACKGROUND='"$mvimg"'|g' /etc/default/grub
#cat /etc/default/grub
#copy image to home to see what it is
ext=${mvimg##*.}
cp -v "$mvimg" $HOME/"grub-boot-image"."$ext"
sudo grub-mkconfig -o /boot/grub/grub.cfg
}
#CHANGE GRUB BOOT IMAGE USING IMAGES IN FAVORITES DIRECTORY
update-grub-favs()
{ #location of grub conf file
file=/etc/default/grub
#locations of images to be used
location="/media/storage/wallpaper/grub-images"
haveImgs=$( find $location -type f | wc -l)
#make sure there are images in the dir first
if [[ $haveImgs -gt '0' ]] ; then
[[ ! -d "$location" ]] && { echo "$location : not present" ; return ; }
mapfile -t images < <(ls "$location" )
#printf "%s\n" "${images[@]}"
img=${images[$RANDOM % ${#images[@]} ]}
#if jpg change to png
#uefi grub boot on mine
#does not work with jpg
if [[ "$img" =~ 'jpg' ]] ;
then
#add absolute path
img=$location/$img
#convert jpg -2- png
convert $img ${img/%jpg/png}
#swap the extension in the variable from
#jpg to png to match
img=${img/%.*}.png
else
#just add absolute path to png
img=$location/$img
fi
#get old image then move it out
#to let other images have a chance of
#getting selected
usedImages=/media/storage/wallpaper/grub-images-holding
[[ ! -d $usedImages ]] && mkdir -pv $usedImages
st1=$(awk '/GRUB_BACKGROUND/ {print $0}' /etc/default/grub)
st1=${st1#*\"}
st1=${st1%\"*}
echo "st1=$st1"
[[ -f $st1 ]] && { ECHO "Moving Old image $st1->$usedImages" ; mv -v $st1 $usedImages ; }
ext=${img##*.}
echo "EXT= $ext"
echo "
using ..
$img"
#copy the image into your home to satisfy your curiosity
#without having to reboot to see it.
cp -v "$img" ~/"current-grub-image".$ext
echo
sudo sed -i 's|GRUB_BACKGROUND.*|GRUB_BACKGROUND='"\"$img\""'|' $file
sudo grub-mkconfig -o /boot/grub/grub.cfg
else
echo "
$location
Has no more Images
"
fi
}
bobs()
{
[[ $# -eq 0 ]] && { echo "needs input aka 'status network' would be nice" ; return ; }
[[ $# -eq 2 ]] && [[ $1 == "status" ]] && [[ $2 == "network" ]] && { echo $# ; } ||
{ echo "$@" ; }
}
case $TERM in
xterm-256color )
# show_info ;;
neofetch
esac
neofetch
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.