Bashrc thread

useful stuff that go on .bashrc

Other urls found in this thread:

0x0.st/3Js.bin
0x0.st/3Jz.bin
0x0.st/3Ji.py
cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC53
twitter.com/SFWRedditGifs

scuse () {
sudo $(history -n -1)
}


$ rc-service apache2 start
rc-service: permission denied
$ scuse me bitch
* Starting apache2 ...

mksh

$ reboot -n

>linux
>useful

I got something similar but with "fuck".
Also:
alias up="sudo apt update && sudo apt -y upgrade"
alias o="xdg-open”

this is good im taking this

emerge zsh
emerge --depclean bash
chsh -s /bin/zsh
zsh

You do realize that sudo !! would do the same thing right?

he gave it a touch of class

screenfetch
python=python3

after all these years, I still find funny people use sudo, instead of sudo su and call it a day

i think the only interesting thing i could add, after seeing the sudo trick is this bash trick:

mv wrongfolder folder;
>error, folder not found
^wrongfolder^goodfolder
>done

>no history of recently typed commands
>have to configure a custom shell on root account if using one on normal account
>have to exit and re-enter when you have to run a command as non-root

>no history of recently typed commands
why? you have root history
>custom shell
i guess that is true, if you need your rice
>exit and re-enter
i have a root session always open, using terminator or just tabs

i guess it is just a different way of doing things

chkec () {
local i=$?
if [ $i -ne 0 ]
then
echo -n "$i "
fi
}

chkagent () {
ssh-add -l &>/dev/null
case $? in
0) echo "KEY";;
1) echo "NOKEY";;
*) echo "UNK";;
esac
}

export UNAME="$(uname)"

case "$UNAME" in
"CYGWIN_NT-"* | "MINGW64_NT-"* | "Linux")
HISTFILESIZE=-1
HISTSIZE=-1;;
"OpenBSD");;
*)
echo "$(basename "$0"): unknown os, can not history length" \
>&2;;
esac

PROMPT_DIRTRIM=3

PS1='\[\a\e[1;31m\]$(chkec)\[\e[0m\]\u@\h:\w\$ '

if [ "$TERM" = xterm ] || [ "$TERM" = st-256color ]
then
case "$UNAME" in
"CYGWIN_NT-"*)
PROMPT_COMMAND='echo -ne "\e]0;$(chkagent) $(pwd)\a"';;
*)
PROMPT_COMMAND='echo -ne "\e]0;$(hostname):$(pwd)\a"';;
esac
fi

. "$HOME/.bash_aliases"

if [ -r "$HOME/.todo" ]
then
cat "$HOME/.todo"
fi

I have some similar update scripts, and I alias up="sudo brl ~/.bin/rosetta update" (code for rosetta 0x0.st/3Js.bin ), and I wrote some scripts to update my kernel here: 0x0.st/3Jz.bin
and the helper here: 0x0.st/3Ji.py


Anyone in this thread should feel free to use them but you might need to tweak them if you're not on bedrock

I wanna impress this girl I am trying to date im my class. What can I add to my bashrc to make her impressed at me

this is not your board, go back to Sup Forums

security first

`figlet -F gay "I LOVE COCKS" | cowsay -n`

set -o vi

Is there a bash option that combines history with auto-complete?
so eg. if you type "asdf" then up-arrow, it only autocompletes previously used commands that start with "asdf"

Do you know ctl-r?

alias bashrc='vim .bashrc; source .bashrc'

export PS1='\[\e[37;1m\]\u@ \[\e[37;1m\]\W \[\e[0m\] \$ '
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
alias cd..='cd ..'
alias cd...='cd ../..'
alias cd....='cd ../../..'
alias cd.....='cd ../../../..'
alias pingg='ping -c 5 www.google.com'
alias chrome='open -a "Google Chrome"'

I didn't, but that's not quite as convenient.

/usr/bin/zsh

postan mine again

HISTSIZE=99999

# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto -l'
eval "`dircolors`"
alias less='less -r' # raw control characters
alias whence='type -a' # where, of a sort
alias grep='grep --color' # show differences in colour
alias ls='ls --color=auto -h'
alias ll='ls -l'
alias la='ls -la'
alias l='ll'
alias df='df -h'
alias free='free -h'
alias dmesg='dmesg -T'
alias reboot='hostname | reboot'
alias shutdown='hostname | shutdown'
alias apt-get='sudo apt-get'
alias apt-cache='sudo apt-cache'
alias du='du -b --max-depth 1 | sort -nr | perl -pe '\''s{([0-9]+)}{sprintf "%.1f%s", $1>=2**30? ($1/2**30, "G"): $1>=2**20? ($1/2**20, "M"): $1>=2**10? ($1/2**10, "K") : ($1, "")}e'\'''

export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n> '

cd
export LESS="-Q -i"
export LESSCHARSET=latin1
export EDITOR=vim
#export PAGER="/usr/bin/most -s"

complete -cf sudo

export LC_ALL="en_US.UTF-8"

>alias ll='ls -l'
>alias l='ll'

what's wrong with that?

why not alias l='ls -l' ?

Makes no difference. Also, i'm not the only one using it so i like to keep both

shopt -s autocd

In .inputrc:

# \e[A = up arrow
# \e[B = down arrow

"\e[A": history-search-backward
"\C-p": history-search-backward

"\e[B": history-search-forward
"\C-n": history-search-forward

This will affect every program which uses GNU readline.

Some other things you might want:

set bell-style none

Tab: menu-complete
set menu-complete-display-prefix

set completion-ignore-case on
set completion-query-items 150

set match-hidden-files off
set show-all-if-ambiguous on

Refer to the GNU readline manual for more options.

cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC53

zsh does this by default

This is mine so far

# User specific aliases and functions
PS1='(\[\033[01;34m\]\u\[\033[0m\]\[\033[01;34m\]\[\033[0m\]@\[\033[01;34m\]\h\[\033[0m\] \W) '

# Functions

cpu-freq(){
n=-1
for i in $(cat /proc/cpuinfo | grep "MHz" | awk '{print $4}')
do
let n++
printf "\033[01;34mCore $n\033[0;0m\t $i \n"
done
}

pc-qemu(){
if [ "$2" == "" ]
then
echo "pc-qemu [Memory Size] [CPU Cores] [HDD Image] [Installer Disk]"
elif [ "$4" == "" ]
then
qemu-system-x86_64 -m $1 -smp cores=$2 -hda $3 --enable-kvm
else
qemu-system-x86_64 -m $1 -smp cores=$2 -hda $3 -cdrom $4 --enable-kvm
fi
}

_tmux(){
tmux attach
}

>not using ZSH and compiling your functions to reduce startup time and memory usage and increase speed

...

touch pants.zip
unzip pants.zip

are you bait

alias -- -='cd -'

...