Missing trick: In bash, "ESC" then "." fetches the last parameter of the previous command. It's invaluable (same as typing "!$" but you get to see and edit it)
Unix Tricks
81–90 of 166 posts
Re: Unix Tricks
#82Ctrl-R is by far the most useful one for me.
"\e[A":history-search-backward
"\e[B":history-search-forward
Type a few characters and hitting the arrow keys will show only commands that match those first few characters.Re: Unix Tricks
#83Missing trick: In bash, "ESC" then "." fetches the last parameter of the previous command. It's invaluable (same as typing "!$" but you get to see and edit it)
Re: Unix Tricks
#84Earlier quoted context omitted.
What I love about this is that if you up-arrow through your past commands, the "sudo !!" shows up as "sudo apt-get update"
Bash substitutions are done prior to execution so your history stays intact. Older open source projects are just amazing for how complete their feature set is.
Re: Unix Tricks
#85Missing trick: In bash, "ESC" then "." fetches the last parameter of the previous command. It's invaluable (same as typing "!$" but you get to see and edit it)
shopt -s histverify histreeditRe: Unix Tricks
#86Another one: Use dcfldd instead of dd if you want to see how far your dd operation is progressing... dcfldd if=[infile] of=[outfile] sizeprobe=if So. Much. Better. dcfldd also has many other useful options - read the man pages - and note that you'll have to install it from your linux distro's package repo beforehand.
You can also send SIGUSR1 to dd for progress info. From the manpage: Sending a USR1 signal to a running 'dd' process makes it print I/O statistics to standard error and then resume copying. $ dd if=/dev/zero of=/dev/null& pid=$! $ kill -USR1 $pid; sleep 1; kill $pid 18335302+0 records in 18335302+0 records out 9387674624 bytes (9.4 GB) copied, 34.6279 seconds, 271 MB/s
But I prefer not to have to manually keep sending that ;)
Re: Unix Tricks
#87You know what I hate? My history isn't aggregated in real time across all my Mac OS X terminal windows. You know what else I hate? Typing in long commands in the Mac OS X terminal and then them wrapping weirdly. Especially when I hit the up arrow to go back in my terminal history.
Here you go, just throw it in your .bashrc: shopt -s histappend export HISTSIZE=100000 export HISTFILESIZE=100000 export HISTCONTROL=ignoredups:erasedups export PROMPT_COMMAND="history -a;history -c;history -r;$PROMPT_COMMAND" I wish I could give credit to where I originally found this but it was ages ago.
It looks like it clears your shell's history, and then re-populates it from the .bash_history file?
Re: Unix Tricks
#88Earlier quoted context omitted.
Bash substitutions are done prior to execution so your history stays intact. Older open source projects are just amazing for how complete their feature set is.
is this how people feel about religious texts?
>Religious texts don't change over time due to community suggested changes.
Then I caught myself.
Re: Unix Tricks
#89Earlier quoted context omitted.
Bash substitutions are done prior to execution so your history stays intact. Older open source projects are just amazing for how complete their feature set is.
is this how people feel about religious texts?
Re: Unix Tricks
#90https://github.com/ziyaddin/jean
It would be nice to get all of these .bash_profile enhancements in as packages.
I suppose it could be improved to prompt for a brew/apt install if needed.