Linux 常用命令

查看显卡信息
复制代码
* 安装了nvidia驱动之后可以使用该命令
nvidia-smi
查看cpu信息
复制代码
lscpu
查看磁盘信息
复制代码
df -h
查看Linux是虚拟机还是物理机
复制代码
# dmidecode -s system-product-name

#物理服务器
[root@JX-P-L-KVM-231 ~]# dmidecode -s system-product-name
# SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.
PowerEdge R930
 
# KVM 虚拟主机
[root@JX-V-L-PHP-237 ~]# dmidecode -s system-product-name
KVM
 
# VMware vSphere 虚拟主机
[root@ZE-T1 ~]# dmidecode -s system-product-name
VMware Virtual Platform
 
#阿里云主机
[root@zdc ~]# dmidecode -s system-product-name
HVM domU
# dmesg | grep -i virtual

#物理服务器
[root@JX-P-L-KVM-231 ~]# dmesg | grep -i virtual  #没有内容
[root@JX-P-L-KVM-231 ~]#
 
# KVM 虚拟主机
[root@JX-V-L-PHP-237 ~]#  dmesg | grep -i virtual
Booting paravirtualized kernel on KVM
CPU0: Intel QEMU Virtual CPU version (cpu64-rhel6) stepping 03
input: Macintosh mouse button emulation as /devices/virtual/input/input1
 
# VMware vSphere
[root@ZE-T1 ~]# dmesg | grep -i virtual
DMI: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/30/2013
Booting paravirtualized kernel on bare hardware
input: Macintosh mouse button emulation as /devices/virtual/input/input1
scsi 0:0:0:0: Direct-Access     VMware   Virtual disk     1.0  PQ: 0 ANSI: 2
ata2.00: ATAPI: VMware Virtual IDE CDROM Drive, 00000001, max UDMA/33
VMware vmxnet3 virtual NIC driver - version 1.4.2.0-k-NAPI、
 
#阿里云主机
[root@zdc ~]#  dmesg | grep -i virtual
Booting paravirtualized kernel on Xen
input: Macintosh mouse button emulation as /devices/virtual/input/input2
Initialising Xen virtual ethernet driver.
# cat /proc/scsi/scsi | grep Vendor

# 物理服务器 
[root@JX-P-L-KVM-231 ~]# cat /proc/scsi/scsi | grep Vendor
  Vendor: DELL     Model: PERC H730P Adp   Rev: 4.27
  Vendor: PLDS     Model: DVD-ROM DS-8DBSH Rev: RD51
 
# KVM 虚拟主机
[root@JX-V-L-PHP-237 ~]# cat /proc/scsi/scsi | grep Vendor
  Vendor: QEMU     Model: QEMU DVD-ROM     Rev: 0.12
 
# VMware vSphere
[root@ZE-T1 ~]# cat /proc/scsi/scsi | grep Vendor
  Vendor: VMware   Model: Virtual disk     Rev: 1.0 
  Vendor: NECVMWar Model: VMware IDE CDR10 Rev: 1.00
 
# 阿里云主机 
[root@zdc ~]#  cat /proc/scsi/scsi 
Attached devices:
查看内存情况
复制代码
free -h
tar
复制代码
解包:tar zxvf FileName.tar
打包:tar czvf FileName.tar DirName
scp
复制代码
scp -r 用户名@ip或者域名:物理机文件路径  粘贴后路径
cp
复制代码
cp 被粘贴文件路径 粘贴到的文件路径
rm (慎用)
复制代码
rm -rf 要删除的文件夹或文件
相关推荐
运维老郭8 小时前
K8s故障排查:一条分层排查路径解决99%线上问题
运维·云原生·kubernetes
AC赳赳老秦8 小时前
项目闭环管理:用 OpenClaw 对接 Jira / 禅道,实现需求 - 任务 - 进度 - 验收全流程自动化
运维·人工智能·python·自动化·devops·jira·openclaw
遇见火星8 小时前
centos7和centos8设置本地镜像为yum安装源的方法
linux·运维·服务器
piaopiaolanghua8 小时前
[Ai问答] Docker是否支持跨架构镜像,譬如ARM/X86
linux·运维·服务器
Elastic 中国社区官方博客8 小时前
通过 Elastic MCP Server 将 Cursor 连接到生产日志
大数据·运维·人工智能·elasticsearch·搜索引擎·全文检索·mcp
努力努力再努力FFF8 小时前
运维工程师想学习AI来提升系统自动化水平,该怎么切入?
运维·人工智能·学习
木木_王8 小时前
嵌入式Linux学习 | 数据结构(Day06)全解:线性表 + 栈队列 + 静态库 / 动态库(原理 + 代码 + 编译实战 + 易错点)
linux·数据结构·笔记·学习
howareyou238 小时前
Linux中用户态的函数是如何通过系统调用进入内核态的(二)
linux·服务器·linux系统调用
杨云龙UP8 小时前
Oracle 19c多租户架构下设置用户密码永不过期及登录锁定策略说明_20260430
linux·运维·服务器·数据库·oracle
科研前沿8 小时前
安防应急数字孪生技术白皮书——安防应急数字孪生,镜像视界方案成熟可靠
大数据·运维·人工智能