2023年11月15日 星期三

bash history with time

 Add

export HISTTIMEFORMAT='%F %T '

in .bashrc

2023年2月6日 星期一

Ubuntu 22.04 Change Mysql root with password without sudo


sudo mysql -u root

> use mysql;

> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '***';

// *** is your password

> FLUSH PRIVILEGES;


2021年10月12日 星期二

subversion svn doesn't save password

 Newer version default can't save password in plain text

Just add the following paragraph into the specific user file (a unique code) in ~/.subversion/auth/svn.simple/


K 8

passtype

V 6

simple

K 8

password

V 20

NotTheActualPassword

(Change 20 to the length of your password)

2021年4月3日 星期六

Get meaningful or WYSIWYG usage by du

 If you just use the following command, you get "disk usage" not "the actual file or folder size".

# du -h --max-depth=1

So add --apparent-size arguments

# du -h --apparent-size --max-depth=1

2020年5月26日 星期二

SSH AWS EC2 by your account with keypair without specify pem file

Assume you have the keypair file generated by AWS console

In your local machine and your account
> cat ~/.ssh/id_rsa.pub
# Copy the output

> ssh -i /path_to_key_pair/my-key-pair.pem ubuntu@your-ec2-ip-or-domain

In AWS EC2
ubuntu> sudo su your-account
# If you still don't have user account, create one by this instruction
# https://aws.amazon.com/premiumsupport/knowledge-center/new-user-accounts-linux-instance/

your-account>echo [The id_rsa.pub content you just copy] >> ~/.ssh/authorized_keys
your-account>exit
ubuntu>exit

In your local machine, connect to ec2 by
>ssh your-account@your-ec2-ip-or-domain

Voila