This blog moved to medium->https://medium.com/@cocoamaemae
Regarding TIPS about IT technologies or OSS which I created.
Wednesday, November 2, 2016
How to clear cache on CentOS
clear page cache
sudo echo 1 > /proc/sys/vm/drop_caches
or
sudo sysctl -w vm.drop_caches=1
clear directory entry and inode
sudo echo 2 > /proc/sys/vm/drop_caches
or
sudo sysctl -w vm.drop_caches=2
clear page cache and directory entry and inode
sudo echo 3 > /proc/sys/vm/drop_caches
or
sudo sysctl -w vm.drop_caches=3
Monday, October 31, 2016
Linux short cut command cheat sheet
# Go back to the line head
Ctrl+a
# Go to the line end
Ctrl+e
# Remove till end-of-line
Ctrl+k
# Remove characters toward line head by each words
Ctrl+w
# Reset a terminal
Ctrl+l
Ctrl+a
# Go to the line end
Ctrl+e
# Remove till end-of-line
Ctrl+k
# Remove characters toward line head by each words
Ctrl+w
# Reset a terminal
Ctrl+l
Thursday, October 6, 2016
Regarding nmap
What's nmap
Basic syntax
One of the representative port scanners.
nmap <options> <a server IP address or host name>
Options
# Specify any port
-p
# TCP connection scan
# Check connection to the target. The target daemon process found that TCP connection was tried. If not specified any options, -sT is set as default.
-sT
# TCP syn scan
# Sending only first syn packet in 3 way handshake. If syn/ack is returned, determine that post is opened. If RST is returned, determine that there is no listener. Not establish connection, so the target does not found scan.
-sS
# TCP Null scan
-sN
# TCP fin scan
-sF
# TCP Xmas scan
-sX
# TCP ack scan
-sA
PORT STATE SERVICE 22/tcp open ssh
# STATE
means port state
open: a port is open
closed: a port is closed
filterd: a packet filter works for a port and it cannot be determined if a port is open or not
# filtered
Not determine whether port is open or not.
# unfiltered
Can access to post though, not determine whether post is open or not.
# open|filtered
Not determine whether post is open or not, and packet filtering is available or not.
# closed|filtered
Not determine whether post is closed or not, and packet filtering is available or not.
-p
# TCP connection scan
# Check connection to the target. The target daemon process found that TCP connection was tried. If not specified any options, -sT is set as default.
-sT
# TCP syn scan
# Sending only first syn packet in 3 way handshake. If syn/ack is returned, determine that post is opened. If RST is returned, determine that there is no listener. Not establish connection, so the target does not found scan.
-sS
# TCP Null scan
-sN
# TCP fin scan
-sF
# TCP Xmas scan
-sX
# TCP ack scan
-sA
Display meanings
nmap hoge.comPORT STATE SERVICE 22/tcp open ssh
# STATE
means port state
open: a port is open
closed: a port is closed
filterd: a packet filter works for a port and it cannot be determined if a port is open or not
# filtered
Not determine whether port is open or not.
# unfiltered
Can access to post though, not determine whether post is open or not.
# open|filtered
Not determine whether post is open or not, and packet filtering is available or not.
# closed|filtered
Not determine whether post is closed or not, and packet filtering is available or not.
Wednesday, September 14, 2016
User management on CentOS
Brief
Surmise about user management on CentOS
See the below regarding basic commands
https://gist.github.com/cocoa-maemae/fd29e2e91d0a75226b09b89e2a367231
# How to add user groups
On centos, add a file under /etc/sudoers.d
e.g.
sudo cat /etc/sudoers.d/hoge
%hoge ALL=(ALL) NOPASSWD: ALL
In this example, the left hoge is a group name.
FYI
If sudo visudo is executed, the following can be seen.
## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d
includedir is commented out, but this is an unique spec, files under /etc/sudoers.d are loaded automatically.
Surmise about user management on CentOS
See the below regarding basic commands
https://gist.github.com/cocoa-maemae/fd29e2e91d0a75226b09b89e2a367231
# How to add user groups
On centos, add a file under /etc/sudoers.d
e.g.
sudo cat /etc/sudoers.d/hoge
%hoge ALL=(ALL) NOPASSWD: ALL
In this example, the left hoge is a group name.
FYI
If sudo visudo is executed, the following can be seen.
## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d
includedir is commented out, but this is an unique spec, files under /etc/sudoers.d are loaded automatically.
Saturday, September 3, 2016
Hot install vim plug-ins by using dein
# After dein install is done, set dein to .vimrc.
Regarding dein install, refer the blow.
https://cocoamaemae-tec-diary.blogspot.jp/2018/01/how-to-install-dein-for-vim-plugin.html
OS: Linux(Debian, Ubuntu, RHEL, CentOS or etc)
# Add the blow sample to $HOME/.vimrc
dein configuration sample
# Please attach the blow to $HOME/.vimrc
" dein setting
if &compatible
set nocompatible
endif
set runtimepath+=~/.dein/repos/github.com/Shougo/dein.vim
call dein#begin('~/.vim')
" Write plug-ins you want to install
call dein#add('~/.dein/repos/github.com/Shougo')
call dein#add('tpope/vim-fugitive')
call dein#add('vim-scripts/vim-auto-save')
call dein#add('vim-scripts/grep.vim')
call dein#end()
" You can add more plug-ins
call dein#save_state()
filetype plugin indent on
syntax enable
" auto save
let g:auto_save = 1
# After .vimrc is set, execute dein install on vim command mode.
:call dein#install()
Regarding dein install, refer the blow.
https://cocoamaemae-tec-diary.blogspot.jp/2018/01/how-to-install-dein-for-vim-plugin.html
OS: Linux(Debian, Ubuntu, RHEL, CentOS or etc)
# Add the blow sample to $HOME/.vimrc
dein configuration sample
# Please attach the blow to $HOME/.vimrc
" dein setting
if &compatible
set nocompatible
endif
set runtimepath+=~/.dein/repos/github.com/Shougo/dein.vim
call dein#begin('~/.vim')
" Write plug-ins you want to install
call dein#add('~/.dein/repos/github.com/Shougo')
call dein#add('tpope/vim-fugitive')
call dein#add('vim-scripts/vim-auto-save')
call dein#add('vim-scripts/grep.vim')
call dein#end()
" You can add more plug-ins
call dein#save_state()
filetype plugin indent on
syntax enable
" auto save
let g:auto_save = 1
# After .vimrc is set, execute dein install on vim command mode.
:call dein#install()
Wednesday, August 24, 2016
How to confirm MySQL or MariaDB slave status
When you want to check MySQL or MariaDB slave status, run the below command
[linux ~]$ show slave status\G;
************ 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: ***
Master_User: ***
Master_Port: ****
Connect_Retry: 60
Master_Log_File: sm-bin.*****
Read_Master_Log_Pos: *****
Relay_Log_File: db104-relay-bin.****
Relay_Log_Pos: 287813229
Relay_Master_Log_File: sm-bin.****
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: ******
Relay_Log_Space: ******
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: ******
Master_SSL_Crl:
Master_SSL_Crlpath:
If you want to whether slave works well or not, check these status.
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Also, there is no error displayed on slave status, slave is no problem to work..
Regarding the meanings of respective parameters, refer the official documents
https://dev.mysql.com/doc/refman/5.7/en/show-slave-status.html
https://mariadb.com/kb/en/library/show-slave-status/
[linux ~]$ show slave status\G;
************ 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: ***
Master_User: ***
Master_Port: ****
Connect_Retry: 60
Master_Log_File: sm-bin.*****
Read_Master_Log_Pos: *****
Relay_Log_File: db104-relay-bin.****
Relay_Log_Pos: 287813229
Relay_Master_Log_File: sm-bin.****
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: ******
Relay_Log_Space: ******
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: ******
Master_SSL_Crl:
Master_SSL_Crlpath:
**************abbreviation**************
If you want to whether slave works well or not, check these status.
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Also, there is no error displayed on slave status, slave is no problem to work..
Regarding the meanings of respective parameters, refer the official documents
https://dev.mysql.com/doc/refman/5.7/en/show-slave-status.html
https://mariadb.com/kb/en/library/show-slave-status/
Tuesday, August 9, 2016
How to use ssh-keygen
Brief
Surmise about ssh-keygen
What is ssh-keygen?
create ssh key pairs, a secret key and a public key
Environment
CentOS
Basic Syntax
ssh-keygen <options>
e.g.
# create a secret key and a public key
# The keys are created in the folder of /root/.ssh/ at the default
ssh-keygen -t 'algorithm name' -m 'comment'
# create a public key from a secret key
ssh-keygen -yf ${private_key_file} > ${public_key_file}
Surmise about ssh-keygen
What is ssh-keygen?
create ssh key pairs, a secret key and a public key
Environment
CentOS
Basic Syntax
ssh-keygen <options>
e.g.
# create a secret key and a public key
# The keys are created in the folder of /root/.ssh/ at the default
ssh-keygen -t 'algorithm name' -m 'comment'
# create a public key from a secret key
ssh-keygen -yf ${private_key_file} > ${public_key_file}
Subscribe to:
Posts (Atom)
Front End Development Tools
TaskRunner Tool executing multiple tasks by only one execution. Tasks are like CSS preprocessor, Transpire, Module Bundler, etc... e.g. ...
-
TaskRunner Tool executing multiple tasks by only one execution. Tasks are like CSS preprocessor, Transpire, Module Bundler, etc... e.g. ...
-
It is general to create multiple branches and manage them parallel when we do the development by using git. Multiple branches should be mer...
-
Kubernetes words Node Virtual machine or physical server. Cluster It means at least one master node and one node server. Pod It...