Tag Archives: Linux

Using sshj connect to ec2 instance.

  • hostKey = “xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx”
  • hostDns = “ec2-xx-xxx-xx-xx.ap-northeast-1.compute.amazonaws.com”
  • publicKey = “file.pem”
  • USER_NAME = “ec2-user”

Connect to server

Execute command

Get file from server


Import and export using command line.


  • Export to gzip
  • Import
  • Export table to csv
  • Export from console of EC2

Regex Explanation:

  • s/// means substitute what’s between the first // with what’s between the second //
  • the “g” at the end is a modifier that means “all instance, not just first”
  • ^ (in this context) means beginning of line
  • $ (in this context) means end of line

So, putting it all together:

II. PostgreSQL

  • Import

  • Export database

  • Export schema

  • Get size of all table in database of refshift


Get log of tomcat and ec2 server.


How to change TimeZone in Java and Linux.

A. Set TimeZone by Programming (Java)

// or pass in a command line arg: -Duser.timezone=”Japan”
B. Set TimeZone by Command Line (Linux)

C. Set TimeZone by Environment (for login user)
# for all processes run in current shell in file .bash_profile

# for all applications using JVM