Monday, June 26, 2017

เปิด Vim หลายหน้าจอ

#vim -p file01.txt file02.conf

สลับแต่ละหน้าด้วย :bn (next page), :bp (previous page)

Ref: open-multiple-files-using-single-vim-editor-command-linux

Tuesday, June 13, 2017

check mainboad,VGA,Network (LAN) Vmware, Linux

Check mainboad:
smbiosDump | egrep '(Product|Serial:)'

yum install dmidecode
dmidecode -t system
dmidecode -t 1|grep -E '(Product Name|Manufacturer)'


Check VGA:
lspci
lspci | grep Display

Check Network (LAN):
esxcli network ip interface list
esxcli network ip interface ipv4 get
esxcfg-nics -l

Network: https://www.tunnelsup.com/networking-commands-for-the-vmware-esxi-host-command-line/

Mainboad/VGA: https://serverfault.com/questions/313843/how-to-find-out-more-hardware-details-using-only-esxi4-1-and-possibly-shell

Check Network (LAN) on Centos:
lspci | egrep -i --color 'network|ethernet'
lshw -class network

*-network
       description: Ethernet interface
       product: RTL8169 PCI Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:07:00.0
       logical name: enp7s0
       version: 10
       serial: cc:5d:4e:38:94:60
       size: 100Mbit/s
       capacity: 1Gbit/s
       width: 32 bits
       clock: 66MHz
       capabilities: pm bus_master cap_list rom ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full ip=172.16.0.134 latency=64 link=yes maxlatency=64 mingnt=32 multicast=yes port=MII speed=100Mbit/s
       resources: irq:19 ioport:c000(size=256) memory:fe420000-fe4200ff memory:fe400000-fe41ffff



Thursday, June 8, 2017

Create shutdown button on left menu on ubuntu

1. vim ~/.local/share/applications/shutdown.desktop
2. Insert text

[Desktop Entry]
 Categories=Application;System;
 Comment=To shutdown the computer
 Encoding=UTF-8
 Exec=gnome-session-quit --power-off
 Icon=system-shutdown
 Name=Shutdown-Button
 NoDisplay=false
 StartupNotify=false
 Terminal=false
 Type=Application

3. save
4. type shutdown and drage to menu




Wednesday, June 7, 2017

scan network, mac address

--------------Network----------------------------
iftop
sudo iftop -i wlp2s0
nmon
bmon -a
sudo iptraf
sudo jnettop
sudo nethogs
sudo nload -t 200 -i 1024 -o 128 -U M
nmcli c s
ip a
-----------------scan network-------------------
sudo apt install netdiscover nbtscan arp-scan
sudo netdiscover -r 10.10.254.0/24 -i wlp2s0
sudo nbtscan 172.16.106.1-172.16.106.255
sudo arp-scan -l
arp
arp -an

-----------------Check disk------------------------
fdisk -l
df -hT
lsblk -f
sudo iostat -tmx 5
-t =display time
-m =Mb
-x =extend disk I/O
5 = disply 5 second
sudo iotop
lsof  or   lsof |grep remmina

ref : iostat
Ref: list-all-mac-addresses-and-their-associated-ip-addresses-in-my-local-network-la

Sunday, June 4, 2017

How to protect samba from WannaCry (Sambacry)

1. Allow & Block Network

hosts deny = ALL
​hosts allow = 192.168.1.

2. Add buttom line
server min protocol = SMB2_10
​client max protocol = SMB3
​client min protocol = SMB2_10

sudo systemctl restart smbd

Ref:
http://www.techrepublic.com/article/how-to-protect-samba-from-the-likes-of-the-sambacry-exploit