bash shell tips     
Bash shell

Redirect both stderr and stdout to somewhere (/dev/null perhaps?)
[command] > /dev/null 2>&1

If you hit ctrl-s in a terminal, it will not display anything you type.
To get the terminal back to normal, hit ctrl-q

command line sequence:
for i in {1..10}; do echo $i; done

to filter out text in a list:
ls * | grep -v 'ignorethis\|andthis\|thistoo'

To get color in the terminal add the following to your environment
(this was in FreeBSD)
alias ls="ls -G"
export TERM=xterm-color

To avoid having duplicates in your command history, add the following to a
bash configuration file:
export HISTIGNORE=\&

That way it will only store one copy of the command.

If you get error messages like "./script 16: unbalanced [" when you're using an
if statement in your shell script, make sure there is a space after the [
and before the ] in the conditional.

To execute multiple commands with the find -exec option, use escaped ampersands:
find . -name '*.txt' -exec ls -l {} \&\& touch {} \;

If you resize your terminal, set $COLUMNS or $LINES to avoid premature line-wrapping.

Updated Nov 21, 2011

Number of readers
home
about me
blog archives
- docs
acroread
firefox
java
linux
mysql
perl
rpm
shell
vim
win

entertainment
experiences
funny lists
humor
intellectual
interests
metafilter
music
opinions
photos
web designs
tools
software
webmaster help

Sign up
Enter your email address to be notified of new posts




Search the site







Random quote
(View all quotes)
"I don't know the key to success, but the key to failure is trying to please everybody."










(?) Choose theme:  X X X X X X