Categories
System/Linux/Unix*

[memo] 用 shell awk 加總 column

ls -l `find /mnt/tslog/archive/ -name "*20190[1..6]*" -type f` | awk '{sum += $5} END {print sum}'
160038650315

ls -l `find /mnt/tslog_bak -name "*20190[1..6]*" -type f` | awk '{sum += $5} END {print sum}'
160038650315

ls -l `find /mnt/tslog_backup2 -name "*20190[1..6]*" -type f` | awk '{sum += $5} END {print sum}'
160038650315

Categories
System/Linux/Unix*

[memo] 常用 ubuntu 升級套件指令 / ubuntu upgrade commands

# 更新
apt update

# 列出可 upgrade 的 package
apt list –upgradable

# 只 upgrade 這些 packages
apt –only-upgrade install XXXXX

Categories
System/Linux/Unix*

[memo] Ubuntu : ctrl-L not work , 按 ctrl-L 不會清除螢幕 , TERM , .bashrc .profile 問題 , Ubuntu 8.04.4 LTS

這個版本的 .bashrc 不 work , 要用 .profile
lsb_release  -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 8.04.4 LTS
Release: 8.04
Codename: hardy
—-
$ cat .profile
export EDITOR=vi
export PATH=/sbin:$PATH
export LANG=
export TERM=xterm
export http_proxy=
export https_proxy=
Categories
System/Linux/Unix*

Use dd command to backup whole disk to image file , acer desktop , win7

Acer ASPIRE M1930 partition layout

Same PC but install windows7

 


-- OK! 在 virtualbox 測試
dd if=/dev/sda | pv | ssh -p 2200 rimmon@london.monster.tw 'cat > winxp2.dd.img'
ssh -p 2200 rimmon@london.monster.tw 'cat winxp2.dd.img' | pv | dd of=/dev/sda

-- OK! 把 Acer PC 整個硬碟備份到遠端 server 的 image file
dd if=/dev/sda | pv | ssh -p 2200 rimmon@london.monster.tw 'cat > /mnt/m1/acer-pc-win7.dd.img'

-- OK!把 Acer PC 改裝 windows7 後, 備份到遠端 server
-- 用 pv 看進度 , pipe 給 gzip 壓縮後再透過 ssh 傳到遠端 server ,
dd if=/dev/sda | pv | gzip | ssh -p 2200 rimmon@london.monster.tw 'cat > /mnt/m1/desktop-win7.dd.img.gz'

976773168+0 records in
976773168+0 records out
500107862016 bytes (500 GB, 466 GiB) copied, 12321.3 s, 40.6 MB/s

94G     desktop-win7.dd.img.gz


Categories
System/Linux/Unix*

[note] Ubuntu 18.04 IP address setup , resolv

 

Categories
Network service System/Linux/Unix*

ssh backup command

tar zcvf – KeepTheseFiles | ssh user@desthost ‘cat > KeepTheseFiles.tgz’

Categories
hardware Iot Service System/Linux/Unix*

教學: 在 Ubuntu 使用 DS18B20 溫度感測器把溫度上傳到 ThingSpeak 附範例程式 / IoT 可參考

Office temperature

Categories
System/Linux/Unix*

[memo] ssh tunnels

ssh -D 12345 -o TCPKeepAlive=yes -o ServerAliveInterval=10 -p 2200 rimmon@safe.monster.tw

ssh -D 12345 -o TCPKeepAlive=yes -o ServerAliveInterval=10 rimmon@safe.monster.tw

ssh -L 33389:192.168.100.2:3389 -o TCPKeepAlive=yes -o ServerAliveInterval=10 -p 2200 rimmon@safe.monster.tw

 

# —–
ssh -L 8000:192.168.1.1:80 -o TCPKeepAlive=yes -o ServerAliveInterval=10 -p 2200 rimmon@desktop.monster.tw
說明: 在本機端(port 8000) 建立一個與 desktop.monster.tw 的 ssh (port 2200) 通道, 由 desktop.monster.tw 連向 192.168.1.1 的 port 80
所以只要用 browser 連到本機 http://127.0.0.1:8000 即可連入 192.168.1.1:80

URL: OSX ssh tunnel

Categories
System/Linux/Unix*

Protected: [note] Install php7 oci8 on Ubuntu steps

This content is password protected. To view it please enter your password below:

Categories
System/Linux/Unix*

ubuntu : add-apt-repository

sudo apt-get install software-properties-common