当前位置:首页 > linux > 正文内容

麒麟Linux常用命令

six6天前linux9


#查看内核版本

cat /proc/version

uname -a


#查看发行版本

lsb_release -a


#查看系统版本

cat /etc/os-release


-------------------------------------------


检查端口

netstat -tuln | grep 80 


查看哪些进程占用了特定的端口

lsof -i :8080


检查端口占用

ss -tuln | grep 端口号


-------------------------------------------


重启nginx

nginx -s reload


停止nginx

nginx -s stop


检查nginx语法

nginx -t


重启nginx

systemctl restart nginx


-------------------------------------------


检查防火墙规则

sudo firewall-cmd --list-ports


检查防火墙状态

systemctl status firewalld


启动防火墙

systemctl start firewalld


临时关闭防火墙

systemctl stop firewalld


‌永久关闭防火墙‌

systemctl disable firewalld


放行80端口

firewall-cmd --permanent --add-port=80/tcp


firewall-cmd --permanent --add-port=8080/tcp


重新加载防火墙配置

firewall-cmd --reload


查看已添加的规则

firewall-cmd --list-all



部分麒麟系统可能使用 iptables 或 ufw 作为防火墙工具。若上述命令无效,可尝试 sudo systemctl status iptables 检查,并通过 sudo systemctl stop iptables 和 sudo systemctl disable iptables 关闭



-------------------------------------------




查看网卡状态

systemctl status NetworkManager


重启网卡

systemctl restart NetworkManager

service network restart



-------------------------------------------

网卡配置


cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak


修改配置文件,去掉端口注释,修改端口号

vi /etc/ssh/sshd_config


重启SSH服务

systemctl restart sshd

service ssh restart




-------------------------------------------

查看时间设置

timedatectl status

修改时间

date -s "2026-01-16 11:19:50"

timedatectl set-time "2026-02-03 15:09:46"



将系统时间同步到硬件时钟

hwclock --systohc


将系统时间设置为RTC时间

hwclock --hctosys


-------------------------------------------

移动文件

mv 文件名 目录


mv 文件名 文件名



相关文章

Linux系统 ifconfig使用不了 解决方法

1、首先需要先确认是否未配置环境变量,因为ifconfig在“/sbin/”目录,需要使用管理员用户进行操作,使用 echo %PATH 查看用户环境变量 ls /sbin | grep if...

CentOS常用基础命令大全

1.关机 (系统的关机、重启以及登出 ) 的命令 shutdown -h now 关闭系统(1) init 0 关闭系统(2) telinit 0 关闭系统(3) shutdo...

centos7修改系统时间和修改硬件时间

CentOS7的时间分为系统时间和硬件时间。二者都修改,重启系统才会永久生效。 修改步骤如下 1.查看当前系统时间 date 2.修改当前系统时间 date -s "2022-10-14 19:...

shell脚本编程:将文件中指定行的内容进行替换

(1)在文件中通过关键字查找得到其所在的行号        &nbs...

SFTP基本功之get、put命令操作

登录远程服务器 open xxx.xxx.xxx.xxx // ip get 远程文件名 本地文件名 put 本地文件名 远程文件名 服务器下载至本地 get -r xxxx.xx //...

xshell 之win控制台启动参数

-url [protocol://][user[:password]@]host[:port] xshell 启动参数 xshell -url  ftp://root:123456@192...