This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ssh to host | |
ssh user@hostname | |
# generate ssh key | |
ssh-keygen -t rsa -C "[email protected]" | |
# copy local ssh public key to remote host | |
ssh-copy-id user@hostname | |
# add private key to ssh-agent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 如果是通过 apt-get 或 yum 安装的 redis | |
/etc/init.d/redis-server stop | |
/etc/init.d/redis-server start | |
/etc/init.d/redis-server restart | |
# 如果是通过源码安装的 redis | |
./redis-cli -h 127.0.0.1 -p 6379 shutdown | |
./redis-cli -a 密码 -h 127.0.0.1 -p 6379 shutdown # 如果有密码 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 按状态统计 | |
netstat -nat | awk '{print $6}' | sort | uniq -c |sort -rn | |
# 按本机到外部80端口的访问统计 | |
netstat -nat | grep ESTABLISHED | awk '{print $5}' | grep :80 | sort | uniq -c | sort -rn | |
# 按外部到本机80端口的访问统计 | |
netstat -nat | grep ESTABLISHED | awk '{print $4}' | grep :80 | sort | uniq -c | sort -rn | |
# ESTABLISHED 正在通信 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Sort Lines. | |
2. Find And Replace. (确保正则模式打开) | |
^(.+)$[\r\n](^\1$[\r\n]{0, 1})+ | |
\1\n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ulimit -a | |
ulimit -n | |
# check hard limit | |
ulimit -Hn | |
# check soft limit | |
ulimit -Sn | |
# current session change |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list enabled ports/services | |
firewall-cmd --zone=public --list-ports | |
firewall-cmd --zone=public --list-service | |
# enable http(s) port (80 443) using the firewall-cmd | |
firewall-cmd --permanent --zone=public --add-service=http | |
firewall-cmd --permanent --zone=public --add-service=https | |
firewall-cmd --reload | |
# enable specified port |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check selinux status (SELinux status & Current mode) | |
sestatus | |
--- | |
SELinux status: enabled | |
SELinuxfs mount: /sys/fs/selinux | |
SELinux root directory: /etc/selinux | |
Loaded policy name: targeted | |
Current mode: enforcing | |
Mode from config file: enforcing | |
Policy MLS status: enabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CentOS 6.x | |
hostname newHostName | |
vi /etc/sysconfig/network | |
# CentOS 7.x | |
hostnamectl set-hostname newHostName | |
# Change oldHostName to newHostName | |
vim /etc/hosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 查看 Linux 内核版本信息 | |
cat /proc/version | |
uname -a | |
uname -r | |
# 查看 Linux 系统版本信息 | |
cat /etc/issue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum install http://opensource.wandisco.com/centos/6/git/x86_64/wandisco-git-release-6-1.noarch.rpm -y | |
yum --disablerepo=base,updates --enablerepo=rpmforge-extras update git -y | |
yum update git -y | |
git --version |
NewerOlder