nohup bin/logstash &
查看后台任务 jobs -l
杀进程 kill -9 进程号
sudo yum install -y wget vim tree git
1、打开/etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=172.26.1.212
GATEWAY=172.26.1.1
NETMASK=255.255.255.0
DNS1=223.5.5.5
2、service network restart
自动配置脚本:
#!/bin/bash
IP_FILE=/etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/BOOTPROTO=none/BOOTPROTO=static/g' $IP_FILE
sed -i 's/ONBOOT=no/ONBOOT=yes/g' $IP_FILE
read -p "请输入IP地址: " ip
echo "IPADDR=$ip" >> $IP_FILE
read -p "请输入网关:" gateway
echo "GATEWAY=$gateway" >> $IP_FILE
read -p "请输入子网掩码:" netmask
echo "NETMASK=$netmask">>$IP_FILE
read -p "请输入DNS:" dns1
echo "DNS1=$dns1" >> $IP_FILE
service network restart
1、打开/etc/NetworkManager/NetworkManager.conf,增加一行dns=none
2、修改 /etc/resolv.confnameserver 8.8.8.8
3、重启:systemctl restart NetworkManager.service
export http_proxy=http://10.10.1.222:108
1、解压: tar -zxvf oracle-jdk-***.tar.gz -C /usr/local/
2、设置环境变量: 打开 /etc/profile
export JAVA_HOME=/usr/local/****
export CLASSPATH=.:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=${JAVA_HOME}/bin:$PATH
3、生效: source /etc/profile
安装目录:
#!/bin/bash
echo "start install jdk..."
mkdir /usr/local/java
echo "mkdir success"
tar -zxf jdk-8u191-linux-x64.tar.gz -C /usr/local/java/
echo "tar success"
cat >> /etc/profile << EOF
export JAVA_HOME=/usr/local/java/jdk1.8.0_191
export JRE_HOME=/usr/local/java/jdk1.8.0_191/jre
export CLASSPATH=.:/usr/local/java/jdk1.8.0_191/lib/dt.jar:/usr/local/java/jdk1.8.0_191/lib/tools.jar:/usr/local/java/jdk1.8.0_191/jre/lib
export PATH=$PATH:/usr/local/java/jdk1.8.0_191/bin:/usr/local/java/jdk1.8.0_191/jre/bin
EOF
echo "cat sucess"
source /etc/profile
echo "JDK is installed"
1、添加用户,修改密码:
useradd tangwx
passwd tangwx
2、赋予root权限
su root
# 文件可写
chmod u+w /etc/sudoers
# 编辑文件 vi /etc/sudoers--增加一行
tangwx ALL=(ALL) ALL
# 取消文件可写权限
chmod u-w /etc/sudoers
# 安装ntpdate
yum install ntpdate
#同步
ntpdate -u time.pool.aliyun.com
# 读/写入硬件
sudo hwclock -r/-w
cat /etc/os-release
1、修改颜色
# 在~目录新建文件: vi .vimrc
set nu
colorscheme desert
set tabstop=2
set shiftwidth=2
2、移动多行:
# 剪切 n+dd
# 粘贴 p
3、多行缩进: :m,n > (右缩)
安装 : yum install screen
ctrl-a c: 新建
ctrl-a x: 删除
ctrl-a n: 下个窗口
ctrl-a p: 上个窗口
ctrl-a ctrl-a: 最近两个窗口切换
ctrl-a S: 垂直分屏
ctrl-a Q: 取消分屏
ctrl-a TAB: 分屏窗口间切换
screen -ls: 查看列表
screen -r ID: 重新载入
screen -D -r ID: 重新载入
screen -d: detached
screen -X -S ID quit: 杀死detached回话
默认没有此命令,需要安装yum install net-tools
进入/etc/yum.repos.d/
把原来的repo文件备份一下。
然后下载网易和阿里的镜像源。
wget http://mirrors.aliyun.com/repo/Centos-7.repo
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo>
yum clean all
yum makecache
yum update
https://www.cnblogs.com/renpingsheng/p/7845096.html 源博文
https://blog.csdn.net/zhangjiahao14/article/details/80554616
ip addr
状态:firewall-cmd --state
启动:systemctl start firewalld.service
关闭:systemctl stop firewalld.service
重启:firewall-cmd --reload
端口是否开放:firewall-cmd --query-port=9200/tcp
开放端口:firewall-cmd --zone=public --add-port=9200/tcp --permanent
scp 文件路径 [email protected]:/root/data-store
find /dir -name filename 在/dir目录及其子目录下面查找名字为filename的文件
sudo yum install zsh
chsh -s /bin/zsh
登出再登录后,检查当前的shell是否为zsh
echo $SHELL
#安装oh-my-zsh(需要安装好git: sudo yum install wget git -y)
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
source ~/.zshrc
安装脚本:
zsh-install.sh
#!/bin/bash
sudo yum install wget git zsh -y
chsh -s /bin/zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
source ~/.zshrc
新建配置文件: vim ~/.ssh/config
Host 139
HostName 172.26.1.139
User twx
Port 22
Host 213
HostName 172.26.1.213
User tangwx
Port 22
Host 215
HostName 172.26.1.215
User tangwx
Port 22
使用: ssh 139 | ssh 213
配合ssh公钥登录,完美!!!
vim /etc/ssh/sshd_config
#启用公钥登录
PubkeyAuthentication yes
#添加.ssh/id_rsa.pub到目标主机的~/.ssh/authorized_keys
echo "key" >> ~/.ssh/authorized_keys
#一定要设置权限
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
#############################
###生成密钥,拷贝公钥到目标机器上#####
ssh-keygen -t rsa #生成密钥对
ssh-copy-id -i 10.10.1.9 #将公钥拷贝到目标机器上
cat .ssh/id_rsa.pub >> authorized_keys #将公钥添加到认证文件中
hostnamectl set-hostname tangwx-logstash1
一级子目录的大小
du -h --max-depth=1 /home/twx
指定目录的大小
du -sh /home/twx
对目录排序: rn 按数字逆序排
du -s ~/* | sort -rn
netstat -ltunp | grep 端口号
ss -ltupn | grep 端口号
-l LISTEN
-t tcp
-u udp
-n 不解析主机名
-p 显示进程PID
sudo nmap -sn 172.26.1.0/24
sudo nmap 172.26.1.139 -p8000-10000
-p 用来指定端口范围
使用sudo apt upgrade升级包时,wps下载很慢,那么我想忽略更新wps怎么办呢?
使用命令: sudo apt-mark hold wps-office, 这样upgrade时就不会更新wps了
sudo apt-mark unhold wps-office
将 hold
替换为 unhold
就可以取消对这个包版本的锁定了
cat /dev/null > test.txt
gg dG
ps -ax | grep "kitchen" | grep -v "grep" | awk '{print $1}' | xargs kill -9
#$0 表示shell脚本名,例如test.sh
a=$(dirname "$0")
path=$(cd $a;pwd)