Top Ten One-Liners from CommandLineFu Explained(catonmat.net)
catonmat.net
Top Ten One-Liners from CommandLineFu Explained
http://www.catonmat.net/blog/top-ten-one-liners-from-commandlinefu-explained/
9 comments
An important addition to that is to repeatedly hit ctrl-r to cycle through the matching commands in the history.
How do you reverse the search? <S-C-R> didn't do it for me. Either way this could be a good substitute for what I do now, tediously grepping .zsh/bash_history...
If by reverse you mean going forward instead of backwards, that should be done with Ctrl-S; it does not work in Bash though, since Ctrl-S locks the scrolling of the terminal. I believe this behavior can be overridden, through some .xinputrc settings perhaps, but I haven't still found enough motivation to look it up!
edit: ok, I've found this: http://wiki.archlinux.org/index.php/Bash#History_search
edit: ok, I've found this: http://wiki.archlinux.org/index.php/Bash#History_search
I'm pretty I learned this from reading an article on HN... anyone got a citation for me?
Perhaps my article "The Definitive Guide to Bash History?"
http://www.catonmat.net/blog/the-definitive-guide-to-bash-co...
http://www.catonmat.net/blog/the-definitive-guide-to-bash-co...
When I need to do number one -- add sudo to the previous command -- I just use the up arrow, Ctrl-a to get to the beginning of the line, and add sudo. It's a little slower than the method in the article, but I find it downright dangerous to have something in your command history that means "do whatever was typed previously as root".
It actually won't be in your command history as that. The entry will go into your command history as "sudo previous-line".Try it yourself:
$ true
$ echo !!
echo true
true
[up-arrow to see]
$ echo true[deleted]
Couple of little nits - 5. and 8. are not bash specific and neither are event designators, these work fine in tcsh and zsh. I think caret substitution might have actually come from the *csh world. Not that big of a deal since bash is so prevalent these days but hey, a pedantipoint is a pedantipoint.
Good points, I like being corrected where appropriate.
I'm always finding new places to use brace expansion. Recently I've starting doing
diff longpath_andor_longfilename{a,b}*On #10. Capture video of a linux desktop you suggest removing -r and using -b 250kbit/s. Did you try that? ;)
Is there a way to use a better codec?
Is there a way to use a better codec?
Didn't try it. It actually turns out you need -r. Seems like an exception. I updated the article to reflect that. :)
The output codec? Use `-vcodec <format>`, where <format> is a video coded output by `ffmpeg -formats`.
Update: The whole comment about kbit/s was actually unnecessary, so I edited the article and replaced it with a better comment.
The output codec? Use `-vcodec <format>`, where <format> is a video coded output by `ffmpeg -formats`.
Update: The whole comment about kbit/s was actually unnecessary, so I edited the article and replaced it with a better comment.
I should have mentioned the message in my comment, sorry about the wittyness. Thanks for updating!
My favorite is the modifier for histories.
$ ls a b c
a b c
$ ls !$
ls c
c
$ ls a b c
a b c
$ ls !:3 !:2 !:1 !:0
ls c b a ls
ls: ls: No such file or directory
a b c
$
$ ls a b c
a b c
$ ls !$
ls c
c
$ ls a b c
a b c
$ ls !:3 !:2 !:1 !:0
ls c b a ls
ls: ls: No such file or directory
a b c
$
Very helpful, thanks. To my tech. note list it goes!
neat. thanks for the explanations!
$ !whatever:p