handy commands for development


Watch something to happen                                  :: $ watch -d -n 0.1 "ls"
Find all handle of App                                     :: $ lsof -p <pid>
Find files opened by App                                   :: $ lsof -f -p <pid> 
Find which App is using specified socket port 8080         :: $ lsof -i :8080
Monitor file changes                                       :: $ lsof -f -p <pid>
Grep except something                                      :: $ grep -v string_to_except <fileName>
Monitor CPU balance                                        :: $ cat /proc/interrupts
Monitor system performance                                 :: $ nmon
Using python to start a HTTP Server to share files         :: $ python -m SimpleHTTPServer
call command with ! followed by first letter of recent cmd :: $ !<first-letter-of-recent-cmd>
pushd and popd to navigation in dir                        :: $ pushd <target-dir>
- console::
  Ctrl + u            Erase the current line.
  Ctrl + k            Delete the line from the position of the cursor to the end of the line.
  Ctrl + w            Delete the word before the cursor.
  Ctrl + r            incremental search previously called commands, continue type Ctrl+ r to search next
  Ctrl + a            Move to line beginning
  Ctrl + e            Move to line end
  Ctrl + d            Delete char under cursor
  Ctrl + _            Undo
  ESC b               Move backward one word
  ESC f               Move forward one word
  ESC d               Delete word right
  ESC backspace       Delete word left

let mysql log the queries:: 
mysql -uroot -pYOUR-PASSWORD -e "SET GLOBAL log_output = 'FILE'; Set GLOBAL general_log_file = '/tmp/mysql.log'; SET GLOBAL general_log = 'ON';"

mac os::
- To move files in Finder first press Command+C to copy the selected files, then press Command+Option+V to move the copied files to the current folder.
- ctrl+F2 to focus on menu bar
- command+shift+/ activate Help and search menu items with name
- pbcopy
- pbpaste
- Quicksilver open directory in iTerm
- cmd+D split iTerm window