Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>When running commands, sometimes I'll want to run a command with the previous ones arguments. To do that, you can use this shortcut:</p> <pre><code>$ mkdir /tmp/new $ cd !!:* </code></pre> <p>Occasionally, in lieu of using find, I'll break-out a one-line loop if I need to run a bunch of commands on a list of files. </p> <pre><code>for file in *.wav; do lame "$file" "$(basename "$file" .wav).mp3" ; done; </code></pre> <p>Configuring the command-line history options in my .bash_login (or .bashrc) is really useful. The following is a cadre of settings that I use on my Macbook Pro. </p> <p>Setting the following makes bash erase duplicate commands in your history:</p> <pre><code>export HISTCONTROL="erasedups:ignoreboth" </code></pre> <p>I also jack my history size up pretty high too. Why not? It doesn't seem to slow anything down on today's microprocessors.</p> <pre><code>export HISTFILESIZE=500000 export HISTSIZE=100000 </code></pre> <p>Another thing that I do is ignore some commands from my history. No need to remember the exit command. </p> <pre><code>export HISTIGNORE="&amp;:[ ]*:exit" </code></pre> <p>You definitely want to set histappend. Otherwise, bash overwrites your history when you exit.</p> <pre><code>shopt -s histappend </code></pre> <p>Another option that I use is cmdhist. This lets you save multi-line commands to the history as one command.</p> <pre><code>shopt -s cmdhist </code></pre> <p>Finally, on Mac OS X (if you're not using vi mode), you'll want to reset &lt;CTRL&gt;-S from being scroll stop. This prevents bash from being able to interpret it as forward search. </p> <pre><code>stty stop "" </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload