查看版本当前操作系统内核信息
[root@vm319t003 opt]# uname -a
Linux vm319t003.yto.cloud 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
查看当前操作系统版本信息
[root@vm319t003 opt]# cat /proc/version
Linux version 3.10.0-693.21.1.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Wed Mar 7 19:03:37 UTC 2018
查看端口号占用
[root@localhost ~]# lsof -i:8090
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 6315 root 21u IPv6 1258560 0t0 TCP *:8090 (LISTEN)
[root@localhost ~]# netstat -apn | grep 8090
tcp6 0 0 :::8090 :::* LISTEN 6315/java
[root@localhost ~]# netstat -anlp | grep 9992
[root@localhost ~]# netstat -anlp | grep 8090
tcp6 0 0 :::8090 :::* LISTEN 6315/java
查找文件夹和文件
- 根目录下查找application.properties文件
find / -name application.properties
- 根目录下查找app_service文件夹
find / -name app_service -type d
内存
- Linux free命令用于显示内存状态。
free指令会显示内存的使用情况,包括实体内存,虚拟的交换文件内存,共享内存区段,以及系统核心使用的缓冲区等。
[root@host-192-168-4-200 ~]# free
total used free shared buffers cached
Mem: 6931468 5599092 1332376 0 9976 101712
-/+ buffers/cache: 5487404 1444064
Swap: 4128760 3717832 410928
- 对于free命令,可以加上-m参数,使其显示单位为Mb
[root@host-192-168-4-200 ~]# free -m
total used free shared buffers cached
Mem: 6769 5957 811 0 5 51
-/+ buffers/cache: 5899 869
Swap: 4031 3971 60
硬盘
- df命令用于显示磁盘分区上的可使用的磁盘空间
[root@host-192-168-4-68 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 537G 38G 472G 8% /
tmpfs 16G 0 16G 0% /dev/shm
/dev/vda1 485M 39M 421M 9% /boot
- 查看硬盘和分区分布
[root@host-192-168-4-200 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 252:0 0 50G 0 disk
├─vda1 252:1 0 500M 0 part /boot
└─vda2 252:2 0 49.5G 0 part
├─VolGroup-lv_root (dm-0) 253:0 0 144.6G 0 lvm /
└─VolGroup-lv_swap (dm-1) 253:1 0 4G 0 lvm [SWAP]
vdb 252:16 0 100G 0 disk
└─VolGroup-lv_root (dm-0) 253:0 0 144.6G 0 lvm /
- 查看硬盘和分区的详细信息
[root@host-192-168-4-200 ~]# fdisk -l
Disk /dev/vda: 53.7 GB, 53687091200 bytes
16 heads, 63 sectors/track, 104025 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000bd363
Device Boot Start End Blocks Id System
/dev/vda1 * 3 1018 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2 1018 104026 51915776 8e Linux LVM
Partition 2 does not end on cylinder boundary.
Disk /dev/vdb: 107.4 GB, 107374182400 bytes
16 heads, 63 sectors/track, 208050 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/VolGroup-lv_root: 155.2 GB, 155231191040 bytes
255 heads, 63 sectors/track, 18872 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/VolGroup-lv_swap: 4227 MB, 4227858432 bytes
255 heads, 63 sectors/track, 514 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000