Pengalamnnya gara-gara ngelihat server di IBTeam ya yang pake warna warni terminalnya ?
jadi begini,, figlet yang diterangkan itu udah sangat-sangat bagus ldigunakan, nah buat thread ini semoga bisa melengkapi saja..
pada dasarnya wajah dari terminal aka console kita adalah pada file
[ .bashrc ]
itu ada koq di directory homenya,, jadi pas buka terminal langsung aja ketikl
Ntar muncul script kayak gini
ck dah,, gak sama juga gak apa2 koq,, nah sekarang bagimana kita membuat console kita unik ?
Basic programming bash mesti ne hehehe...
untuk pewarnannya ini adalah code dalam bashnya,, ganti aja sesuklanya
Jujur jelasinnya susah ya,, kalo bisa kita ketemuan aja sekalian traktirin ane wkwkwkwk...
ntar edit aja file bashrc sesuka anda,,
ini beberapa file bashrc yang bisa anda coba...
Tergantung bagaimana kita senangnya modifikasi aja ndiri ya
jadi begini,, figlet yang diterangkan itu udah sangat-sangat bagus ldigunakan, nah buat thread ini semoga bisa melengkapi saja..
pada dasarnya wajah dari terminal aka console kita adalah pada file
[ .bashrc ]
itu ada koq di directory homenya,, jadi pas buka terminal langsung aja ketikl
Code:
# gedit .bashrc
Ntar muncul script kayak gini
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
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries.
export HISTCONTROL=ignoreboth
# 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 "$(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
# 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_colored_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\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
;;
*)
;;
esac
# 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
# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ] && [ -x /usr/bin/dircolors ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'
#alias grep='grep --color=auto'
#alias fgrep='fgrep --color=auto'
#alias egrep='egrep --color=auto'
fi
# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'
# 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 ]; then
. /etc/bash_completion
fi
ck dah,, gak sama juga gak apa2 koq,, nah sekarang bagimana kita membuat console kita unik ?
Basic programming bash mesti ne hehehe...
untuk pewarnannya ini adalah code dalam bashnya,, ganti aja sesuklanya
Code:
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
bldred='\e[1;31m' # Red
bldgrn='\e[1;32m' # Green
bldylw='\e[1;33m' # Yellow
bldblu='\e[1;34m' # Blue
bldpur='\e[1;35m' # Purple
bldcyn='\e[1;36m' # Cyan
bldwht='\e[1;37m' # White
unkblk='\e[4;30m' # Black - Underline
undred='\e[4;31m' # Red
undgrn='\e[4;32m' # Green
undylw='\e[4;33m' # Yellow
undblu='\e[4;34m' # Blue
undpur='\e[4;35m' # Purple
undcyn='\e[4;36m' # Cyan
undwht='\e[4;37m' # White
bakblk='\e[40m' # Black - Background
bakred='\e[41m' # Red
badgrn='\e[42m' # Green
bakylw='\e[43m' # Yellow
bakblu='\e[44m' # Blue
bakpur='\e[45m' # Purple
bakcyn='\e[46m' # Cyan
bakwht='\e[47m' # White
txtrst='\e[0m' # Text Reset
Jujur jelasinnya susah ya,, kalo bisa kita ketemuan aja sekalian traktirin ane wkwkwkwk...
ntar edit aja file bashrc sesuka anda,,
ini beberapa file bashrc yang bisa anda coba...
Code:
#######################################################
# Dave Crouse's .bashrc file
# www.bashscripts.org
# www.usalug.org
#
# Last Modified 04-08-2006
# Running on OpenSuSE 10
#######################################################
# EXPORTS
#######################################################
PATH=$PATH:/usr/lib/festival/ ;export PATH
export PS1="[\[\033[1;34m\w\[\033[0m]\n[\t \u]$ "
export EDITOR=/usr/bin/pico
export HISTFILESIZE=3000 # the bash history should save 3000 commands
export HISTCONTROL=ignoredups #don't put duplicate lines in the history.
alias hist='history | grep $1' #Requires one input
# Define a few Color's
BLACK='\e[0;30m'
BLUE='\e[0;34m'
GREEN='\e[0;32m'
CYAN='\e[0;36m'
RED='\e[0;31m'
PURPLE='\e[0;35m'
BROWN='\e[0;33m'
LIGHTGRAY='\e[0;37m'
DARKGRAY='\e[1;30m'
LIGHTBLUE='\e[1;34m'
LIGHTGREEN='\e[1;32m'
LIGHTCYAN='\e[1;36m'
LIGHTRED='\e[1;31m'
LIGHTPURPLE='\e[1;35m'
YELLOW='\e[1;33m'
WHITE='\e[1;37m'
NC='\e[0m' # No Color
# Sample Command using color: echo -e "${CYAN}This is BASH ${RED}${BASH_VERSION%.*}${CYAN} - DISPLAY on ${RED}$DISPLAY${NC}\n"
# SOURCED ALIAS'S AND SCRIPTS
#######################################################
### Begin insertion of bbips alias's ###
source ~/.bbips/commandline/bbipsbashrc
### END bbips alias's ###
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# enable programmable completion features
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# ALIAS'S OF ALL TYPES SHAPES AND FORMS ;)
#######################################################
# Alias's to local workstations
alias tom='ssh 192.168.2.102 -l root'
alias jason='ssh 192.168.2.103 -l root'
alias randy='ssh 192.168.2.104 -l root'
alias bob='ssh 192.168.2.105 -l root'
alias don='ssh 192.168.2.106 -l root'
alias counter='ssh 192.168.2.107 -l root'
# ALIAS TO REMOTE SERVERS
alias ANYNAMEHERE='ssh YOURWEBSITE.com -l USERNAME -p PORTNUMBERHERE'
# My server info removed from above for obvious reasons ;)
# Alias's to TN5250 programs. AS400 access commands.
alias d1='xt5250 env.TERM = IBM-3477-FC env.DEVNAME=D1 192.168.2.5 &'
alias d2='xt5250 env.TERM = IBM-3477-FC env.DEVNAME=D2 192.168.2.5 &'
alias tn5250j='nohup java -jar /home/crouse/tn5250j/lib/tn5250j.jar 2>>error.log &'
# Alias's to some of my BashScripts
alias bics='sh /home/crouse/scripts/bics/bics.sh'
alias backup='sh /home/crouse/scripts/usalugbackup.sh'
alias calc='sh /home/crouse/scripts/bashcalc.sh'
alias makepdf='sh /home/crouse/scripts/makepdf.sh'
alias phonebook='sh /home/crouse/scripts/PHONEBOOK/baps.sh'
alias pb='sh /home/crouse/scripts/PHONEBOOK/baps.sh'
alias ppe='/home/crouse/scripts/passphraseencryption.sh'
alias scripts='cd /home/crouse/scripts'
# Alias's to control hardware
alias cdo='eject /dev/cdrecorder'
alias cdc='eject -t /dev/cdrecorder'
alias dvdo='eject /dev/dvd'
alias dvdc='eject -t /dev/dvd'
alias scan='scanimage -L'
alias playw='for i in *.wav; do play $i; done'
alias playo='for i in *.ogg; do play $i; done'
alias playm='for i in *.mp3; do play $i; done'
alias copydisk='dd if=/dev/dvd of=/dev/cdrecorder' # Copies bit by bit from dvd to cdrecorder drives.
alias dvdrip='vobcopy -i /dev/dvd/ -o ~/DVDs/ -l'
# Alias's to modified commands
alias ps='ps auxf'
alias home='cd ~'
alias pg='ps aux | grep' #requires an argument
alias un='tar -zxvf'
alias mountedinfo='df -hT'
alias ping='ping -c 10'
alias openports='netstat -nape --inet'
alias ns='netstat -alnp --protocol=inet | grep -v CLOSE_WAIT | cut -c-6,21-94 | tail +2'
alias du1='du -h --max-depth=1'
alias da='date "+%Y-%m-%d %A %T %Z"'
alias ebrc='pico ~/.bashrc'
# Alias to multiple ls commands
alias la='ls -Al' # show hidden files
alias ls='ls -aF --color=always' # add colors and file type extensions
alias lx='ls -lXB' # sort by extension
alias lk='ls -lSr' # sort by size
alias lc='ls -lcr' # sort by change time
alias lu='ls -lur' # sort by access time
alias lr='ls -lR' # recursive ls
alias lt='ls -ltr' # sort by date
alias lm='ls -al |more' # pipe through 'more'
# Alias chmod commands
alias mx='chmod a+x'
alias 000='chmod 000'
alias 644='chmod 644'
alias 755='chmod 755'
# Alias Shortcuts to graphical programs.
alias kwrite='kwrite 2>/dev/null &'
alias firefox='firefox 2>/dev/null &'
alias gaim='gaim 2>/dev/null &'
alias kate='kate 2>/dev/null &'
alias suk='kdesu konqueror 2>/dev/null &'
# Alias xterm and aterm
alias term='xterm -bg AntiqueWhite -fg Black &'
alias termb='xterm -bg AntiqueWhite -fg NavyBlue &'
alias termg='xterm -bg AntiqueWhite -fg OliveDrab &'
alias termr='xterm -bg AntiqueWhite -fg DarkRed &'
alias aterm='aterm -ls -fg gray -bg black'
alias xtop='xterm -fn 6x13 -bg LightSlateGray -fg black -e top &'
alias xsu='xterm -fn 7x14 -bg DarkOrange4 -fg white -e su &'
# Alias for lynx web browser
alias bbc='lynx -term=vt100 http://news.bbc.co.uk/text_only.stm'
alias nytimes='lynx -term=vt100 http://nytimes.com'
alias dmregister='lynx -term=vt100 http://desmoinesregister.com'
# SOME OF MY UNUSED ALIAS's
#######################################################
# alias d=`echo "Good Morning Dave. today's date is" | festival --tts; date +'%A %B %e' | festival --tts`
# alias shrink84='/home/crouse/shrink84/shrink84.sh'
# alias tl='tail -f /var/log/apache/access.log'
# alias te='tail -f /var/log/apache/error.log'
# SPECIAL FUNCTIONS
#######################################################
netinfo ()
{
echo "--------------- Network Information ---------------"
/sbin/ifconfig | awk /'inet addr/ {print $2}'
echo ""
/sbin/ifconfig | awk /'Bcast/ {print $3}'
echo ""
/sbin/ifconfig | awk /'inet addr/ {print $4}'
# /sbin/ifconfig | awk /'HWaddr/ {print $4,$5}'
echo "---------------------------------------------------"
}
spin ()
{
echo -ne "${RED}-"
echo -ne "${WHITE}\b|"
echo -ne "${BLUE}\bx"
sleep .02
echo -ne "${RED}\b+${NC}"
}
scpsend ()
{
scp -P PORTNUMBERHERE "$@" USERNAME@YOURWEBSITE.com:/var/www/html/pathtodirectoryonremoteserver/;
}
# NOTES
#######################################################
# To temporarily bypass an alias, we preceed the command with a \
# EG: the ls command is aliased, but to use the normal ls command you would
# type \ls
# mount -o loop /home/crouse/NAMEOFISO.iso /home/crouse/ISOMOUNTDIR/
# umount /home/crouse/NAMEOFISO.iso
# Both commands done as root only.
# WELCOME SCREEN
#######################################################
clear
for i in `seq 1 15` ; do spin; done ;echo -ne "${WHITE} USA Linux Users Group ${NC}"; for i in `seq 1 15` ; do spin; done ;echo "";
echo -e ${LIGHTBLUE}`cat /etc/SuSE-release` ;
echo -e "Kernel Information: " `uname -smr`;
echo -e ${LIGHTBLUE}`bash --version`;echo ""
echo -ne "Hello $USER today is "; date
echo -e "${WHITE}"; cal ; echo "";
echo -ne "${CYAN}";netinfo;
mountedinfo ; echo ""
echo -ne "${LIGHTBLUE}Uptime for this computer is ";uptime | awk /'up/ {print $3,$4}'
for i in `seq 1 15` ; do spin; done ;echo -ne "${WHITE} http://usalug.org ${NC}"; for i in `seq 1 15` ; do spin; done ;echo "";
echo ""; echo ""
Code:
#------------------------------
# COLORS
#------------------------------
NONE="\[\033[0m\]"
BK="\[\033[0;30m\]" #Black
EBK="\[\033[1;30m\]"
RD="\[\033[0;31m\]" #Red
ERD="\[\033[1;31m\]"
GR="\[\033[0;32m\]" #Green
EGR="\[\033[1;32m\]"
YW="\[\033[0;33m\]" #Yellow
EYW="\[\033[1;33m\]"
BL="\[\033[0;34m\]" #Blue
EBL="\[\033[1;34m\]"
MG="\[\033[0;35m\]" #Magenta
EMG="\[\033[1;35m\]"
CY="\[\033[0;36m\]" #Cyan
ECY="\[\033[1;36m\]"
WH="\[\033[0;37m\]" #White
EWH="\[\033[1;37m\]"
# user preferences
unset LESS
export PAGER=less
### power-aliases :
#==> debian package management
alias -- -search="apt-cache search"
alias -- -show="apt-cache show"
alias -- -install="apt-get install"
alias -- -remove="apt-get remove"
alias -- -update="apt-get update"
alias -- -upgrade="apt-get upgrade"
alias -- -source="dpkg -S"
alias -- -list="dpkg -l"
alias -- -files="dpkg -L"
#==> default command options
alias less="less -I -R"
alias grep="grep --color=auto"
alias ls="ls --color=auto"
#==> file removal
alias pur="rm -v *~"
alias purge='find . -name "*~" -print -exec rm -f {} \;'
### bash-settings :
#==> history timestamps (bash 3.0), ignoredups, size, etc.
HISTCONTROL=ignoredups
HISTSIZE=20000
HISTFILESIZE=20000
HISTTIMEFORMAT="[%Y-%m-%d - %H:%M:%S] "
shopt -s checkwinsize
shopt -s extglob
shopt -s nocaseglob
shopt -s nullglob dotglob
### self.bash.functions
#===> (self)
if [[ -f ~/.bash_functions ]]; then
source ~/.bash_functions
fi
export EDITOR=nano
export PATH=$PATH:~/bin
export PATH=$PATH:~/scripts
# PROMPT
if [ `id -un` != root ]; then
PS1="[${EGR}\u@\h${EBL} \W${NONE}]# "
else
PS1="[${ERD}\h${EBL} \W${NONE}]# "
fi
# Change the window title of X terminals
case $TERM in
xterm*|rxvt*|Eterm)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\00
7"'
;;
screen)
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\
\"'
;;
esac
~/.bash_functions
extract () { if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjvf $1 ;;
*.tar.bz) tar xjvf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*) echo "'$1' cannot be extracted via extra
ct()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
Code:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# login script for users, set nice prompt and colors By Felipe Ferreria
#HISTORY SIZE
HISTSIZE=100000
#HISTORY UNIQUE CMDS
HISTCONTROL=erasedups
# If not running interactively, don’t do anything
[ -z "$PS1" ] && return
# 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 “$(lesspipe)”
#Set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" -a -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
#Set a fancy prompt (non-color, unless we know we “want” color)
case “$TERM” in
xterm-color)
PS1=’${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ‘
;;
*)
# PS1=’${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ‘
# ;;
#esac
# Comment in the above and uncomment this below for a color prompt
PS1=’${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ‘
;;
esac
# If this is an xterm set the title to user@host:dir
case “$TERM” in
xterm*|rxvt*)
PROMPT_COMMAND=’echo -ne “\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007″‘
;;
*)
;;
esac
# Alias definitions.
# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
eval “`dircolors -b`”
alias ls=’ls –color=auto’
alias dir=’ls –color=auto –format=vertical’
alias vdir=’ls –color=auto –format=long’
fi
# some more ls aliases
alias ll=’ls -l’
alias la=’ls -A’
alias l=’ls -CF’
alias lll=’ls -la’
############################################################
My UBUNTU .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# login script for users, set nice prompt and colors By Felipe Ferreria
#HISTORY SIZE
HISTSIZE=100000
#HISTORY UNIQUE CMDS
HISTCONTROL=erasedups
# Basic options
# define color to additional file types
export LS_COLORS=$LS_COLORS:”*.wmv=01;35″:”*.wma=01;35″:”*.flv=01;35″:”*.m4a=01;35″
#PROMPT
#PS1=’\w/ >\[\033[m\] ‘[ "$UID" = 0 ] && PS1=’\[\033[01m\033[41m\033[37m\]\h: \w/ #\[\033[m\] ‘
# Prompt
BGREEN=’\[\033[1;32m\]‘
GREEN=’\[\033[0;32m\]‘
BRED=’\[\033[1;31m\]‘
RED=’\[\033[0;31m\]‘
BBLUE=’\[\033[1;34m\]‘
BLUE=’\[\033[0;34m\]‘
NORMAL=’\[\033[00m\]‘
PS1=”${BLUE}(${RED}\w${BLUE}) ${NORMAL}\h ${RED}\$ ${NORMAL}”
# Aliases
alias ls=’ls –color=auto’
alias ll=’ls -l –color=auto’
alias la=’ls -A –color=auto’
alias l=’ls -CF –color=auto’
alias ..=’cd ..’
alias gerp=’grep –color=auto’
alias del=’rm –target-directory=$HOME/.Trash/’
# WELCOME SCREEN
################################################## #####
clear
echo -ne “${LIGHTBLUE}” “Hello, $USER. Today is, “; date
echo -e “${BLACK}”; cal -3;
#echo -ne “${CYAN}”;
ref.
Code:
#!/bin/bash
# ~/.bashrc
####################################################
# BEER-WARE LICENSE
# Zackary Loether wrote this file. As long as you
# retain this notice you can do whatever you want
# with this file and its contents. If we meet some
# day and you think it is worth it, you can buy
# me a beer in return. -Zackary Loether
# 07/31/2009 http://www.zloether.com
####################################################
# -Directions-
# This file resides at ~/.bashrc and contains configuration
# details for how the BASH shell should behave.
# You are encouraged to modify this file to suit your preferences
# -Warning-
# This script was written and tested on Ubuntu 9.04 Jaunty Jackalope.
# Some parts of this file are system specific but most things should
# work with most BASH shells. Your mileage may vary.
# Use at your own risk.
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history
# don't overwrite GNU Midnight Commander's setting of `ignorespace'
export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
# ... or force ignoredups and ignorespace
export HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# check the window size after each command and
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
# 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\] \$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
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"
;;
*)
;;
esac
# Alias definitions.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
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
#--------------------------///
# ALIASES
#--------------------------///
alias ll='ls -lh'
alias la='ls -a'
alias reload='source ~/.bashrc'
# move files to trash
trash () {
for i in "$@"
do
DIR=`dirname "$i"`
if [ "$DIR" == "." ]; then
if [ -e "$i" ]; then
mv "$i" ~/.local/share/Trash/files
touch ~/.local/share/Trash/info/"$i".trashinfo
echo "[Trash Info]" >> ~/.local/share/Trash/info/"$i".trashinfo
echo "Path=$PWD/$i" >> ~/.local/share/Trash/info/"$i".trashinfo
DATE=`date "+%Y-%m-%dT%T"`
echo "DeletionDate=$DATE" >> ~/.local/share/Trash/info/"$i".trashinfo
else
echo "$i" does not exist
fi
else
if [ -e "$i" ]; then
LEN=`dirname "$i" | wc -m`
echo $LEN
(( LEN=$LEN + 1 ))
echo $LEN
FILE=`echo "$i" | cut -c "$LEN"-`
mv "$i" ~/.local/share/Trash/files
cd `dirname "$i"`
pwd
touch ~/.local/share/Trash/info/"$FILE".trashinfo
echo "[Trash Info]" >> ~/.local/share/Trash/info/"$FILE".trashinfo
echo "Path=$PWD/$FILE" >> ~/.local/share/Trash/info/"$FILE".trashinfo
DATE=`date "+%Y-%m-%dT%T"`
echo "DeletionDate=$DATE" >> ~/.local/share/Trash/info/"$FILE".trashinfo
cd - >> /dev/null
else
echo "$i" does not exist
fi
fi
done
}
alias sha1='openssl dgst -sha1'
alias md5='openssl dgst -md5'
alias g='grep'
alias s='ssh'
alias p='ping'
alias update='sudo aptitude update'
alias upgrade='sudo aptitude full-upgrade'
alias install='sudo aptitude install'
alias search='aptitude search'
# print IP address of each attached device
ipa () {
TMP=`ifconfig eth0 | grep "inet "`
if [ -n "$TMP" ]; then
echo -n "eth0 IP:"
ifconfig eth0 | grep "inet " | cut -d: -f2- | cut -d" " -f1
fi
TMP=`ifconfig eth1 | grep "inet "`
if [ -n "$TMP" ]; then
echo -n "eth1 IP:"
ifconfig eth1 | grep "inet " | cut -d: -f2- | cut -d" " -f1
fi
TMP=`ifconfig eth2 | grep "inet "`
if [ -n "$TMP" ]; then
echo -n "eth2 IP:"
ifconfig eth2 | grep "inet " | cut -d: -f2- | cut -d" " -f1
fi
}
# make backups of files
or () {
if [ -e "$@" ]; then
for i in "$@"
do
cp "$i" "$i".orig
done
fi
}
#--------------------------///
# NAVIGATION
#--------------------------///
c () {
if [ -d "$1" ]; then
cd "$1"
pwd
ls
else
cd
pwd
ls
fi
}
alias doc='c ~/Documents'
alias desk='c ~/Desktop'
alias down='c ~/Downloads'
alias ..='c ..'
alias ...='c ../..'
alias ....='c ../../..'
alias b='cd -;ls' #previous directory
#--------------------------///
# EXTRACTION PROGRAM
#--------------------------///
extract () {
if [ -f "$1" ] ; then
for i in "$@"
do
case "$i" in
*.tar.bz2) tar xvjf "$i" ;;
*.tar.gz) tar xvzf "$i" ;;
*.bz2) bunzip2 "$i" ;;
*.rar) unrar x "$i" ;;
*.gz) gunzip "$i" ;;
*.tar) tar xvf "$i" ;;
*.tbz2) tar xvjf "$i" ;;
*.tgz) tar xvzf "$i" ;;
*.zip) unzip "$i" ;;
*.Z) uncompress "$i" ;;
*.7z) 7z x "$i" ;;
*) echo "'$i' cannot be extracted via >extract<" ;;
esac
done
else
echo "'$i' is not a valid file"
fi
}
# Shortcut for establishing SSH connections. Syntax is:
# $ h host1 -or- $ h host2
h () {
if [ ! -z "$1" ]; then
case "$1" in
host1) ssh 192.168.x.x ;;
host2) ssh 192.168.x.y ;;
esac
fi
}
# Shortcut for transferring files via scp. Syntax is:
# $ send host1 file1 file2
send () {
if [ ! -z "$1" ] && [ -e "$2" ]; then
LOC="$1"
shift
case "$LOC" in
host1) scp -r "$@" 192.168.x.x:~/ ;;
host2) scp -r "$@" 192.168.x.y:~/ ;;
esac
fi
}
# 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 ]; then
. /etc/bash_completion
fi
Code:
# EXPORTS
#######################################################
PATH=$PATH:/usr/lib/festival/ ;export PATH
export PS1="[\[\033[1;34m\w\[\033[0m]\n[\t \u]$ "
export EDITOR=/usr/bin/pico
export HISTFILESIZE=3000 # the bash history should save 3000 commands
export HISTCONTROL=ignoredups #don't put duplicate lines in the history.
alias hist='history | grep $1' #Requires one input
# Define a few Color's
BLACK='\e[0;30m'
BLUE='\e[0;34m'
GREEN='\e[0;32m'
CYAN='\e[0;36m'
RED='\e[0;31m'
PURPLE='\e[0;35m'
BROWN='\e[0;33m'
LIGHTGRAY='\e[0;37m'
DARKGRAY='\e[1;30m'
LIGHTBLUE='\e[1;34m'
LIGHTGREEN='\e[1;32m'
LIGHTCYAN='\e[1;36m'
LIGHTRED='\e[1;31m'
LIGHTPURPLE='\e[1;35m'
YELLOW='\e[1;33m'
WHITE='\e[1;37m'
NC='\e[0m' # No Color
# Sample Command using color: echo -e "${CYAN}This is BASH ${RED}${BASH_VERSION%.*}${CYAN} - DISPLAY on ${RED}$DISPLAY${NC}\n"
# SOURCED ALIAS'S AND SCRIPTS
#######################################################
### Begin insertion of bbips alias's ###
source ~/.bbips/commandline/bbipsbashrc
### END bbips alias's ###
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# enable programmable completion features
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
# ALIAS'S OF ALL TYPES SHAPES AND FORMS ;)
#######################################################
# Alias's to local workstations
alias tom="ssh 192.168.2.102 -l root"
alias jason="ssh 192.168.2.103 -l root"
alias randy="ssh 192.168.2.104 -l root"
alias bob="ssh 192.168.2.105 -l root"
alias don="ssh 192.168.2.106 -l root"
alias counter="ssh 192.168.2.107 -l root"
# ALIAS TO REMOTE SERVERS
alias ANYNAMEHERE="ssh YOURWEBSITE.com -l USERNAME -p PORTNUMBERHERE"
# My server info removed from above for obvious reasons ;)
# Alias's to TN5250 programs. AS400 access commands.
alias d1='xt5250 env.TERM = IBM-3477-FC env.DEVNAME="D1" 192.168.2.5 &'
alias d2='xt5250 env.TERM = IBM-3477-FC env.DEVNAME="D2" 192.168.2.5 &'
alias tn5250j='nohup java -jar /home/crouse/tn5250j/lib/tn5250j.jar 2>>error.log &'
# Alias's to some of my BashScripts
alias bics='sh /home/crouse/scripts/bics/bics.sh'
alias backup='sh /home/crouse/scripts/usalugbackup.sh'
alias calc='sh /home/crouse/scripts/bashcalc.sh'
alias makepdf='sh /home/crouse/scripts/makepdf.sh'
alias phonebook='sh /home/crouse/scripts/PHONEBOOK/baps.sh'
alias pb='sh /home/crouse/scripts/PHONEBOOK/baps.sh'
alias ppe='/home/crouse/scripts/passphraseencryption.sh'
alias scripts='cd /home/crouse/scripts'
# Alias's to control hardware
alias cdo="eject /dev/cdrecorder"
alias cdc="eject -t /dev/cdrecorder"
alias dvdo="eject /dev/dvd"
alias dvdc="eject -t /dev/dvd"
alias scan='scanimage -L'
alias playw='for i in *.wav; do play $i; done'
alias playo='for i in *.ogg; do play $i; done'
alias playm='for i in *.mp3; do play $i; done'
alias copydisk='dd if=/dev/dvd of=/dev/cdrecorder' # Copies bit by bit from dvd to cdrecorder drives.
alias dvdrip='vobcopy -i /dev/dvd/ -o ~/DVDs/ -l'
# Alias's to modified commands
alias ps='ps auxf'
alias home='cd ~'
alias pg='ps aux | grep' #requires an argument
alias un='tar -zxvf'
alias mountedinfo='df -hT'
alias ping='ping -c 10'
alias openports='netstat -nape --inet'
alias ns='netstat -alnp --protocol=inet | grep -v CLOSE_WAIT | cut -c-6,21-94 | tail +2'
alias du1='du -h --max-depth=1'
alias da='date "+%Y-%m-%d %A %T %Z"'
alias ebrc='pico ~/.bashrc'
# Alias to multiple ls commands
alias la='ls -Al' # show hidden files
alias ls='ls -aF --color=always' # add colors and file type extensions
alias lx='ls -lXB' # sort by extension
alias lk='ls -lSr' # sort by size
alias lc='ls -lcr' # sort by change time
alias lu='ls -lur' # sort by access time
alias lr='ls -lR' # recursive ls
alias lt='ls -ltr' # sort by date
alias lm='ls -al |more' # pipe through 'more'
# Alias chmod commands
alias mx='chmod a+x'
alias 000='chmod 000'
alias 644='chmod 644'
alias 755='chmod 755'
# Alias Shortcuts to graphical programs.
alias kwrite='kwrite 2>/dev/null &'
alias firefox='firefox 2>/dev/null &'
alias gaim='gaim 2>/dev/null &'
alias kate='kate 2>/dev/null &'
alias suk='kdesu konqueror 2>/dev/null &'
# Alias xterm and aterm
alias term='xterm -bg AntiqueWhite -fg Black &'
alias termb='xterm -bg AntiqueWhite -fg NavyBlue &'
alias termg='xterm -bg AntiqueWhite -fg OliveDrab &'
alias termr='xterm -bg AntiqueWhite -fg DarkRed &'
alias aterm='aterm -ls -fg gray -bg black'
alias xtop="xterm -fn 6x13 -bg LightSlateGray -fg black -e top &"
alias xsu="xterm -fn 7x14 -bg DarkOrange4 -fg white -e su &"
# Alias for lynx web browser
alias bbc='lynx -term=vt100 http://news.bbc.co.uk/text_only.stm'
alias nytimes='lynx -term=vt100 http://nytimes.com'
alias dmregister='lynx -term=vt100 http://desmoinesregister.com'
# SOME OF MY UNUSED ALIAS's
#######################################################
# alias d=`echo "Good Morning Dave. today's date is" | festival --tts; date +'%A %B %e' | festival --tts`
# alias shrink84='/home/crouse/shrink84/shrink84.sh'
# alias tl='tail -f /var/log/apache/access.log'
# alias te='tail -f /var/log/apache/error.log'
# SPECIAL FUNCTIONS
#######################################################
netinfo ()
{
echo "--------------- Network Information ---------------"
/sbin/ifconfig | awk /'inet addr/ {print $2}'
echo ""
/sbin/ifconfig | awk /'Bcast/ {print $3}'
echo ""
/sbin/ifconfig | awk /'inet addr/ {print $4}'
# /sbin/ifconfig | awk /'HWaddr/ {print $4,$5}'
echo "---------------------------------------------------"
}
spin ()
{
echo -ne "${RED}-"
echo -ne "${WHITE}\b|"
echo -ne "${BLUE}\bx"
sleep .02
echo -ne "${RED}\b+${NC}"
}
scpsend ()
{
scp -P PORTNUMBERHERE "$@" USERNAME@YOURWEBSITE.com:/var/www/html/pathtodirectoryonremoteserver/;
}
# NOTES
#######################################################
# To temporarily bypass an alias, we preceed the command with a \
# EG: the ls command is aliased, but to use the normal ls command you would
# type \ls
# mount -o loop /home/crouse/NAMEOFISO.iso /home/crouse/ISOMOUNTDIR/
# umount /home/crouse/NAMEOFISO.iso
# Both commands done as root only.
# WELCOME SCREEN
#######################################################
clear
for i in `seq 1 15` ; do spin; done ;echo -ne "${WHITE} USA Linux Users Group ${NC}"; for i in `seq 1 15` ; do spin; done ;echo "";
echo -e ${LIGHTBLUE}`cat /etc/SuSE-release` ;
echo -e "Kernel Information: " `uname -smr`;
echo -e ${LIGHTBLUE}`bash --version`;echo ""
echo -ne "Hello $USER today is "; date
echo -e "${WHITE}"; cal ; echo "";
echo -ne "${CYAN}";netinfo;
mountedinfo ; echo ""
echo -ne "${LIGHTBLUE}Uptime for this computer is ";uptime | awk /'up/ {print $3,$4}'
for i in `seq 1 15` ; do spin; done ;echo -ne "${WHITE} http://usalug.org ${NC}"; for i in `seq 1 15` ; do spin; done ;echo "";
echo ""; echo ""
Tergantung bagaimana kita senangnya modifikasi aja ndiri ya
Tidak ada komentar:
Posting Komentar