Things I can never remember

Here's a collection of snippet, shortcuts and one liners that I can never seem to remember. 

Execl

hide and unhide on mac

hide column; command + 0
unhide column; command + shift + 0 

hide row; command + 9
unhide row; command + shift + 9

protip; quickly collapse everything then undo it.  Just hold comand and press 9 and 0.. everything will disappear, now hold shift and do the same.  Everything will be shown and expanded. 

Terminal

The format of scp is take this and put it there (remote or local)

scp john@example.com:/path/to/file.txt ~/mynewfile.txt
scp /path/to/localfile.txt john@example.com:/put/it/here.txt

Redirect standard out and standard error like so... A little bash script that's useful as well.

while [ 1 ]
do
    echo aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa >> jmout.txt
    curl -v https://www.google.com/recaptcha/api/siteverify 2>&1 | tee -a jmout.txt
    sleep 5
done

List the ports in use on a mac

sudo lsof -i -n -P  | grep 8080

Moving around the command prompt

ctrl-a: jumps to start of a line
crtl-e: jumps to the end of a line
ctrl-u: erases the entire line

Find recently modified files.  Useful for seeing what changed after you run something.

find . -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort | tail -n 30

A simple for each from the command line

for i in `cat /data01/home/jminchuk/asdf.txt`; do vi $i.xml; done;

But this is often more reliable to do with awk because it handels spaces in names better.  This example prints the contents of each jar in a directory.

ls * | awk '' | sh

Search pom.xml files for a string

find . -path "*/target/*" -prune -o -name 'pom.xml' -print | awk '' | sh

Vim Search and Replace

replace old with new 
:%s/old/new/g 

replace from line # to line # 
%#,#s/old/new/g 

count occurrences of a comma 
:64,70s/,/,/g

Sqlplus Connection Format.  The schema (collection of tables) you will be writing to is usually the same as the username.

USERNAME/PASSWERD@db01.example.com:1521/ORCL