Cheat is from http://cheat.sh and it is my favorit. Put this in your .bashrc or .zshrc file. function cs() { curl -m 7 "http://cheat.sh/$1"; } Exsamples: 3 $> cs perl/for # Which "for" loop to use in Perl? # # In your case, there's no difference. # # In other use cases, in a for-each loop you don't have control of / # access to the iterator. # # Editing to try and make this clearer: # # Using your example syntax: for my $i (0..10) { print "$i"; $i++; } # The above actually creates a foreach loop - it's the same as saying # foreach my $i (0..10). $i is a value returned from the list, not the # iterator. The iterator is internal and you have no access to it; you # can not control the flow of the loop. # # The output from above will print 012345678910 # # This: for ( my $i = 0; $i++ ; $i <= 10) { print $i; $i++; } # That is an actual for loop. You are controlling and outputting the # iterator. It will output: # 0246810 # # Edit: In addition: # # When you do for (1..$n) you are invoking the range operator # (http://perldoc.perl.org/perlop.htmlRange-Operators) vs. doing a # simple comparison at the top of the loop. Performance differences, # however, would be immeasurable. # # [Brian Roach] [so/q/5757345] [cc by-sa 3.0] ~ $> cs zsh/for # shell - ZSH for loop array variable issue # # It's actually much simpler than that: lw=('plugin1' 'plugin2' 'plugin3') for i in $lw; do . ~/Library/Rogall/plugins/$i/lw.prg end done # In summary: # # * Assign to "foo", not "$foo" (the shell would try to expand $foo # and assign to whatever it expands to; typically not useful) # * Use the loop variable directly; it contains the array value # rather than the index # # [Jan Kr&252;ger] [so/q/10887560] [cc by-sa 3.0] $> cs grep cheat:grep # To search a file for a pattern: grep # To perform a case-insensitive search (with line numbers): grep -in # To recursively grep for string in : grep -R # Read search patterns from a file (one per line): grep -f # Find lines NOT containing pattern: grep -v # To grep with regular expressions: grep "^00" # Match lines starting with 00 grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" # Find IP add # To find all files that match in grep -rnw -e # To exclude grep from your grepped output of ps: # (Add [] to the first letter. Ex: sshd -> [s]shd) ps aux | grep '[h]ttpd' # Colour in red {bash} and keep all other lines ps aux | grep -E --color 'bash|$'