[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

bashrc thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 43
Thread images: 6

useful stuff that go on .bashrc
>>
scuse () {
sudo $(history -n -1)
}


$ rc-service apache2 start
rc-service: permission denied
$ scuse me bitch
* Starting apache2 ...
>>
mksh
>>
$ reboot -n
>>
>linux
>useful
>>
File: 1420549507276.png (223KB, 1000x880px) Image search: [Google]
1420549507276.png
223KB, 1000x880px
>>60128397
I got something similar but with "fuck".
Also:
alias up="sudo apt update && sudo apt -y upgrade"
alias o="xdg-open”
>>
>>60128397
this is good im taking this
>>
emerge zsh
emerge --depclean bash
chsh -s /bin/zsh
zsh
>>
>>60128397
You do realize that sudo !! would do the same thing right?
>>
>>60129939
he gave it a touch of class
>>
>>60127962

screenfetch
python=python3
>>
>>60128397
after all these years, I still find funny people use sudo, instead of sudo su and call it a day
>>
>>60128397
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
>>
>>60130104
>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
>>
>>60130247
>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
>>
>>60129511
I have some similar update scripts, and I
alias up="sudo brl ~/.bin/rosetta update"
(code for rosetta http://0x0.st/3Js.bin ), and I wrote some scripts to update my kernel here: http://0x0.st/3Jz.bin
and the helper here: http://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
>>
>>60129407
this is not your board, go back to /b/
>>
>>60130361
security first
>>
>>60130982
`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"
>>
>>60132691
Do you know ctl-r?
>>
>>60127962
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"'
>>
>>60132731
I didn't, but that's not quite as convenient.
>>
>>60127962
/usr/bin/zsh
>>
File: LKKXHbk[1].png (67KB, 1200x675px) Image search: [Google]
LKKXHbk[1].png
67KB, 1200x675px
>>60127962
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"
>>
File: errori_belli.jpg (3MB, 3840x2160px) Image search: [Google]
errori_belli.jpg
3MB, 3840x2160px
>>60132930
>alias ll='ls -l'
>alias l='ll'
>>
>>60133011
what's wrong with that?
>>
>>60133073
why not alias l='ls -l' ?
>>
>>60133104
Makes no difference. Also, i'm not the only one using it so i like to keep both
>>
>>60132749
shopt -s autocd
>>
>>60132691
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.

https://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC53
>>
>>60132691
zsh does this by default
>>
>>60127962

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
}

>>
>>60127962
>>60128397
>>60129511
>>60130640
>>60132745
>>60132749
>>60132930
>not using ZSH and compiling your functions to reduce startup time and memory usage and increase speed
>>
File: boink.png (167KB, 1080x522px) Image search: [Google]
boink.png
167KB, 1080x522px
>>60127962
>>
>>60134956
touch pants.zip
unzip pants.zip
>>
>>60133117
are you bait
>>
alias -- -='cd -'
>>
File: 1471573408215.jpg (33KB, 314x320px) Image search: [Google]
1471573408215.jpg
33KB, 314x320px
>>60135071
Thread posts: 43
Thread images: 6


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.