$ ssh [email protected]
$ mkdir test
$ cd test
$ touch hello.txt
$ sudo apt-get install apache2
$ ssh-keygen
ssh-keygen -f ~/my-key -t ecdsa -b 521
-f is the file name and where to store
-t is algorithm you choose
-b byte, default 2048
> cat ~/.ssh/id_rsa.pub | ssh [email protected] "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys
ssh-copy-id -i ~/.ssh/my-key user@host
$ touch test.txt
$ scp ~/test.txt [email protected]:~
Create account->create droplet
$ ssh-keygen -t rsa
Add Key When Creating Droplet
$ ssh root@doserver
$ ssh-add ~/.ssh/id_rsa_do
(or whatever name you used)
$ ssh root@doserver
$ sudo apt update
$ sudo apt upgrade
$ adduser brad
$ id brad
$ usermod -aG sudo brad
$ id brad
> ssh brad@doserver
$ ssh root@doserver
$ cd /home/brad
$ mkdir .ssh
$ cd .ssh
$ touch authorized_keys
> sudo nano authorized_keys
(paste in the id_rsa_do.pub key, exit and log in as brad)
$ sudo nano /etc/ssh/sshd_config
PermitRootLogin no
PasswordAuthentication no
$ sudo systemctl reload sshd
$ sudo chown -R brad:brad /home/brad
$ chmod 700 /home/brad/.ssh
$ sudo apt install apache2 -y
$ ssh-keygen -t rsa
(id_rsa_github or whatever you want)
$ ssh-add /home/brad/.ssh/id_rsa_github
$ eval `ssh-agent -s`
$ git clone [email protected]:bradtraversy/react_otka_auth.git
$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
$ sudo apt-get install -y nodejs
$ npm install
$ npm start
$ npm run build
$ sudo mv -v /home/brad/react_otka_auth/build/* /var/www/html
sudo timedatectl set-timezone Asia/Ho_Chi_Minh
timedatectl list-timezones
df -x squashfs --total
df -BM
ps aux --sort:rss
Thong ke theo MB
ps aux --sort:rss | awk 'NR>1 {$6=int($6/1024)"M";}{ print;}'
Su dung top/htop
Sau do nhan Shift + M (M la Memory !!!)
iotop
vnstat -l -i <Network interface card>
show nics
netstat -i
nethogs
netstat -ant | grep -v LISTEN | awk '{print $5}' | cut -d":" -f1 | sort | uniq -c | sort -rn
Ket noi hien tai dang duoc thiet lap
netstat -ant | grep ESTABLISH | awk '{print $5}' | cut -d":" -f1 | sort | uniq -c | sort -rn | more
ss -p4n
– add this to file ~/.bashrc:
function mkdircd () { mkdir -p "$@" && eval cd ""$$#""; }
– Close terminal and reopen (or source ~/.bashrc), next time it will get:
$ mkdircd /tmp/test1/test2/test3/test4
curl -o /dev/null -s -w 'Establish Connection: %{time_connect}s\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n' https://www.google.com