|
Home | Switchboard | Unix Administration | Red Hat | TCP/IP Networks | Neoliberalism | Toxic Managers |
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and bastardization of classic Unix |
|
|
Details I was playing with my .bashrc file again, and was once again impressed by how you can tweak Linux to do what YOU want it to do so easily. I am sure there are tons of other tweaks you can do to your .bashrc file, but I really like some of mine, and thought I would share them. Some of the alias's I created, some I found on the net, and some things in my .bashrc file are just there for fun, like the "# WELCOME SCREEN", although it does serve a purpose for me at the same time, it might not be something everyone would want or need. For those that don't know what a .bashrc file does: "The ~/.bashrc file determines the behavior of interactive shells." Quoted From: The Advanced Bash Scripting Guide Basically , it allows you to create shortcuts (alias's) and interactive programs (functions) that run on the startup of the bash shell or that are used when running an interactive shell. For example, it's much easier to just type: ebrc instead of pico ~/.bashrc (I used the alias ebrc , and it stands for "Edit Bash RC file". I could have also aliased it to just use one letter, making it a VERY fast short cut. The bashrc file allows you to create alias's (shortcuts) to almost anything you want. My list is pretty long, but I'm sure there is someone with a longer list ;) I have my .bashrc file setup in sections. The following is the breakdown by section of how I keep my list of alias's and functions separated. This is just how I do this, your .bashrc file can be modified to suit YOUR needs, that's the interesting part about the .bashrc file. It's VERY customizable and very easy to change. Header (So I know when i modified it last and what i was running it on) Exports (So I can set history size, paths , editors, define colors, etc,) Sourced Alias's (So I can find those hidden alias's faster) Workstation Alias's (so i can ssh to local machines quickly) Remote Server Alias's (so i can ssh to remote servers easily) Script Alias's (quick links to some of my bashscripts) Hardware control alias's (so I can control cd/dvd/scanners/audio/etc) Modified commands (Alias's to normal linux commands with special flags) Chmod Alias's (makes changing permissions faster) Alias's for GUI programs (start firefox, etc from command line) Alias's for xterm and others (open xterm with special settings) Alias's for Lynx (open lynx with urls - kind of a bash bookmark ;) ) UNused Alias's (Alias's that aren't in use on the system, but that i might use later) Special functions (more of a function than just an alias..it goes here) Notes (that should be self explanatory ;) ) Welcome Screen (code to make my bash shell display some stuff as it starts up) That's how I lay out my .bashrc files. It may not be perfect, but it works well for me. I like making changes in just my .bashrc file and not the global files. I like the .bashrc file because you don't need root permissions to make changes that make your life easier at the bash shell. The following is my .bashrc file (with some things obviously commented out for security... but most of it should be self explanatory). Anyone with comments/suggestions/ideas feel free to let me know. I'm always looking for new and interesting things to do with the .bashrc file. Want to know what alias's your bash shell has? Simply type the word alias at the command line. The shell will then print out the list of active alias's to the standard output (normally your screen). ####################################################### # 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 "$@" [email protected]:/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 ""The following belong under the "function" section in my .bashrc. Useable as seperate programs, I've integrated them simply as functions for my .bashrc file in order to make them quick to use and easy to modify and find. These are functions that are used to symetrically encrypt and to decrypt files and messages. Some are completely command line, and the last two create gui interfaces to locate the files to encrypt/decrypt. If you create a program out of the functions creating a link via a shortcut/icon on the desktop would create a completely gui based interface to locate and encrypt/decrypt files. Either way, it's an easy way to use gpg. Requires: zenity, gpg ################### Begin gpg functions ################## encrypt () { # Use ascii armor gpg -ac --no-options "$1" } bencrypt () { # No ascii armor # Encrypt binary data. jpegs/gifs/vobs/etc. gpg -c --no-options "$1" } decrypt () { gpg --no-options "$1" } pe () { # Passphrase encryption program # Created by Dave Crouse 01-13-2006 # Reads input from text editor and encrypts to screen. clear echo " Passphrase Encryption Program"; echo "--------------------------------------------------"; echo ""; which $EDITOR &>/dev/null if [ $? != "0" ]; then echo "It appears that you do not have a text editor set in your .bashrc file."; echo "What editor would you like to use ? " ; read EDITOR ; echo ""; fi echo "Enter the name/comment for this message :" read comment $EDITOR passphraseencryption gpg --armor --comment "$comment" --no-options --output passphraseencryption.gpg --symmetric passphraseencryption shred -u passphraseencryption ; clear echo "Outputting passphrase encrypted message"; echo "" ; echo "" ; cat passphraseencryption.gpg ; echo "" ; echo "" ; shred -u passphraseencryption.gpg ; read -p "Hit enter to exit" temp; clear } keys () { # Opens up kgpg keymanager kgpg -k } encryptfile () { zenity --title="zcrypt: Select a file to encrypt" --file-selection > zcrypt encryptthisfile=`cat zcrypt`;rm zcrypt # Use ascii armor # --no-options (for NO gui usage) gpg -acq --yes ${encryptthisfile} zenity --info --title "File Encrypted" --text "$encryptthisfile has been encrypted" } decryptfile () { zenity --title="zcrypt: Select a file to decrypt" --file-selection > zcrypt decryptthisfile=`cat zcrypt`;rm zcrypt # NOTE: This will OVERWRITE existing files with the same name !!! gpg --yes -q ${decryptthisfile} zenity --info --title "File Decrypted" --text "$encryptthisfile has been decrypted" } ################### End gpg functions ##################
Good sample bashrc file
Details I was playing with my .bashrc file again, and was once again impressed by how you can tweak Linux to do what YOU want it to do so easily. I am sure there are tons of other tweaks you can do to your .bashrc file, but I really like some of mine, and thought I would share them. Some of the alias's I created, some I found on the net, and some things in my .bashrc file are just there for fun, like the "# WELCOME SCREEN", although it does serve a purpose for me at the same time, it might not be something everyone would want or need. For those that don't know what a .bashrc file does: "The ~/.bashrc file determines the behavior of interactive shells." Quoted From: The Advanced Bash Scripting Guide Basically , it allows you to create shortcuts (alias's) and interactive programs (functions) that run on the startup of the bash shell or that are used when running an interactive shell. For example, it's much easier to just type: ebrc instead of pico ~/.bashrc (I used the alias ebrc , and it stands for "Edit Bash RC file". I could have also aliased it to just use one letter, making it a VERY fast short cut. The bashrc file allows you to create alias's (shortcuts) to almost anything you want. My list is pretty long, but I'm sure there is someone with a longer list ;) I have my .bashrc file setup in sections. The following is the breakdown by section of how I keep my list of alias's and functions separated. This is just how I do this, your .bashrc file can be modified to suit YOUR needs, that's the interesting part about the .bashrc file. It's VERY customizable and very easy to change. Header (So I know when i modified it last and what i was running it on) Exports (So I can set history size, paths , editors, define colors, etc,) Sourced Alias's (So I can find those hidden alias's faster) Workstation Alias's (so i can ssh to local machines quickly) Remote Server Alias's (so i can ssh to remote servers easily) Script Alias's (quick links to some of my bashscripts) Hardware control alias's (so I can control cd/dvd/scanners/audio/etc) Modified commands (Alias's to normal linux commands with special flags) Chmod Alias's (makes changing permissions faster) Alias's for GUI programs (start firefox, etc from command line) Alias's for xterm and others (open xterm with special settings) Alias's for Lynx (open lynx with urls - kind of a bash bookmark ;) ) UNused Alias's (Alias's that aren't in use on the system, but that i might use later) Special functions (more of a function than just an alias..it goes here) Notes (that should be self explanatory ;) ) Welcome Screen (code to make my bash shell display some stuff as it starts up) That's how I lay out my .bashrc files. It may not be perfect, but it works well for me. I like making changes in just my .bashrc file and not the global files. I like the .bashrc file because you don't need root permissions to make changes that make your life easier at the bash shell. The following is my .bashrc file (with some things obviously commented out for security... but most of it should be self explanatory). Anyone with comments/suggestions/ideas feel free to let me know. I'm always looking for new and interesting things to do with the .bashrc file. Want to know what alias's your bash shell has? Simply type the word alias at the command line. The shell will then print out the list of active alias's to the standard output (normally your screen). ####################################################### # 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 "$@" [email protected]:/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 ""The following belong under the "function" section in my .bashrc. Useable as seperate programs, I've integrated them simply as functions for my .bashrc file in order to make them quick to use and easy to modify and find. These are functions that are used to symetrically encrypt and to decrypt files and messages. Some are completely command line, and the last two create gui interfaces to locate the files to encrypt/decrypt. If you create a program out of the functions creating a link via a shortcut/icon on the desktop would create a completely gui based interface to locate and encrypt/decrypt files. Either way, it's an easy way to use gpg. Requires: zenity, gpg ################### Begin gpg functions ################## encrypt () { # Use ascii armor gpg -ac --no-options "$1" } bencrypt () { # No ascii armor # Encrypt binary data. jpegs/gifs/vobs/etc. gpg -c --no-options "$1" } decrypt () { gpg --no-options "$1" } pe () { # Passphrase encryption program # Created by Dave Crouse 01-13-2006 # Reads input from text editor and encrypts to screen. clear echo " Passphrase Encryption Program"; echo "--------------------------------------------------"; echo ""; which $EDITOR &>/dev/null if [ $? != "0" ]; then echo "It appears that you do not have a text editor set in your .bashrc file."; echo "What editor would you like to use ? " ; read EDITOR ; echo ""; fi echo "Enter the name/comment for this message :" read comment $EDITOR passphraseencryption gpg --armor --comment "$comment" --no-options --output passphraseencryption.gpg --symmetric passphraseencryption shred -u passphraseencryption ; clear echo "Outputting passphrase encrypted message"; echo "" ; echo "" ; cat passphraseencryption.gpg ; echo "" ; echo "" ; shred -u passphraseencryption.gpg ; read -p "Hit enter to exit" temp; clear } keys () { # Opens up kgpg keymanager kgpg -k } encryptfile () { zenity --title="zcrypt: Select a file to encrypt" --file-selection > zcrypt encryptthisfile=`cat zcrypt`;rm zcrypt # Use ascii armor # --no-options (for NO gui usage) gpg -acq --yes ${encryptthisfile} zenity --info --title "File Encrypted" --text "$encryptthisfile has been encrypted" } decryptfile () { zenity --title="zcrypt: Select a file to decrypt" --file-selection > zcrypt decryptthisfile=`cat zcrypt`;rm zcrypt # NOTE: This will OVERWRITE existing files with the same name !!! gpg --yes -q ${decryptthisfile} zenity --info --title "File Decrypted" --text "$encryptthisfile has been decrypted" } ################### End gpg functions ##################
bashrc :
# # Jamie's Common .bashrc file for all platforms # --------------------------------------------- # # See myenv/bashrc.$ARCH for platform specific .bashrc files. # # Work out ARCH name from platforms we use. ARCH=`uname` case $ARCH in Linux*) ARCH=linux ;; SunOS*) ARCH=solaris ;; OSF1*) ARCH=osf1 ;; IRIX64*) ARCH=irix ;; *) ;; esac export ARCH # Load platform specific bashrc file if one exists. if test -e ~/myenv/bashrc.$ARCH ; then source ~/myenv/bashrc.$ARCH fi # Set up common paths. This is where I put general executables # and scripts if [ -n "$PATH" ]; then PATH=$PATH:~/bin:~/bin/$ARCH else PATH=~/bin:~/bin/$ARCH fi # Set up GNU paths if they exist. For some of the machines I use I # don't have root access to install my own software, so I build it # and install it in ~/gnu/$ARCH. ~/gnu is for stuff that is common # across all platforms (e.g. scripts). for DIR in ~/gnu/bin \ ~/gnu/bin/$ARCH ; do if [ -n "$PATH" ]; then test -d $DIR && PATH=$DIR:$PATH else test -d $DIR && PATH=$DIR fi done PATH=$PATH:/usr/local/bin export PATH # Set up man/info paths for above. Some of the software installed in # the above may have man/info pages and I'd quite like access to # these for DIR in ~/gnu/man \ ~/gnu/$ARCH/man ; do if [ -n "$MANPATH" ]; then test -d $DIR && MANPATH=$MANPATH:$DIR else test -d $DIR && MANPATH=$DIR fi done for DIR in ~/gnu/info \ ~/gnu/$ARCH/info ; do if [ -n "$INFODIR" ]; then test -d $DIR && INFODIR=$INFODIR:$DIR else test -d $DIR && INFODIR=$DIR fi done INFOPATH=$INFORDIR export MANPATH INFODIR INFOPATH # set X display if we are on remote host. DISPLAY= if [ -n "$REMOTEHOST" ]; then DISPLAY=$REMOTEHOST:0.0 elif [ $TERM != linux ]; then DISPLAY=:0.0 fi export DISPLAY # Load any aliases. source ~/myenv/bash.aliases
Society
Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers : Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism : The Iron Law of Oligarchy : Libertarian Philosophy
Quotes
War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda : SE quotes : Language Design and Programming Quotes : Random IT-related quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard Shaw : Mark Twain Quotes
Bulletin:
Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 : Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law
History:
Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds : Larry Wall : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOS : Programming Languages History : PL/1 : Simula 67 : C : History of GCC development : Scripting Languages : Perl history : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history
Classic books:
The Peter Principle : Parkinson Law : 1984 : The Mythical Man-Month : How to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor
The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D
Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.
This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...
|
You can use PayPal to to buy a cup of coffee for authors of this site |
Disclaimer:
The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.
Last modified: July, 07, 2013