Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


hpr4018 :: A comment about other shows and Aliases

About the use of the Aliases and bashrc in Linux to better use your commandline.

<< First, < Previous, , Latest >>

Hosted by Reto on 2023-12-27 is flagged as Clean and is released under a CC-BY-SA license.
bash commands, bash_aliases. (Be the first).

Listen in ogg, spx, or mp3 format. Play now:

Duration: 00:13:14

general.


############################
# my personal Aliases list #
############################

# **** DIRECTORY LISTING in human-readable units ****
alias ll="ls -l --human-readable --almost-all --group-directories-first --classify"
alias la="ls -l --human-readable --almost-all --group-directories-first"
alias lr="ls -l --human-readable --almost-all --group-directories-first --recursive"
alias l=""


alias ..='cd ..;'
alias .2='cd ../..;'
alias ...="cd ../../../"
alias .4='cd ../../../..;'
alias .5='cd ../../../../..;'


alias back="cd $OLDPWD"
cdls() { builtin cd "$@" && ll; }
cdl() { builtin cd "$@" && la; }


# **** DISK partitions & mount points ****
alias lsblkf="lsblk --fs --exclude 7"
alias part="sudo parted --list"
alias lsmount="mount | column --table"


# **** DISK SPACE Usage in human-readable units,  including filesystem type ****
alias dfu="df --print-type --human-readable --all --total"

alias dfh="df --human-readable --exclude=squashfs"


# **** ALL FILES in a directory listed,  according their size ****
alias du="du --all --total --human-readable | sort --human-numeric-sort"


# **** PROCESS LISTING  table in detail ****
alias psa="ps auxf"

alias dmesg="dmesg --human"


# **** How to really CLEAR the terminal ****
alias clr='printf "\033c"'


alias h="history"

# **** reload bash config ****
alias reload="source ~/.bashrc"


============================================
bashrc - pimp the prompt.  A separate part, not related to above Aliases !
============================================

export HISTIGNORE='pwd:exit:fg:bg:top:clear:history:ls:uptime:df:ll:dfh:dfu:du:psa:dmesg:clr:h:cd'
<< 'Comment'

# u    = User
# @     = @
# h    = Host
# w	= working directory
# $	= # for root (uid=0),  or $ for user

export THEIP="$(/sbin/ip a | grep "inet " | grep -v 127.0.0. | awk '{print $2}')"
BRed='[\033[31;1m]'
BGreen='[\033[32;1m]'
BYellow='[\033[33;1m]'a
BCyan='[\033[36;1m]'
BWhite='[\033[37;1m]'
Reset='[\033[0m]'
UserPromptPS1='$'

#export PS1="${BCyan}u${BWhite}@${BYellow}h${BWhite}(${BGreen}${THEIP}${BWhite})${BRed}:${BCyan}w${BRed}${UserPromptPS1}${Reset} "
#export PS1="${BYellow}u${BWhite}@${BYellow}h${BWhite}${BRed}:${BCyan}w${BRed}n${UserPromptPS1}${Reset} "
export PS1="${BYellow}u${BWhite}@${BYellow}h ${BCyan}(${BCyan}${THEIP}) ${BRed}:${BGreen}w${BRed}n${UserPromptPS1}${Reset} "
Comment


IP=$(hostname -I | awk '{print $1;}' )
RED='\033[0;31m'
PLAIN='\033[0m' # No Color
WHITE='e[97m'
GREEN='e[0;32m'
PURPLE='e[35;35m'
CYAN='e[36;36m'
JAVA_VERSION=`java --version | head -1 | cut -f2 -d' '`
# source /usr/share/doc/git-2.35.1/contrib/completion/git-prompt.sh

#PS1='! [['$GREEN']$(hostname -s) $IP['$PLAIN']] [['$CYAN']$(pwd -P)['$PLAIN']] $(__git_ps1 "[['$PURPLE'] %s['$PLAIN']]")[☕ '$JAVA_VERSION']n['$GREEN']$['$PLAIN'] '
PS1='! [['$CYAN']h $IP['$PLAIN']] [['$GREEN']w['$PLAIN']] $(__git_ps1 "[['$PURPLE'] %s['$PLAIN']]")n['$GREEN']$['$PLAIN'] '



Comments

Subscribe to the comments RSS feed.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Title:
Comment:
Anti Spam Question: What does the P in HPR stand for ?