Files
obsidian_note/技术探究/Linux/命令.md
2025-12-04 09:12:56 +08:00

55 lines
1.3 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
nohup command > /dev/null 2>&1 &
> \> 和 >> 区别,> 会先清空,>> 做追加
### 查看 MAC 地址
ifconfig 这是最常用的方式
ip link show
cat /sys/class/net/eth0/address 查看eth0的mac地址
dmesg | [grep](https://so.csdn.net/so/search?q=grep&spm=1001.2101.3001.7020) eth0
### 开放端口
一个
iptables -I INPUT -s 172.22.0.0/16 -p tcp --dport 5432 -j ACCEPT
iptables -I INPUT -s 125.81.157.249 -p tcp --dport 8848 -j ACCEPT
-m comment --comment "allow SSH to this host from anywhere"
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
service iptables save
所有
iptables -I INPUT -s  172.3.2.0/24 -p tcp --dport 1:65535 -j ACCEPT
> iptables 语法
>https://blog.csdn.net/niuch1029291561/article/details/130935708
### 获取运行脚本 位置
> $(dirname $(readlink -f "$0")
### 获取运行进程
> ll /proc/进程号
### 统计当前目录 文件个数 文件 计数
> ls -hl|grep ^d|wc -l
### 查看文件 大小
> du -h -d 1
### 整体替换 文字
```shell
find /data/zhsq/countryside/juyuan/ -type f|grep yml$|xargs sed -i 's/qinghai-country/juyuan-country/g'
```
### 查找文件 内容 文件名
```shell
grep -rl "pattern" /path/to/directory
file1.txt
file2.txt
file3.txt
```
### 图形化界面
>https://blog.csdn.net/u011811066/article/details/131155350