~/.profile ~/.bash_login ~/.bashrc
# .bashrc # Prevent pager from clearing the screen export LESS='-X~deMwPM?f%f ?e[EOF] ?lt[Line\: %lb].:?lt[Line\: %lt]. ?pt%pt\%...'
# Prevent vi from clearing the screen export EXINIT="set t_ti= t_te="
LESS=-egimQrXF LESS='-X~deMwPM?f%f ?e[EOF] ?lt[Line\: %lb].:?lt[Line\: %lt]. ?pt%pt\%...'
The significant character is *X*, which according to the /less/ man page, -X or --no-init Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen.
chsh -s /usr/local/bin/fish
To set your colors, run ‘fish_config’
To scan your man pages for completions, run ‘fish_update_completions’
Easily renaming multiple files.
for i in lines*; do mv "$i" "${i/PART_TO_REMOVE/}"; done;
for i in lines*; do mv "$i" "${i/PART_TO_REPLACE/}"REPLACE_WITH; done
ls -1 | sed "s/\(.*\)PART_TO_REMOVE\(.*\)$/mv '&' '\1REPLACE_WITH\2'/" | sh
ls -1 | sed "s/\(.*\)PART_TO_REMOVE\(.*\)$/mv '&' '\1\2'/" | sh
!!:gs/old/new
cp filename.txt{,.bak}
————————————————————————————————————————
At the bash prompt, hit Ctrl-R, then type ‘man’. As you type, bash will search backwards through your command history for what you have typed, displaying its current match on the command line. Hitting Enter will submit that command, or you can edit it as normal. If the first (i.e. most recent) match isn’t the right one, you can hit Ctrl-R again to iterate through the matches (from the newest to the oldest).
So in your four-command example, your fifth command line would be:
$ ^Rman
(Another useful trick, although it doesn’t work in all bash installations by default – I suspect it’s to do with readline configuration but haven’t had time to tweak – is Ctrl-O, which means “run the current command then bring up the next command in the history”. It’s easier to describe with an example – if instead of hitting Enter in the Ctrl-R example above, you did
$ ^Rman^O
then when you quit the man page you would have “sudo grep…” waiting on your command line. If you kept hitting Ctrl-O it would execute the rest of the commands in sequence. It’s particularly useful for something like an edit-compile-test cycle where you repetitively execute a small set of commands in the same order.)
————————————————————————————————————————
BINDING KEYS:
http://www.geocities.com/h2428/petar/bash_bind.htm
C- Control
M- Alt/Option
COMMANDS:
Ctrl+a = Jump to beginning of line.
Ctrl+e = Jump to end of line.
Ctrl+m = Enter/Return
============================================================================
TCSH
FreeBSD uses the same tcsh. It is just the default configuration file is set differently. See #28 (“Why does FreeBSD’s tcsh do history browsing differently than I expect?”) on the tcsh FAQ. By default up is bound to up-history, just bind it to history-search-backward to replicate FreeBSD’s behavior.
FreeBSD’s dot.cshrc in /usr/share/skel has the following line:
bindkey -k up history-search-backward