Arch Linux Forums

Discussion forums for Arch Linux, a simple, lightweight linux distribution.

You are not logged in.

#1 2008-06-14 20:07:28

pogeymanz
Member
Registered: 2008-03-11
Posts: 512

Post your .bashrc!

I spend a lot of time in the terminal. It's how I browse files, edit configs, manage packages, etc. Plus my job is via ssh. Right now my terminal is pretty plain: Green on Black. I want a colorful, useful terminal experience since I spend so much time there!

So, let me steal ideas from you!

Offline

 

#2 2008-06-14 20:11:03

Vintendo
Member
From: Netherlands
Registered: 2008-04-21
Posts: 350
Website

Re: Post your .bashrc!

I'll play smile  It's mainly aliases

Code:

PS1='[\W] '
alias ls='ls --color=auto -F'
alias y='yaourt'
alias yi='yaourt -Sy'
alias yr='yaourt -Rcns'
alias yup='yaourt -Syu --aur'
alias m='mplayer'
alias hella='hellanzb.py'
alias hellanzb='hellanzb.py'
alias wget='wget -c'
alias brand='growisofs -Z /dev/cdrw -v -l -R -J -joliet-long'
alias burn='growisofs -Z /dev/cdrw -v -l -R -J -joliet-long' 
alias done='cd ~/Downloads/Done'
alias hd='cd ~/Films/High\ Definition/'
alias anime='cd ~/Anime/'
alias afbeeldingen='cd ~/Afbeeldingen/'
alias muziek='cd ~/Muziek/'  
alias tv='cd ~/Tv-series' 
alias so='source ~/.bashrc'
alias stats='hellanzb.py status'
alias mptv='mplayer /dev/video0'
alias hdd='df -hT'

if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

Offline

 

#3 2008-06-14 20:12:13

Stythys
Member
From: California
Registered: 2008-05-18
Posts: 708
Website

Re: Post your .bashrc!

here's mine  big_smile

http://pastebin.com/f1692bf9f

besides random aliases for personal use, mine features a way to search through pidgin logs, a 'junk' function which replaces the 'rm' command, so it moves files into a kind of trash folder instead of permanently deleting them, a 'note' function to keep notes once in a while, and, of course, a custom prompt with welcome message cool

Last edited by Stythys (2008-06-14 20:22:46)


What will you do...when the penguin finds you?

Offline

 

#4 2008-06-14 20:36:43

pogeymanz
Member
Registered: 2008-03-11
Posts: 512

Re: Post your .bashrc!

Cool stuff.

What does this do?:

Code:

if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

Here is mine for right now:

Code:

alias ls='ls --color=auto'
alias pacman='pacman-color'
#PS1='[\u@\h \W]\$ '
PS1='\[\e[0;32m[\]\[\e[0;37m\]\u\[\e[m\] \[\e[0;34m\]\w\[\e[m\] \[\e[0;32m]\]\[\e[0;37m\]\$ \[\e[m\]\[\e[0;32m\] '


complete -cf sudo

I don't even know what that complete -cf sudo line does... It was there already

Last edited by pogeymanz (2008-06-14 20:41:26)

Offline

 

#5 2008-06-14 20:40:29

Stythys
Member
From: California
Registered: 2008-05-18
Posts: 708
Website

Re: Post your .bashrc!

pogeymanz wrote:

What does this do?:

Code:

if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

It just checks if you have bash-completion installed and if you do, enables it.


What will you do...when the penguin finds you?

Offline

 

#6 2008-06-14 20:44:13

pogeymanz
Member
Registered: 2008-03-11
Posts: 512

Re: Post your .bashrc!

I have a question: Can you have periods (".") in aliases?

I want to make some tar aliases, like this:
alias tar .gz= 'tar xvzf'

for each kind of tar file

Offline

 

#7 2008-06-14 20:46:33

Stythys
Member
From: California
Registered: 2008-05-18
Posts: 708
Website

Re: Post your .bashrc!

periods should work fine


What will you do...when the penguin finds you?

Offline

 

#8 2008-06-14 21:52:28

tigrmesh
Member
From: Florida, US
Registered: 2007-12-11
Posts: 753

Re: Post your .bashrc!

pogeymanz, have you looked at this page from the wiki?  http://wiki.archlinux.org/index.php/Color_Bash_Prompt

Offline

 

#9 2008-06-14 23:48:45

pogeymanz
Member
Registered: 2008-03-11
Posts: 512

Re: Post your .bashrc!

I have. I just wanted to start one of those cool threads like "post your screenshot yay!"

Here is my bashrc as of now:

Code:

alias go='startx'
alias ls='ls --color=auto'
alias pacman='pacman-color'
alias targz='tar zxvf'
alias tarbz2='tar jxvf'

#PS1='[\u@\h \W]\$ '
PS1='\[\e[0;32m[\]\[\e[0;37m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[0;32m]\]\[\e[0;37m\]\$ \[\e[m\]\[\e[0;32m\] '


complete -cf sudo

Offline

 

#10 2008-06-15 00:14:18

mindfall
Member
From: berlin
Registered: 2007-07-02
Posts: 57

Re: Post your .bashrc!

Code:

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# . ~/.bash_profile

PATH=${PATH}:/home/mindfall/bin

# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups

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

if [[ "$TERM" != "dumb" ]]; then
    eval "`dircolors -b`"
    alias ls='ls --color=auto'
    alias ll='ls -lhp'
    alias lll='ls -lhap --color | less -R'
    alias cd..='cd ..'
    alias pacman='pacman-color'
    complete -cf sudo
fi


tooLong () 
{
    pfad="`pwd`"
    if [[ ${#pfad} -lt 30 ]]; then
        echo -n "${pfad/\/home\/$USER/~}"
    else 
        echo -n "<...> /`basename "$pfad"`"
    fi
}

# orginal Arch Prompt
# PS1='[\u@\h \W]\$ '
PS1="\[\033[40;1;33m\]\$(tooLong)\$\[\033[0m\] "

if [[ $UID == 0 ]]; then
    PS1="\[\033[1;41m\]\$(tooLong)#\[\033[00m\] "
fi

Offline

 

#11 2008-06-15 00:48:04

Allan
Developer/Forum Admin
From: Brisbane, AU
Registered: 2007-06-08
Posts: 5891
Website

Re: Post your .bashrc!

Code:

PATH=~/bin:$PATH

shopt -s histappend
PROMPT_COMMAND='history -a'

complete -cf sudo

alias ls='ls --color=auto'
alias pacman='sudo pacman'
alias abs='sudo abs'
alias mp='mousepad'
alias nmr='sudo /etc/rc.d/networkmanager restart'

PS1='\n\[\033[0;32m\]\u@\h \[\033[1;33m\]\w\n\[\033[0m\]> '
PS2='\\ '

As a bonus, here is my .inputrc

Code:

"\e[A": history-search-backward
"\e[B": history-search-forward

Offline

 

#12 2008-06-15 01:43:35

sniffles
Banned
Registered: 2008-01-23
Posts: 275

Re: Post your .bashrc!

Code:

source /etc/profile

# Aliases:
alias ls="ls -b --color=auto --file-type -h"

# Shell variables:
unset    HISTFILE
unset    MAIL
export    PATH="/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin"
export    PS1="[\w] \$ "

# Various variables:
export    LESSHISTFILE="/dev/null"

# Various:
umask 077

Fascinating, isn't it. I just let /etc/profile{,.bash,.d/*} do most of the work.

Last edited by sniffles (2008-06-15 01:45:39)

Offline

 

#13 2008-06-15 01:56:36

JeremyTheWicked
Member
From: Poland
Registered: 2008-05-23
Posts: 193

Re: Post your .bashrc!

Stythys wrote:

here's mine  big_smile

http://pastebin.com/f1692bf9f

besides random aliases for personal use, mine features a way to search through pidgin logs, a 'junk' function which replaces the 'rm' command, so it moves files into a kind of trash folder instead of permanently deleting them, a 'note' function to keep notes once in a while, and, of course, a custom prompt with welcome message cool

Hmm. Why are you running yaourt with sudo? It calls for password when needed anyway and AFAIK it's discouraged to use it with root privileges all the way.


arch(3) adj amused because you think you understand something better than other people ;P

Offline

 

#14 2008-06-15 02:07:12

Stythys
Member
From: California
Registered: 2008-05-18
Posts: 708
Website

Re: Post your .bashrc!

meh

pacman needs to be run with sudo...what's the difference with yaourt? =P


What will you do...when the penguin finds you?

Offline

 

#15 2008-06-15 02:08:57

Allan
Developer/Forum Admin
From: Brisbane, AU
Registered: 2007-06-08
Posts: 5891
Website

Re: Post your .bashrc!

Building packages from the AUR should be done with as limited privileges as possible.

Offline

 

#16 2008-06-15 02:15:44

JeremyTheWicked
Member
From: Poland
Registered: 2008-05-23
Posts: 193

Re: Post your .bashrc!

Stythys wrote:

meh

pacman needs to be run with sudo...what's the difference with yaourt? =P

The difference is that yaourt deals with PKGBUILDS from AUR. It's advised to build packages without root privileges and use sudo for installing only. (Like when installing from ABS - you would run makepkg as normal user and install the ready package with sudo pacman -S). Just a security thing.


arch(3) adj amused because you think you understand something better than other people ;P

Offline

 

#17 2008-06-15 02:48:08

sniffles
Banned
Registered: 2008-01-23
Posts: 275

Re: Post your .bashrc!

OK, I don't use AUR so I wasn't aware of this whole thing. Out of curiosity, what "security thing" ? If you don't trust the PKGBUILD or whatever, don't use it? How do you know that once you install the newly built package, you won't get all sorts of evil files on your system?

Offline

 

#18 2008-06-15 04:56:13

JeremyTheWicked
Member
From: Poland
Registered: 2008-05-23
Posts: 193

Re: Post your .bashrc!

sniffles wrote:

OK, I don't use AUR so I wasn't aware of this whole thing. Out of curiosity, what "security thing" ? If you don't trust the PKGBUILD or whatever, don't use it? How do you know that once you install the newly built package, you won't get all sorts of evil files on your system?

That's true. However, once you install the files with pacman you can easily uninstall them with pacman as well. Whereas there can be hardwired paths in the program you're compiling, e.g. installing something directly to /usr/bin - if you run makepkg/yaourt with root privileges all the way you can end up with a totally messed up system. And you won't even know.

Edit: Of course this is not a very likely scenario. If you've tried GoboLinux or Linux From Scratch though, you'll know what I mean.

Last edited by JeremyTheWicked (2008-06-15 05:03:07)


arch(3) adj amused because you think you understand something better than other people ;P

Offline

 

#19 2008-06-15 05:00:15

elgatofelix
Member
Registered: 2007-07-03
Posts: 131

Re: Post your .bashrc!

Nothing new in mine, just aliases and funcions


Are u listening?

Offline

 

#20 2008-06-15 05:52:24

sniffles
Banned
Registered: 2008-01-23
Posts: 275

Re: Post your .bashrc!

JeremyTheWicked wrote:

sniffles wrote:

OK, I don't use AUR so I wasn't aware of this whole thing. Out of curiosity, what "security thing" ? If you don't trust the PKGBUILD or whatever, don't use it? How do you know that once you install the newly built package, you won't get all sorts of evil files on your system?

That's true. However, once you install the files with pacman you can easily uninstall them with pacman as well. Whereas there can be hardwired paths in the program you're compiling, e.g. installing something directly to /usr/bin - if you run makepkg/yaourt with root privileges all the way you can end up with a totally messed up system. And you won't even know.

Edit: Of course this is not a very likely scenario. If you've tried GoboLinux or Linux From Scratch though, you'll know what I mean.

I don't have my Arch system handy atm, but I remember when installing dwm that some messages appeared on the sceen (regarding editing config.h, etc.) Later on I built my own packages and I remember also modifying some text files in order to make sure those messages do not appear when I install the custom package. I'm thinking: instead of making messages appear on the screen, why couldn't those files contain commands for various over evil tasks? Tasks which would be run just once, when the package gets installed. How would you reverse *that* with pacman? Not to mention, the harm could probably have already been done.

Offline

 

#21 2008-06-15 06:19:39

JeremyTheWicked
Member
From: Poland
Registered: 2008-05-23
Posts: 193

Re: Post your .bashrc!

@sniffles: I didn't intend to say that installing unverified programs with pacman is 100% safe. I only meant that running makepkg with root privileges exposes you to more risks - e.g. when a program is coded with hardwired paths.


arch(3) adj amused because you think you understand something better than other people ;P

Offline

 

#22 2008-06-15 07:03:35

catwell
Member
From: Bretagne, France
Registered: 2008-02-19
Posts: 206
Website

Re: Post your .bashrc!

Code:

alias ls='ls --color=auto'
alias e='$EDITOR'

PS1='[\A \W] '

if [ -z "$DISPLAY" ] && [ $(tty) == /dev/vc/1 ] ; then
   export EDITOR=scribes
   export PATH=$PATH:/dcs/scripts
   export CLASSPATH=.:$CLASSPATH
   export PROMPT_COMMAND='echo -ne "\033]0;${HOSTNAME} - ${PWD}\007"'
   startx

No aliases other than my editor, I don't like them. I still need the "e" one because automatic completion doesn't help when you have both scribes and Scribus.

Last edited by catwell (2008-06-15 07:03:59)

Offline

 

#23 2008-06-15 08:47:29

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 1329

Re: Post your .bashrc!

I don't have an .bashrc so I'll give you my .zshsh and .Xdefaults instead:

Code:

==== .zshrc ====
#-------------------------------------------------------------------------#
# File:     .zshrc   ZSH resource file                                    #
# Version:  0.1.13                                                        #
# Author:   Øyvind "Mr.Elendig" Heggstad <mrelendig AT har-ikkje DOT net> #
#-------------------------------------------------------------------------#

#------------------------------
# History stuff
#------------------------------
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000

#------------------------------
# Variables
#------------------------------
export EDITOR="vim"
export MANPAGER="/home/oh/bin/vimpager"
export PATH="$PATH:/home/oh/bin"

#-----------------------------
# Dircolors
#-----------------------------
LS_COLORS='rs=0:di=34:ln=36:pi=40;33:so=01;35:do=35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=32:mi=31';
export LS_COLORS

#------------------------------
# Keybindings
#------------------------------
bindkey -v
typeset -g -A key
#bindkey '\e[3~' delete-char
bindkey '\e[1~' beginning-of-line
bindkey '\e[4~' end-of-line
#bindkey '\e[2~' overwrite-mode
bindkey '^?' backward-delete-char
bindkey '^[[1~' beginning-of-line
bindkey '^[[5~' up-line-or-history
bindkey '^[[3~' delete-char
bindkey '^[[4~' end-of-line
bindkey '^[[6~' down-line-or-history
bindkey '^[[A' up-line-or-search
bindkey '^[[D' backward-char
bindkey '^[[B' down-line-or-search
bindkey '^[[C' forward-char 
# for rxvt
bindkey "\e[8~" end-of-line
bindkey "\e[7~" beginning-of-line
# for gnome-terminal
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line

#------------------------------
# Alias stuff
#------------------------------
alias ls="ls --color -F"
alias ll="ls --color -lh"
alias spm="sudo pacman"
alias spmc="sudo pacman-color"

#------------------------------
# Comp stuff
#------------------------------
zmodload zsh/complist 
autoload -Uz compinit
compinit
zstyle :compinstall filename '/home/oh/.zshrc'

zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}

zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*'   force-list always

zstyle ':completion:*:*:killall:*' menu yes select
zstyle ':completion:*:killall:*'   force-list always

#------------------------------
# Window title
#------------------------------
case $TERM in
    *xterm*|rxvt|rxvt-unicode|rxvt-256color|(dt|k|E)term)
        precmd () { print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~]\a" } 
        preexec () { print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~] ($1)\a" }
    ;;
    screen)
        precmd () { 
            print -Pn "\e]83;title \"$1\"\a" 
            print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~]\a" 
        }
        preexec () { 
            print -Pn "\e]83;title \"$1\"\a" 
            print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~] ($1)\a" 
        }
    ;; 
esac

#------------------------------
# Prompt
#------------------------------
setprompt () {
    # load some modules
    autoload -U colors zsh/terminfo # Used in the colour alias below
    colors
    setopt prompt_subst

    # make some aliases for the colours: (coud use normal escap.seq's too)
    for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
        eval PR_$color='%{$fg[${(L)color}]%}'
    done
    PR_NO_COLOR="%{$terminfo[sgr0]%}"

    # Check the UID
    if [[ $UID -ge 1000 ]]; then # normal user
        eval PR_USER='${PR_GREEN}%n${PR_NO_COLOR}'
        eval PR_USER_OP='${PR_GREEN}%#${PR_NO_COLOR}'
    elif [[ $UID -eq 0 ]]; then # root
        eval PR_USER='${PR_RED}%n${PR_NO_COLOR}'
        eval PR_USER_OP='${PR_RED}%#${PR_NO_COLOR}'
    fi    

    # Check if we are on SSH or not  --{FIXME}--  always goes to |no SSH|
    if [[ -z "$SSH_CLIENT"  ||  -z "$SSH2_CLIENT" ]]; then 
        eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' # no SSH
    else 
        eval PR_HOST='${PR_YELLOW}%M${PR_NO_COLOR}' #SSH
    fi
    # set the prompt
    PS1=$'${PR_CYAN}[${PR_USER}${PR_CYAN}@${PR_HOST}${PR_CYAN}][${PR_BLUE}%~${PR_CYAN}]${PR_USER_OP}'
    PS2=$'%_>'
}
setprompt

==== .Xdefaults ====
!------------------!
!       XFT        !
!------------------!

Xft*dpi:        99
Xft*antialias:    true

!------------------!
!   URvxt Stuff    !
!------------------!

!--[term name]--!
!URxvt*termName: rxvt-256color
URxvt*termName: rxvt-unicode

!--[trans and fg/bg]--!
URxvt*fadeColor: black
URxvt*transparent: false
URxvt*shading: 80
URxvt*depth:24
URxvt*background: #1C1C1C
URxvt*foreground: #C4C4C4
URxvt*borderless: 1

!--[font]--! 
URxvt*font: -*-terminus-*-*-*-*-12-*-*-*-*-*-*-u
URxvt*boldFont: -*-terminus-bold-*-*-*-12-*-*-*-*-*-*-u
!URxvt*font:            xft:DejaVu Sans Mono:pixelsize=8:autohint=true
!URxvt*boldFont:            xft:DejaVu Sans Mono:pixelsize=8:bold:autohint=true
!URxvt*italicFont:        xft:DejaVu Sans Mono:pixelsize=8:italic:autohint=true
!URxvt*boldItalicFont:        xft:DejaVu Sans Mono:pixelsize=8:bold:italic:autohint=true

!--[scrolling]--! 
URxvt*scrollBar: false
URxvt*saveLines: 10000

!--[tabs]--! 
!URxvt*perl-ext-common: default,tabbed

!--[cursor]--!
URxvt*cursorBlink: true

!--[Colours]--! 
URxvt*cursorColor: #FFAF00

! black
URxvt*color0:  #000000
URxvt*color8:  #808080

! red
URxvt*color1:  #A36666
URxvt*color9:  #D78787

! green
URxvt*color2:  #429942
URxvt*color10: #87D787

! yellow
URxvt*color3:  #D7AF87
URxvt*color11: #FFFFAF

! blue
URxvt*color4:  #AFAFD7
URxvt*color12: #AFD7FF

! magenta
URxvt*color5:  #A872A8
URxvt*color13: #D7AFD7

! cyan
URxvt*color6:  #00A8AB
URxvt*color14: #00C8CC

! white
URxvt*color7:  #D0D0D0
URxvt*color15: #EFEFEF

Last edited by Mr.Elendig (2008-06-15 08:49:26)


Evil #archlinux@freenode channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Online

 

#24 2008-06-15 08:58:32

ThomasAdam
Member
From: Southampton, England
Registered: 2005-10-26
Posts: 88

Re: Post your .bashrc!

catwell wrote:

Code:

if [ -z "$DISPLAY" ] && [ $(tty) == /dev/vc/1 ] ; then
   export EDITOR=scribes
   export PATH=$PATH:/dcs/scripts
   export CLASSPATH=.:$CLASSPATH
   export PROMPT_COMMAND='echo -ne "\033]0;${HOSTNAME} - ${PWD}\007"'
   startx

You seem to be missing a "fi" there.  Note also that it's a rather strange requirement that if $DISPLAY is zero *and* you're on a particular tty.  Surely:

Code:

[[ -z "$DISPLAY" ]] && [[ "$(tty)" == /dev/vc/? ]] && {
    ....
}

Is going to be much more likable should you ever sign into VC2?  wink

-- Thomas Adam

Offline

 

#25 2008-06-15 09:28:36

Procyon
Member
Registered: 2008-05-07
Posts: 1343

Re: Post your .bashrc!

mindfall wrote:

Code:

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

.bashrc doesn't get sourced when running non-interactive, does it?

Offline

 

Board footer

Powered by FluxBB