村里長 23歲
立委 23歲
縣市議員 23歲
鄉民代表 23歲
鄉長 26歲
直轄市/縣市長 30
總統 40
2018年11月14日 星期三
linux netcat
參考
https://blog.gtwang.org/linux/linux-utility-netcat-examples/
檔案接收者
nc -l 5000 > branch-rtl819x-sdk-v3.4.11.tar
nc 172.21.69.1 5000 < branch-rtl819x-sdk-v3.4.11.tar
nc -l 50000 > my_svn_new_checkout.sh
nc 172.21.69.4 5000 < my_svn_new_checkout.sh
在兩台主機之間複製檔案
假設現在有兩台主機,分別為 A 主機與 B 主機,若要將一個檔案從 A 主機複製到 B 主機,可以先在 B 主機(檔案接收者)上執行:
nc -l 5000 > my.jpg
然後在 A 主機(檔案傳送者)上執行:
nc hostB.com 5000 < my.jpg
這樣就可以把 my.jpg 這個檔案從 A 主機複製到 B 主機上了。 雖然這個方式跟 scp 指令比起來可能不是最方便的,但是它的特點是不需要登入的動作(也就是說不需要任何帳號與密碼),假設你碰到兩台主機無法互相登入的時候,就可以使用這樣的方式處理。
接收端
ubuntu 18.04
nc -l 50000 > my_svn_new_checkout.sh
傳送端
debian 9.6
nc 172.21.69.4 50000 -q 1 < my_svn_new_checkout.sh
傳送端
ubuntu 18.04
nc 172.21.15.145 50000 -q 1 < my_svn_new_checkout.sh
-N shutdown(2) the network socket after EOF on the input. Some servers
require this to finish their work.
centos 7 防火牆 注意
sudo firewall-cmd --zone=public --add-port=50000-55500/tcp --permanent
sudo firewall-cmd --reload
sudo firewall-cmd --zone=public --list-ports
19999/tcp 5001/tcp 5201/tcp 50000-55500/tcp
centos firewall reference
https://unix.stackexchange.com/questions/409878/centos-7-open-a-port
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-firewalld-on-centos-7
https://mangolassi.it/topic/8380/centos-7-open-firewall-ports-range-on-firewalld
https://www.thegeekdiary.com/how-to-test-port-connectivity-using-nc-utility-in-centos-rhel/
netcat 參考
https://www.linuxtechi.com/nc-ncat-command-examples-linux-systems/
https://www.arthurtoday.com/2015/10/ubuntu-replace-telnet-with-nc-command.html
https://www.tecmint.com/check-remote-port-in-linux/
https://ithelp.ithome.com.tw/articles/10136033
firewall and netcat
https://fabianlee.org/2016/09/26/ubuntu-pre-validate-network-acl-and-firewall-connectivity-with-netcat/
https://itekblog.com/test-firewall-with-netcat/
https://www.digitalocean.com/community/tutorials/how-to-use-netcat-to-establish-and-test-tcp-and-udp-connections-on-a-vps
debian firewall
https://wiki.debian.org/DebianFirewall
netcat for window 下載
https://eternallybored.org/misc/netcat/
https://blog.gtwang.org/linux/linux-utility-netcat-examples/
檔案接收者
nc -l 5000 > branch-rtl819x-sdk-v3.4.11.tar
nc 172.21.69.1 5000 < branch-rtl819x-sdk-v3.4.11.tar
nc -l 50000 > my_svn_new_checkout.sh
nc 172.21.69.4 5000 < my_svn_new_checkout.sh
在兩台主機之間複製檔案
假設現在有兩台主機,分別為 A 主機與 B 主機,若要將一個檔案從 A 主機複製到 B 主機,可以先在 B 主機(檔案接收者)上執行:
nc -l 5000 > my.jpg
然後在 A 主機(檔案傳送者)上執行:
nc hostB.com 5000 < my.jpg
這樣就可以把 my.jpg 這個檔案從 A 主機複製到 B 主機上了。 雖然這個方式跟 scp 指令比起來可能不是最方便的,但是它的特點是不需要登入的動作(也就是說不需要任何帳號與密碼),假設你碰到兩台主機無法互相登入的時候,就可以使用這樣的方式處理。
接收端
ubuntu 18.04
nc -l 50000 > my_svn_new_checkout.sh
傳送端
debian 9.6
nc 172.21.69.4 50000 -q 1 < my_svn_new_checkout.sh
傳送端
ubuntu 18.04
nc 172.21.15.145 50000 -q 1 < my_svn_new_checkout.sh
-N shutdown(2) the network socket after EOF on the input. Some servers
require this to finish their work.
centos 7 防火牆 注意
sudo firewall-cmd --zone=public --add-port=50000-55500/tcp --permanent
sudo firewall-cmd --reload
sudo firewall-cmd --zone=public --list-ports
19999/tcp 5001/tcp 5201/tcp 50000-55500/tcp
centos firewall reference
https://unix.stackexchange.com/questions/409878/centos-7-open-a-port
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-firewalld-on-centos-7
https://mangolassi.it/topic/8380/centos-7-open-firewall-ports-range-on-firewalld
https://www.thegeekdiary.com/how-to-test-port-connectivity-using-nc-utility-in-centos-rhel/
netcat 參考
https://www.linuxtechi.com/nc-ncat-command-examples-linux-systems/
https://www.arthurtoday.com/2015/10/ubuntu-replace-telnet-with-nc-command.html
https://www.tecmint.com/check-remote-port-in-linux/
https://ithelp.ithome.com.tw/articles/10136033
firewall and netcat
https://fabianlee.org/2016/09/26/ubuntu-pre-validate-network-acl-and-firewall-connectivity-with-netcat/
https://itekblog.com/test-firewall-with-netcat/
https://www.digitalocean.com/community/tutorials/how-to-use-netcat-to-establish-and-test-tcp-and-udp-connections-on-a-vps
debian firewall
https://wiki.debian.org/DebianFirewall
netcat for window 下載
https://eternallybored.org/misc/netcat/
linux 系統監控工具
glances (python)
htop
top
nmon
iostat
glances
https://www.maketecheasier.com/glances-monitor-system-ubuntu/
hegemon
https://www.tecmint.com/install-rust-programming-language-in-linux/
https://www.tecmint.com/hegemon-system-monitoring-tool-for-linux/
https://opensource.com/life/16/2/open-source-tools-system-monitoring
top
atop
htop
glances
netdata
monitorix
collectd
lshw
lscpu
lspci
lsusb
sudo dmidecode
harddisk
sudo smartctl -a /dev/sda
blkid
破壞性寫入測試
badblocks -wsv /dev/xxxdisk
fdisk/gdisk/parted
nload is a console application which monitors network traffic and bandwidth
hddtemp - Utility to monitor hard drive temperature
dmidecode is a tool for dumping a computer's DMI (some say SMBIOS ) table contents in a human-readable format.
lm_sensors (Linux monitoring sensors) is a free and open-source application that provides tools and drivers for monitoring temperatures, voltage, and fans.
smartmontools smartctl - Control and Monitor Utility for SMART Disks
smartctl controls the Self-Monitoring, Analysis and Reporting Technology (SMART) system built into many ATA-3 and later ATA, IDE and SCSI-3 hard drives.
nullmailer is an relay-only forwarding MTA (Mail Transfer Agent).
ranger - visual file manager
GNU Midnight Commander is a visual file manager,
netcat is a simple unix utility which reads and writes data across network connections, using TCP or UDP protocol.
htop
top
nmon
iostat
glances
https://www.maketecheasier.com/glances-monitor-system-ubuntu/
hegemon
https://www.tecmint.com/install-rust-programming-language-in-linux/
https://www.tecmint.com/hegemon-system-monitoring-tool-for-linux/
https://opensource.com/life/16/2/open-source-tools-system-monitoring
top
atop
htop
glances
netdata
monitorix
collectd
lshw
lscpu
lspci
lsusb
sudo dmidecode
harddisk
sudo smartctl -a /dev/sda
blkid
破壞性寫入測試
badblocks -wsv /dev/xxxdisk
fdisk/gdisk/parted
nload is a console application which monitors network traffic and bandwidth
hddtemp - Utility to monitor hard drive temperature
dmidecode is a tool for dumping a computer's DMI (some say SMBIOS ) table contents in a human-readable format.
lm_sensors (Linux monitoring sensors) is a free and open-source application that provides tools and drivers for monitoring temperatures, voltage, and fans.
smartmontools smartctl - Control and Monitor Utility for SMART Disks
smartctl controls the Self-Monitoring, Analysis and Reporting Technology (SMART) system built into many ATA-3 and later ATA, IDE and SCSI-3 hard drives.
nullmailer is an relay-only forwarding MTA (Mail Transfer Agent).
ranger - visual file manager
GNU Midnight Commander is a visual file manager,
netcat is a simple unix utility which reads and writes data across network connections, using TCP or UDP protocol.
2018年11月7日 星期三
lzma linux image tool
./lzma e vmlinux_img vmlinux_img.gz
LZMA 4.06 Copyright (c) 1999-2004 Igor Pavlov 2004-09-05
Usage: LZMA <e|d> inputFile outputFile [<switches>...]
e: encode file
d: decode file
b: Benchmark
<Switches>
-a{N}: set compression mode - [0, 2], default: 2 (max)
-d{N}: set dictionary - [0,28], default: 23 (8MB)
-fb{N}: set number of fast bytes - [5, 255], default: 128
-lc{N}: set number of literal context bits - [0, 8], default: 3
-lp{N}: set number of literal pos bits - [0, 4], default: 0
-pb{N}: set number of pos bits - [0, 4], default: 2
-mf{MF_ID}: set Match Finder: [bt2, bt3, bt4, bt4b, pat2r, pat2,
pat2h, pat3h, pat4h, hc3, hc4], default: bt4
-eos: write End Of Stream marker
-si: Read data from stdin
-so: Write data to stdout
LZMA 4.06 Copyright (c) 1999-2004 Igor Pavlov 2004-09-05
Usage: LZMA <e|d> inputFile outputFile [<switches>...]
e: encode file
d: decode file
b: Benchmark
<Switches>
-a{N}: set compression mode - [0, 2], default: 2 (max)
-d{N}: set dictionary - [0,28], default: 23 (8MB)
-fb{N}: set number of fast bytes - [5, 255], default: 128
-lc{N}: set number of literal context bits - [0, 8], default: 3
-lp{N}: set number of literal pos bits - [0, 4], default: 0
-pb{N}: set number of pos bits - [0, 4], default: 2
-mf{MF_ID}: set Match Finder: [bt2, bt3, bt4, bt4b, pat2r, pat2,
pat2h, pat3h, pat4h, hc3, hc4], default: bt4
-eos: write End Of Stream marker
-si: Read data from stdin
-so: Write data to stdout
ts moreutils time stamp log
make clean;make 2>&1 | tee >(ts "%H_%M_%S" > spendinglogs6.log)
https://unix.stackexchange.com/questions/26728/prepending-a-timestamp-to-each-line-of-output-from-a-command
I wish to prepend a timestamp to each line of output from a command. For example:
foo
bar
baz
would become
[2011-12-13 12:20:38] foo
[2011-12-13 12:21:32] bar
[2011-12-13 12:22:20] baz
https://stackoverflow.com/questions/39239379/add-timestamp-to-teed-output-but-not-original-output
Check out ts
from the moreutils package.
If you're using bash
, you can tee
to a shell pipe as a file:
https://unix.stackexchange.com/questions/272433/piping-into-moreutils-ts-with-nanosecond-precision
https://manpages.debian.org/testing/moreutils/ts.1.en.html
https://rentes.github.io/unix/utilities/2015/07/27/moreutils-package/
https://joeyh.name/code/moreutils/
2018年11月1日 星期四
linux連到ssh server想要中斷連線
~.
We can use tilde-period (~.) to close an unresponsive session.
https://pleiades.ucsc.edu/hyades/SSH_Escape_Sequences
When a pseudo-terminal has been requested by the OpenSSH SSH client, ssh supports a number of functions through the use of an escape character. The escape character must always follow a newline to be interpreted as special. The default escape character is ~(tilde); but it can be can be changed in configuration files using the EscapeChar configuration directive or on the command line by the -e option.
~?
Supported escape sequences:
~. - terminate connection (and any multiplexed sessions)
~B - send a BREAK to the remote system
~C - open a command line
~R - request rekey
~V/v - decrease/increase verbosity (LogLevel)
~^Z - suspend ssh
~# - list forwarded connections
~& - background ssh (when waiting for connections to terminate)
~? - this message
~~ - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)
We can use tilde-period (~.) to close an unresponsive session.
https://pleiades.ucsc.edu/hyades/SSH_Escape_Sequences
When a pseudo-terminal has been requested by the OpenSSH SSH client, ssh supports a number of functions through the use of an escape character. The escape character must always follow a newline to be interpreted as special. The default escape character is ~(tilde); but it can be can be changed in configuration files using the EscapeChar configuration directive or on the command line by the -e option.
~?
Supported escape sequences:
~. - terminate connection (and any multiplexed sessions)
~B - send a BREAK to the remote system
~C - open a command line
~R - request rekey
~V/v - decrease/increase verbosity (LogLevel)
~^Z - suspend ssh
~# - list forwarded connections
~& - background ssh (when waiting for connections to terminate)
~? - this message
~~ - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)
訂閱:
文章 (Atom)