C-x C-e
will open the command line in $EDITOR.
!* |
Designates all arguments of the preceding command. |
!^ |
Designates the first argument of the preceding command. |
!$ |
Designates the last argument of the preceding command. |
^la^t |
Replaces the -la options with -t in the preceding command. |
sudo !! |
Execute the previous command with sudo. |
!whatever:p
| Show but don't execute the last command that starts with whatever.
!!:gs/foo/bar |
Execute the last command, replacing all instances of foo with bar. |
-n |
Go n events back |
:n |
reference a word number |
:p |
just print the event |
!50- foo |
run command 50 replacing the last argument with "foo" |
grep -v |
Shows lines that don't match the pattern |
cp foo{,.bak} |
Make a backup of foo. |
Example of find using -exec
:
find . -type f -exec file ’{}’ \;
Stick the job in the background (ctrl-Z then "bg") then detach it from the terminal (in bash, "disown -h %[jobid]"). You may then close the terminal.
Add to ~/.bashrc
:
# Use bash-completion, if available if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi
M-{} |
Include all expansions. Also can do things like mkdir -p foo/{cur,new,tmp} . |
bind -P
will show keybindings.
I'm trying to change the way people approach knowledge and information in
general. I think that to try to own knowledge, to try to control whether people
are allowed to use it, or to try to stop other people from sharing it, is
sabotage. It is an activity that benefits the person that does it at the cost
of impoverishing all of society. One person gains one dollar by destroying two
dollars' worth of wealth. I think a person with a conscience wouldn't do that
sort of thing except perhaps if he would otherwise die. And of course the
people who do this are fairly rich; I can only conclude that they are
unscrupulous. I would like to see people get rewards for writing free software
and for encouraging other people to use it. I don't want to see people get
rewards for writing proprietary software because that is not really a
contribution to society. The principle of capitalism is the idea that people
manage to make money by producing things and thereby are encouraged to do what
is useful, automatically, so to speak. But that doesn't work when it comes to
owning knowledge. They are encouraged to do not really what's useful, and what
really is useful is not encouraged. I think it is important to say that
information is different from material objects like cars and loaves of bread
because people can copy it and share it on their own and, if nobody attempts to
stop them, they can change it and make it better for themselves. That is a
useful thing for people to do. This isn't true of loaves of bread. If you have
one loaf of bread and you want another, you can't just put your loaf of bread
into a bread copier. you can't make another one except by going through all the
steps that were used to make the first one. It therefore is irrelevant whether
people are permitted to copy it--it's impossible.
-- Richard Stallman, interview in BYTE, 1986
This page was last modified on 2012 August 12. "NotesBash" by John Sullivan is Copyright ©2003 - 2011, and licensed under the Creative Commons Attribution-Share Alike 3.0 United States License.