linux 个人笔记导出之网络,防火墙,定时,权限,后台

文章目录

    • contab定时
    • [permission 权限](#permission 权限)
    • [backstage 后台任务](#backstage 后台任务)
    • 防火墙
    • [net 网络](#net 网络)
        • lsof检查端口进程
        • [telnet 测试远程服务器端口](#telnet 测试远程服务器端口)
        • [ss netstat](#ss netstat)
        • nmap
        • curl
            • [nslookup 查看域名解析](#nslookup 查看域名解析)
            • [获取网卡 en0 ipconfig](#获取网卡 en0 ipconfig)

后面才意识到,很多看看,了解知道有这么回事就行

contab定时

  • explanation

    text 复制代码
    * * * * *
    │ │ │ │ │
    │ │ │ │ └─ What day of the week (0-7) (0 or 7 is Sunday)
    │ │ │ └─── Month (1-12)
    │ │ └───── Date (1-31)
    │ └─────── Hour (0-23)
    └───────── Minute (0-59)
  • example

    bash 复制代码
    # Executed at midnight every day
    0 0 * * * /root/xxxx/cleanshell/clean-es-posts.sh
    
    # every Monday morning
    0 3 * * 1 /root/xxxxx/cleanshell/clean-es-posts.sh
    
    # first day of each month.
    0 3 1 * * /root/xxxxx/cleanshell/clean-es-posts.sh
    
    # three o 'clock every afternoo
    0 15 * * * /root/xxxxx/cleanshell/clean-es-posts.sh
    
    # every hour
    0 * * * * /root/ xxxxx/cleanshell/clean-es-posts.sh

permission 权限

755 : read write ex

bash 复制代码
chmod 750 file1.txt # set the permission as rwxr-x---(750)
umask -> set to count the permission

use chown / chrgp to change the owner / group of a file

/root 中的再怎么加权限都不行的

backstage 后台任务

bash 复制代码
sleep 1000 & 
# set a Background process, sleep 1000s, &: put to the background ,Prevent blocking of the current shell
jobs 
jobs -l  # check the background process in the current terminal
killall sleep # stop all the sleep progress 

# Front-end and back-end switching
sleep 1000 #fg frontgroud 
Crtl+Z -> put to the background 
jobs 
fg %1 # put to fg, mission %1
Crtl+C to stop

ps aux:All running processes (including other users, endpoints, daemons)

jobs:​ Only the background/pause tasks started by the current terminal

nohup : taks may be terminated when the terminal is closed, use nohup to solve

bash 复制代码
nohup sleep 1000 &
ps aux | grep sleep 
cat nohup.out # nohup will generate the nohup.out file, sleep has no output, so it is empty

防火墙

bash 复制代码
sudo ufw status
sudo ufw allow 80 
sudo ufw allow 443 
sudo ufw reload

net 网络

lsof检查端口进程
bash 复制代码
lsof -i :7000
telnet 测试远程服务器端口
bash 复制代码
telnet 142.171.225.226 7000
ss netstat
bash 复制代码
ip addr #Check the ip address, have different net card 
ss -tuln  # check the listening ports
ss -tuln | grep 80 # 这时候nginx就在监听了
netstat -tulnp # like ss


netstat -tuln | grep 7000 # 检查端口
netstat -tuln  容器内部也可以看监听的
bash 复制代码
sudo netstat/ss -tuln | grep -E ':80|:443'
nmap
bash 复制代码
nmap -p 80,443 142.171.225.226
curl

Check the response header and status code

bfe: baidu's load balancing server -> 302 means redirection

-L:Auto-follow redirection- > will show the true result

-v: Displays detailed request and response procedures

-s : no output

-o : output file like : curl -o baidu.html https://baidu.com

check mywebsite:

bash 复制代码
curl -I http://231114.top
nslookup 查看域名解析
bash 复制代码
nslookup b1a6ae8ec37d.ngrok-free.app
dig 231114.top
获取网卡 en0 ipconfig
复制代码
ipconfig getifaddr en0
相关推荐
春日见17 小时前
如何避免代码冲突,拉取分支
linux·人工智能·算法·机器学习·自动驾驶
珠海西格18 小时前
“主动预防” vs “事后补救”:分布式光伏防逆流技术的代际革命,西格电力给出标准答案
大数据·运维·服务器·分布式·云计算·能源
无垠的广袤18 小时前
【VisionFive 2 Lite 单板计算机】边缘AI视觉应用部署:缺陷检测
linux·人工智能·python·opencv·开发板
zr52685544718 小时前
PCIe-PN卡(三格电子)
网络
阿波罗尼亚18 小时前
Kubectl 命令记录
linux·运维·服务器
无名的小三轮18 小时前
防火墙基础实验:智能选路下的透明DNS选路配置
网络
一轮弯弯的明月18 小时前
TCP传输大致过程、流量控制与拥塞控制
网络·tcp/ip·计算机网络·学习心得
Fᴏʀ ʏ꯭ᴏ꯭ᴜ꯭.18 小时前
Keepalived单播模式配置与实战指南
linux·服务器·负载均衡
IDC02_FEIYA18 小时前
Linux文件搜索命令有哪些?Linux常用命令之文件搜索命令find详解
linux·运维·服务器
犀思云18 小时前
如何通过网络即服务平台实现企业数字化转型?
运维·网络·人工智能·系统架构·机器人