Fetch the value of a key from memcache server with telnet

In case you want to fetch the value of a key stored in a memcache you could connect to the memcache server via telnet and query the server for the key:

Connect to the memcache server via telnet:
:$ telnet memcache-server-host 11211

Query for stats slabs and use the slab number t query with cachedump:

stats slabs
STAT 25:chunk_size 21696
STAT 25:chunks_per_page 48
...
END

stats cachedump 25 0
ITEM GTLD_DATA [18459 b; 1520683204 s]
END

get GTLD_DATA
VALUE GTLD_DATA 1 18459
a:2:{...}
END

Read more:

How to fetch field(s) from MySQL query result in bash

In case you want to fetch/export the result of a mysql query into a text file, but you don´t have the option to use the OUTFILE command you can simple use the following bash command:

:~$ mysql -u USER -p PASSWORD -h HOST --silent --skip-column-names -e 'select field1, field2, field3 from table' > query-result.csv

Working with ‘tmux’

Working with ‚tmux‘ enables a number of terminals to be created, accessed, and controlled from a single screen in Unix. The screen can be splitted vertically and horizontally (called panes). Like ’screen‘ tmux can handle different sessions.

Get a list of running, named tmux sessions
~$: tmux ls

Create a new named tmux session
~$: tmux new-session -s [sessionname]

Reopen an existing tmux session
~$: tmux a -t [sessionname]

Shortcuts within a session:
Managing windows
Ctrl+b c: Open/Create a new window within a tmux session
Ctrl+b ,: Rename the current window
Ctrl+b n: Switch to next windows
Ctrl+b p: Switch to previous window
Ctrl+b w: List all windows
Ctrl+b 0-9: Switch to window 0-9 of the tmux session

Managing panes
Ctrl+b %: Split window vertically
Ctrl+b „: Split window horizontally
Ctrl+b arrow key: Switch pane
Hold Ctrl+b, don’t release it and hold one of the arrow keys: Resize pane
Ctrl+b [: Start copy mode. Simply quit with q. PgUp/PgDown lets you scroll up/down.
Ctrl+b q: Show pane numbers
Ctrl+b {: Move current pane left
Ctrl+b }: Move current pane right
Ctrl+b &ltspace>: Toggle through different pane layouts
Ctrl+b !: Break pane into its own window

Ctrl+b : setw synchronize-panes on/off: Synchronize commands to all panes

Managing Session
Ctrl+b $: Rename current session
Ctrl+b d: Detach current session
Ctrl+b &: Kill current session

Ctrl+b :: Open command prompt
Ctrl+b x: Exit terminal
Ctrl+b ?: Help

1: Detaching a session will leave it (and all its windows) but let it run in the background
2: Exit a pane/window will close it and it´s commands.

Download my .tmux.conf

External resources:
– http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/
– http://blog.hawkhost.com/2010/07/02/tmux-%E2%80%93-the-terminal-multiplexer-part-2/
– http://lukaszwrobel.pl/blog/tmux-tutorial-split-terminal-windows-easily/

Install Oracle (Sun) Java SDK on Ubuntu Linux

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer

# if installed parallel to OpenJDK
sudo update-java-alternatives -s java-6-oracle
# or
sudo apt-get install oracle-java6-set-default