Difference between revisions of "Recommended bash aliases"
Jump to navigation
Jump to search
import>Dw34 |
import>Jg525 |
||
Line 2: | Line 2: | ||
Copying ~wales/.inputrc to your home directory will also reduce your typing. It sets up ESC then . as the last item on the previous line and ESC then , and backward search in history matching the start of what you have already typed. |
Copying ~wales/.inputrc to your home directory will also reduce your typing. It sets up ESC then . as the last item on the previous line and ESC then , and backward search in history matching the start of what you have already typed. |
||
+ | |||
+ | == Function to remove filename extensions == |
||
+ | Place |
||
+ | <pre> |
||
+ | # rm filename extension |
||
+ | function rmext() { |
||
+ | find . -mindepth 1 -maxdepth 1 -type f | grep $1 |\ |
||
+ | sed 's/\(.*\)\..*/\1/' | xargs -I {} mv {}.$1 {}; |
||
+ | } |
||
+ | </pre> |
||
+ | in ~/.bash_aliases or ~/.bashrc then |
||
+ | <pre> |
||
+ | source ~/.bashrc |
||
+ | </pre> |
||
+ | Usage |
||
+ | <pre> |
||
+ | $ rmext <extension> |
||
+ | </pre> |
||
+ | Example |
||
+ | <pre> |
||
+ | $ ls -1 |
||
+ | first.file.test |
||
+ | second.file.test |
||
+ | important.file |
||
+ | </pre> |
||
+ | <pre> |
||
+ | $ rmext test |
||
+ | $ ls -1 |
||
+ | first.file |
||
+ | second.file |
||
+ | important.file |
||
+ | </pre> |
||
+ | |||
+ | == xpdf == |
||
+ | <pre> |
||
+ | # fit width and set geometry |
||
+ | alias xpdf="xpdf -z width -geometry 1000x1000" |
||
+ | </pre> |
Revision as of 13:45, 27 February 2009
~wales/.bashalias
Copying ~wales/.inputrc to your home directory will also reduce your typing. It sets up ESC then . as the last item on the previous line and ESC then , and backward search in history matching the start of what you have already typed.
Function to remove filename extensions
Place
# rm filename extension function rmext() { find . -mindepth 1 -maxdepth 1 -type f | grep $1 |\ sed 's/\(.*\)\..*/\1/' | xargs -I {} mv {}.$1 {}; }
in ~/.bash_aliases or ~/.bashrc then
source ~/.bashrc
Usage
$ rmext <extension>
Example
$ ls -1 first.file.test second.file.test important.file
$ rmext test $ ls -1 first.file second.file important.file
xpdf
# fit width and set geometry alias xpdf="xpdf -z width -geometry 1000x1000"