Working with ’screen‘

Working with ’screen‘ lets you run multiple „virtual“ windows in Unix. This becomes very interesting on working with a shell and want to quit the shell connection without killing a running shell command (the command already has to be started in a screen).

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

Create a new named screen session
~$: screen -S [screenname]

Reopen a named screen session, if not available, create it
~$: screen -R [screenname]

Reopen a named screen session
~$: screen -r [screenname]

Reopen a named screen session which is already attached wlsewhere
~$: screen -rx [screenname]

Detach a named screen session
~$: screen -d [screenname]

Kill a named screen session remote
~$: screen -X -S [screenname]

Shortcuts within a session:
Ctrl+a c: Open/Create a new window within a screen session
Ctrl+a a: Switch to the last screen window
Ctrl+a d: Detach the screen session [1]
Ctrl+a k: Kill the screen session [2]
Ctrl+a ESC: Scroll screen up/down with the arrow keys (ESC to quit scroll mode)
Ctrl+a „: Get a window overview of the screen session
Ctrl+a 0-9: Switch to window 0-9 of the screen session

1: Detaching a screen will leave the screen (and all its windows) but let it run in the background
2: Killing a session will leave the screen (and all its windows) and close it.

Compare a set of database table data on different servers

How may you validate, that data on different databases equal each other?
Execute the following (mysql) query on each database. You will get an MD5 string which is easily to be compared.

SELECT MD5( SUM( ch ) )
FROM (
SELECT crc32( MD5( CONCAT_WS( ',',
field1, field2, field3
) ) ) AS ch
FROM tablename
WHERE field0 = 3
)a

PS: Insert into the field list only fields which should be compared.
E.g. Do not include auto increment or timestamp/date columns if they are allowed to be different on each database!