Tip #180 Permanent bash history
Often I find myself using Ctrl-R in Bash to get an old command, only to find that too many days have passed and it's no longer in the .bash_history file.It is possible to increase the number of lines in the history file, but there can always be a moment when you'll need a long command from many months ago. The solution below uses the PROMPT_COMMAND variable, a command that bash executes before showing each prompt. Here are the two lines to add to your profile:
Read more »
- TAGS:
- history
- bash
- redirection
Tip #179 Disable bash history
Disable history for a particular account in bash with:(in home dir)
Read more »
- TAGS:
- history
- bash
- redirection
Tip #21
Place a filename at the beginning of the line to make it easier to edit the search at the end of the command.Read more »
- TAGS:
- grep
- redirection
Tip #23
It can be useful to not only know what has gone to stdout and stderr but also where they occurred with respect to each other.Allow stderr to go to err.txt, stdout to out.txt and both to mix.txt
Read more »
- TAGS:
- redirection
- tee
Tip #77 Bash fork bomb
Don't forget the bash fork bomb. DO NOT TRY THIS AT HOME... Posted here so that you don't see this in a forum or a mailing list and use it without knowing:Read more »
- TAGS:
- bash
- redirection
Tip #78 network copy with ssh and tar
You can use ssh in conjunction with tar to pull an entire directory tree from a remote machine into your current directory:ssh <username@sourcehost> tar cf - -C <sourcedir> . | tar xvf -
For example, let's say you have a "bsmith" account on a host called "apple". You want to copy those files into your "bobsmith" account on a host called "pear". You'd log into your "bobsmith@pear" account and type the following:
ssh bsmith@apple tar cf - -C /home/bsmith . | tar xvf -
This technique is useful when you have insufficient disk space on the source machine to make an intermediate tarball. Read more »
- TAGS:
- tar
- redirection
alias aptitude at awk bash bc cal cat cd colrm comm cp csh curl cut date dd df dialog diff dirname dpkg du fc find fuser grep gs gzip history iconv kill ksh last less ln ls lsof lynx m4 md5sum mkdir mkfifo mkisofs mv mysql nc netstat openssl OSX perl ping popd ps pushd python read redirection rm scp screen sed sort ssh stat sudo svn tail tar tee test top tr uniq vim wc wget xargs