arch
显示机器的处理器架构
[root@lhuan ~]# archx86_64
uname
常用参数
| 参数 | 说明 |
|---|---|
| -m | 显示机器的处理器架构 |
| -r | 显示正在使用的内核版本 |
| -a | 显示系统所有相关信息 |
| -n | 显示主机名称 |
| -s | 显示内核名称 |
| -v | 显示内核版本 |
| -p | 显示主机处理器类型 |
| -o | 显示操作系统名称 |
| -i | 显示硬件平台 |
#显示机器的处理器架构[root@lhuan ~]# uname -mx86_64#显示正在使用的内核版本[root@lhuan ~]# uname -r3.10.0-1062.9.1.el7.x86_64#显示主机名称[root@lhuan ~]# uname -nlhuan#显示内核名称[root@lhuan ~]# uname -sLinux#显示内核版本[root@lhuan ~]# uname -v#1 SMP Fri Dec 6 15:49:49 UTC 2019[root@lhuan ~]# uname -px86_64#显示操作系统名称[root@lhuan ~]# uname -oGNU/Linux[root@lhuan ~]# uname -ix86_64
dmidecode
获取有关硬件方面的信息
以一种可读的方式显示机器的DMI(Desktop Management Interface)信息, 其输出的信息包括 BIOS、系统、主板、处理器、内存、缓存等等, 既可以得到当前的配置,也可以得到系统支持的最大配置,比如说支持的最大内存数等。
[root@lhuan ~]# dmidecode
# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 2.8 present.
9 structures occupying 392 bytes.
Table at 0x000F6A30.
Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
Vendor: SeaBIOS
Version: seabios-1.9.1-qemu-project.org
Release Date: 04/01/2014
Address: 0xE8000
Runtime Size: 96 kB
ROM Size: 64 kB
Characteristics:
BIOS characteristics not supported
Targeted content distribution is supported
BIOS Revision: 0.0
Handle 0x0100, DMI type 1, 27 bytes
System Information
Manufacturer: Smdbmds
Product Name: KVM
Version: 3.0
Serial Number: 12ee31da-1c16-4613-81fa-c0bd8e31d861
UUID: 12ee31da-1c16-4613-81fa-c0bd8e31d861
Wake-up Type: Power Switch
SKU Number: Not Specified
Family: Smdbmds
Handle 0x0300, DMI type 3, 21 bytes
Chassis Information
Manufacturer: Smdbmds
Type: Other
Lock: Not Present
Version: 3.0
Serial Number: Not Specified
Asset Tag: Not Specified
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Security Status: Unknown
OEM Information: 0x00000000
Height: Unspecified
Number Of Power Cords: Unspecified
Contained Elements: 0
Handle 0x0400, DMI type 4, 42 bytes
Processor Information
Socket Designation: CPU 0
Type: Central Processor
Family: Other
Manufacturer: Smdbmds
ID: E3 06 05 00 FF FB 8B 0F
Version: 3.0
Voltage: Unknown
External Clock: Unknown
Max Speed: 2000 MHz
Current Speed: 2000 MHz
Status: Populated, Enabled
Upgrade: Other
L1 Cache Handle: Not Provided
L2 Cache Handle: Not Provided
L3 Cache Handle: Not Provided
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Core Count: 1
Core Enabled: 1
Thread Count: 1
Characteristics: None
Handle 0x1000, DMI type 16, 23 bytes
Physical Memory Array
Location: Other
Use: System Memory
Error Correction Type: Multi-bit ECC
Maximum Capacity: 2 GB
Error Information Handle: Not Provided
Number Of Devices: 1
Handle 0x1100, DMI type 17, 40 bytes
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: Unknown
Data Width: Unknown
Size: 2048 MB
Form Factor: DIMM
Set: None
Locator: DIMM 0
Bank Locator: Not Specified
Type: RAM
Type Detail: Other
Speed: Unknown
Manufacturer: Smdbmds
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Rank: Unknown
Configured Memory Speed: Unknown
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: Unknown
Handle 0x1300, DMI type 19, 31 bytes
Memory Array Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0007FFFFFFF
Range Size: 2 GB
Physical Array Handle: 0x1000
Partition Width: 1
Handle 0x2000, DMI type 32, 11 bytes
System Boot Information
Status: No errors detected
Handle 0x7F00, DMI type 127, 4 bytes
End Of Table
常用参数
| 参数 | 说明 |
|---|---|
| -d | 从设备文件读取信息,输出内容与不加参数的标准输出相同 |
| -h | 显示帮助信息 |
| -s | 只显示制定DMI字符串信息 Valid string keywords are: bios-vendor bios-version bios-release-date system-manufacturer system-product-name system-version system-serial-number system-uuid system-family baseboard-manufacturer baseboard-product-name baseboard-version baseboard-serial-number baseboard-asset-tag chassis-manufacturer chassis-type chassis-version chassis-serial-number chassis-asset-tag processor-family processor-manufacturer processor-version processor-frequency |
| -t | 只显示指定条目的信息,后面加数字(从0开始)或者加关键字符串(eg:processor) |
| -u | 显示未解码的原始条目内容 |
| -q | 显示硬件信息 |
| — -dump-bin file | 将DMI数据转储到一个二进制文件中 |
| — -from-dump FILE | 从一个二进制文件读取DMI数据 |
| -V | 显示版本信息 |
##显示硬件信息
[root@lhuan ~]# dmidecode -q
BIOS Information
Vendor: SeaBIOS
Version: seabios-1.9.1-qemu-project.org
Release Date: 04/01/2014
Address: 0xE8000
Runtime Size: 96 kB
ROM Size: 64 kB
Characteristics:
BIOS characteristics not supported
Targeted content distribution is supported
BIOS Revision: 0.0
System Information
Manufacturer: Smdbmds
Product Name: KVM
Version: 3.0
Serial Number: 12ee31da-1c16-4613-81fa-c0bd8e31d861
UUID: 12ee31da-1c16-4613-81fa-c0bd8e31d861
Wake-up Type: Power Switch
SKU Number: Not Specified
Family: Smdbmds
Chassis Information
Manufacturer: Smdbmds
Type: Other
Lock: Not Present
Version: 3.0
Serial Number: Not Specified
Asset Tag: Not Specified
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Security Status: Unknown
OEM Information: 0x00000000
Height: Unspecified
Number Of Power Cords: Unspecified
Contained Elements: 0
Processor Information
Socket Designation: CPU 0
Type: Central Processor
Family: Other
Manufacturer: Smdbmds
ID: E3 06 05 00 FF FB 8B 0F
Version: 3.0
Voltage: Unknown
External Clock: Unknown
Max Speed: 2000 MHz
Current Speed: 2000 MHz
Status: Populated, Enabled
Upgrade: Other
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Core Count: 1
Core Enabled: 1
Thread Count: 1
Characteristics: None
Physical Memory Array
Location: Other
Use: System Memory
Error Correction Type: Multi-bit ECC
Maximum Capacity: 2 GB
Number Of Devices: 1
Memory Device
Total Width: Unknown
Data Width: Unknown
Size: 2048 MB
Form Factor: DIMM
Set: None
Locator: DIMM 0
Bank Locator: Not Specified
Type: RAM
Type Detail: Other
Speed: Unknown
Manufacturer: Smdbmds
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Rank: Unknown
Configured Memory Speed: Unknown
Minimum Voltage: Unknown
Maximum Voltage: Unknown
Configured Voltage: Unknown
Memory Array Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0007FFFFFFF
Range Size: 2 GB
Partition Width: 1
System Boot Information
Status: No errors detected
##显示第2个条目
[root@lhuan ~]# dmidecode -t1
# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 2.8 present.
Handle 0x0100, DMI type 1, 27 bytes
System Information
Manufacturer: Smdbmds
Product Name: KVM
Version: 3.0
Serial Number: 12ee31da-1c16-4613-81fa-c0bd8e31d861
UUID: 12ee31da-1c16-4613-81fa-c0bd8e31d861
Wake-up Type: Power Switch
SKU Number: Not Specified
Family: Smdbmds
##显示原始未解码的部分
[root@lhuan ~]# dmidecode -u
# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 2.8 present.
9 structures occupying 392 bytes.
Table at 0x000F6A30.
Handle 0x0000, DMI type 0, 24 bytes
Header and Data:
00 18 00 00 01 02 00 E8 03 00 08 00 00 00 00 00
00 00 00 04 00 00 FF FF
Strings:
53 65 61 42 49 4F 53 00
"SeaBIOS"
73 65 61 62 69 6F 73 2D 31 2E 39 2E 31 2D 71 65
6D 75 2D 70 72 6F 6A 65 63 74 2E 6F 72 67 00
"seabios-1.9.1-qemu-project.org"
30 34 2F 30 31 2F 32 30 31 34 00
"04/01/2014"
Handle 0x0100, DMI type 1, 27 bytes
Header and Data:
01 1B 00 01 01 02 03 04 DA 31 EE 12 16 1C 13 46
81 FA C0 BD 8E 31 D8 61 06 00 05
Strings:
53 6D 64 62 6D 64 73 00
"Smdbmds"
4B 56 4D 00
"KVM"
33 2E 30 00
"3.0"
31 32 65 65 33 31 64 61 2D 31 63 31 36 2D 34 36
31 33 2D 38 31 66 61 2D 63 30 62 64 38 65 33 31
64 38 36 31 00
"12ee31da-1c16-4613-81fa-c0bd8e31d861"
53 6D 64 62 6D 64 73 00
"Smdbmds"
Handle 0x0300, DMI type 3, 21 bytes
Header and Data:
03 15 00 03 01 01 02 00 00 03 03 03 02 00 00 00
00 00 00 00 00
Strings:
53 6D 64 62 6D 64 73 00
"Smdbmds"
33 2E 30 00
"3.0"
Handle 0x0400, DMI type 4, 42 bytes
Header and Data:
04 2A 00 04 01 03 01 02 E3 06 05 00 FF FB 8B 0F
03 00 00 00 D0 07 D0 07 41 01 FF FF FF FF FF FF
00 00 00 01 01 01 02 00 01 00
Strings:
43 50 55 20 30 00
"CPU 0"
53 6D 64 62 6D 64 73 00
"Smdbmds"
33 2E 30 00
"3.0"
Handle 0x1000, DMI type 16, 23 bytes
Header and Data:
10 17 00 10 01 03 06 00 00 20 00 FE FF 01 00 00
00 00 00 00 00 00 00
Handle 0x1100, DMI type 17, 40 bytes
Header and Data:
11 28 00 11 00 10 FE FF FF FF FF FF 00 08 09 00
01 00 07 02 00 00 00 02 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
Strings:
44 49 4D 4D 20 30 00
"DIMM 0"
53 6D 64 62 6D 64 73 00
"Smdbmds"
Handle 0x1300, DMI type 19, 31 bytes
Header and Data:
13 1F 00 13 00 00 00 00 FF FF 1F 00 00 10 01 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Handle 0x2000, DMI type 32, 11 bytes
Header and Data:
20 0B 00 20 00 00 00 00 00 00 00
Handle 0x7F00, DMI type 127, 4 bytes
Header and Data:
7F 04 00 7F
hdparm
用于检测,显示与设定IDE或SCSI硬盘的参数
hdparm [IDE或SCSI硬盘名称]
[root@lhuan ~]# hdparm /dev/vda1
/dev/vda1:
HDIO_DRIVE_CMD(identify) failed: Inappropriate ioctl for device
readonly = 0 (off)
readahead = 8192 (on)
geometry = 104023/16/63, sectors = 104855519, start = 2048
常用参数
| 参数 | 说明 |
|---|---|
| -a | 设定读取文件的时候,预先存入块区的分区数 |
| -f | 将内存缓冲区的数据写入磁盘,并清空缓冲区 |
| -g | 显示硬盘的磁轨、磁头、磁区等参数 |
| -l | 直接读取硬盘所提供的硬件规格信息 |
| -X | 设定硬盘的传输模式 |
| -i | 错误地在磁盘上执行测试行读取操作 |
| -Tt | 测试磁盘的读取效率 |
| -Y | 使硬盘进入睡眠模式 |
##显示硬盘的磁轨、磁头、磁区等参数
[root@lhuan ~]# hdparm -g /dev/vda1
/dev/vda1:
geometry = 104023/16/63, sectors = 104855519, start = 2048
##设定磁盘的传输模式
[root@lhuan ~]# hdparm -X /dev/vda1
/dev/vda1:
setting xfermode to 0 (default PIO mode)
HDIO_DRIVE_CMD(setxfermode) failed: Inappropriate ioctl for device
##错误地在磁盘上执行测试行读取操作
[root@lhuan ~]# hdparm -i /dev/vda1
/dev/vda1:
HDIO_DRIVE_CMD(identify) failed: Inappropriate ioctl for device
HDIO_GET_IDENTITY failed: Inappropriate ioctl for device
##在磁盘上执行测试性读取操作
[root@lhuan ~]# hdparm -Tt /dev/vda1
/dev/vda1:
Timing cached reads: 17672 MB in 1.99 seconds = 8875.94 MB/sec
Timing buffered disk reads: 568 MB in 3.00 seconds = 189.25 MB/sec
cat 查看信息
| 命令 | 说明 |
|---|---|
| cat /proc/cpuinfo | 显示CPU info 的信息 |
| cat /proc/interrupts | 显示中断 |
| cat /proc/meminfo | 校验内存使用 |
| cat /proc/swaps | 显示交换分区使用 |
| cat /proc/version | 显示内核的版本 |
| cat /proc/net/dev | 显示网络适配器及统计 |
| cat /proc/mounts | 显示已加载的文件系统 |
##显示cpu 信息
[root@lhuan ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 94
model name : Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
stepping : 3
microcode : 0x1
cpu MHz : 2394.378
cache size : 28160 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx avx512f avx512dq rdseed adx smap avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 arat
bogomips : 4788.75
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
##显示中断
[root@lhuan ~]# cat /proc/interrupts
CPU0
0: 96 IO-APIC-edge timer
1: 10 IO-APIC-edge i8042
4: 1008 IO-APIC-edge serial
6: 3 IO-APIC-edge floppy
8: 0 IO-APIC-edge rtc0
9: 0 IO-APIC-fasteoi acpi
10: 0 IO-APIC-fasteoi virtio2
11: 0 IO-APIC-fasteoi uhci_hcd:usb1
12: 15 IO-APIC-edge i8042
14: 1691505 IO-APIC-edge ata_piix
15: 0 IO-APIC-edge ata_piix
24: 0 PCI-MSI-edge virtio0-config
25: 9823733 PCI-MSI-edge virtio0-input.0
26: 1 PCI-MSI-edge virtio0-output.0
27: 0 PCI-MSI-edge virtio1-config
28: 6673677 PCI-MSI-edge virtio1-req.0
NMI: 0 Non-maskable interrupts
LOC: 403767622 Local timer interrupts
SPU: 0 Spurious interrupts
PMI: 0 Performance monitoring interrupts
IWI: 13381451 IRQ work interrupts
RTR: 0 APIC ICR read retries
RES: 0 Rescheduling interrupts
CAL: 0 Function call interrupts
TLB: 0 TLB shootdowns
TRM: 0 Thermal event interrupts
THR: 0 Threshold APIC interrupts
DFR: 0 Deferred Error APIC interrupts
MCE: 0 Machine check exceptions
MCP: 5773 Machine check polls
ERR: 0
MIS: 0
PIN: 0 Posted-interrupt notification event
NPI: 0 Nested posted-interrupt event
PIW: 0 Posted-interrupt wakeup event
##显示内存使用
[root@lhuan ~]# cat /proc/meminfo
MemTotal: 1882056 kB
MemFree: 656136 kB
MemAvailable: 1376768 kB
Buffers: 2832 kB
Cached: 757264 kB
SwapCached: 480 kB
Active: 677852 kB
Inactive: 333536 kB
Active(anon): 65064 kB
Inactive(anon): 186820 kB
Active(file): 612788 kB
Inactive(file): 146716 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 1049596 kB
SwapFree: 1008212 kB
Dirty: 312 kB
Writeback: 0 kB
AnonPages: 250968 kB
Mapped: 58080 kB
Shmem: 592 kB
Slab: 164708 kB
SReclaimable: 148604 kB
SUnreclaim: 16104 kB
KernelStack: 3008 kB
PageTables: 11408 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 1990624 kB
Committed_AS: 1744280 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 9496 kB
VmallocChunk: 34359724540 kB
HardwareCorrupted: 0 kB
AnonHugePages: 129024 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 61296 kB
DirectMap2M: 2035712 kB
DirectMap1G: 0 kB
##显示交换分区使用
[root@lhuan ~]# cat /proc/swaps
Filename Type Size Used Priority
/www/swap file 1049596 41384 -2
##显示内核版本
[root@lhuan ~]# cat /proc/version
Linux version 3.10.0-1062.9.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Fri Dec 6 15:49:49 UTC 2019
##显示网络适配器及统计
[root@lhuan ~]# cat /proc/net/dev
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
eth0: 1119504885 10816913 0 0 0 0 0 0 2121917811 11105411 0 0 0 0 0 0
lo: 8157658 58126 0 0 0 0 0 0 8157658 58126 0 0 0 0 0 0
##显示已加载的文件系统
[root@lhuan ~]# cat /proc/mounts
rootfs / rootfs rw 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
devtmpfs /dev devtmpfs rw,nosuid,size=930108k,nr_inodes=232527,mode=755 0 0
securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,nodev,mode=755 0 0
tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpuacct,cpu 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
lspci
显示当前主机的所有PCI总线信息,以及所有已连接的PCI设备信息。 现在主流设备如网卡储存等都采用PCI总线
常用参数
| 参数 | 说明 |
|---|---|
| -n | 以数字方式显示PCI厂商和设备代码 |
| -t | 以数字结构显示PCI设备的层次关系 |
| -b | 以中线为中心的视图 |
| -s | 只显示指定总线插槽的设备和功能块信息 |
| -i | 指定PCI编号列表文件,不使用默认文件 |
| -m | 以机器可读方式显示PCI设备信息 |
[root@lhuan ~]# lspci -tv
-[0000:00]-+-00.0 Intel Corporation 440FX - 82441FX PMC [Natoma]
+-01.0 Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
+-01.1 Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
+-01.2 Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II]
+-01.3 Intel Corporation 82371AB/EB/MB PIIX4 ACPI
+-02.0 Cirrus Logic GD 5446
+-03.0 Red Hat, Inc. Virtio network device
+-04.0 Red Hat, Inc. Virtio block device
\-05.0 Red Hat, Inc. Virtio memory balloon
lsusb
常用参数
| 参数 | 说明 |
|---|---|
| -v | 显示USB设备的详细信息 |
| -t | 以数状接口也显示USB设备的层次 |
root@ubuntu:/home/lh# lsusb -t
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
|__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 2: Dev 3, If 0, Class=Hub, Driver=hub/7p, 12M
|__ Port 1: Dev 4, If 0, Class=Wireless, Driver=btusb, 12M
|__ Port 1: Dev 4, If 1, Class=Wireless, Driver=btusb, 12M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
date
查看系统时间
常用参数
| 参数 | 说明 |
|---|---|
| -u | 显示目前的格林威治时间 |
| -v | 显示版本编号 |
[root@lhuan ~]# date
Sat Nov 21 10:10:47 CST 2020
##按自己的格式输出
[root@linuxcool ~]# date '+usr_time: $1:%M %P -hey'
usr_time: $1:16 下午 -hey
### 显示月份与日数:
[root@lhuan ~]# date '+%B %d'
November 21
##显示时间后跳行,再显示目前日期
[root@lhuan ~]# date '+%T%n%D'
10:14:01
11/21/20
cal
用来显示当前日历
[root@lhuan ~]# cal
November 2020
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
常用参数
| 参数 | 说明 |
|---|---|
| -y | 显示当年的日历 |
| -j | 显示当年中的第几天 |
| -s | 将星期天作为月的第一天 |
| -m | 将星期一作为月的第一天 |
| -3 | 显示最近三个月的日历 |
| +年份 | 显示某年的日历 |
##显示当年的日历
[root@lhuan ~]# cal -y
2020
January February March
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 1 2 3 4 5 6 7
5 6 7 8 9 10 11 2 3 4 5 6 7 8 8 9 10 11 12 13 14
12 13 14 15 16 17 18 9 10 11 12 13 14 15 15 16 17 18 19 20 21
19 20 21 22 23 24 25 16 17 18 19 20 21 22 22 23 24 25 26 27 28
26 27 28 29 30 31 23 24 25 26 27 28 29 29 30 31
April May June
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 2 1 2 3 4 5 6
5 6 7 8 9 10 11 3 4 5 6 7 8 9 7 8 9 10 11 12 13
12 13 14 15 16 17 18 10 11 12 13 14 15 16 14 15 16 17 18 19 20
19 20 21 22 23 24 25 17 18 19 20 21 22 23 21 22 23 24 25 26 27
26 27 28 29 30 24 25 26 27 28 29 30 28 29 30
31
July August September
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 1 2 3 4 5
5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12
12 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19
19 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26
26 27 28 29 30 31 23 24 25 26 27 28 29 27 28 29 30
30 31
October November December
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 1 2 3 4 5 6 7 1 2 3 4 5
4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12
11 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19
18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26
25 26 27 28 29 30 31 29 30 27 28 29 30 31
##显示当年中的第几天
[root@lhuan ~]# cal -j
November 2020
Sun Mon Tue Wed Thu Fri Sat
306 307 308 309 310 311 312
313 314 315 316 317 318 319
320 321 322 323 324 325 326
327 328 329 330 331 332 333
334 335
#显示最近三个月的日志
[root@lhuan ~]# cal -3
October 2020 November 2020 December 2020
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 1 2 3 4 5 6 7 1 2 3 4 5
4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12
11 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19
18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26
25 26 27 28 29 30 31 29 30 27 28 29 30 31
##将星期天作为月的第一天
[root@lhuan ~]# cal -s
November 2020
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
##将星期一作为月的第一天
[root@lhuan ~]# cal -m
November 2020
Mo Tu We Th Fr Sa Su
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
#显示1999年的日历
[root@lhuan ~]# cal 1999
1999
January February March
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 1 2 3 4 5 6 1 2 3 4 5 6
3 4 5 6 7 8 9 7 8 9 10 11 12 13 7 8 9 10 11 12 13
10 11 12 13 14 15 16 14 15 16 17 18 19 20 14 15 16 17 18 19 20
17 18 19 20 21 22 23 21 22 23 24 25 26 27 21 22 23 24 25 26 27
24 25 26 27 28 29 30 28 28 29 30 31
31
April May June
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 1 1 2 3 4 5
4 5 6 7 8 9 10 2 3 4 5 6 7 8 6 7 8 9 10 11 12
11 12 13 14 15 16 17 9 10 11 12 13 14 15 13 14 15 16 17 18 19
18 19 20 21 22 23 24 16 17 18 19 20 21 22 20 21 22 23 24 25 26
25 26 27 28 29 30 23 24 25 26 27 28 29 27 28 29 30
30 31
July August September
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 1 2 3 4 5 6 7 1 2 3 4
4 5 6 7 8 9 10 8 9 10 11 12 13 14 5 6 7 8 9 10 11
11 12 13 14 15 16 17 15 16 17 18 19 20 21 12 13 14 15 16 17 18
18 19 20 21 22 23 24 22 23 24 25 26 27 28 19 20 21 22 23 24 25
25 26 27 28 29 30 31 29 30 31 26 27 28 29 30
October November December
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 1 2 3 4 5 6 1 2 3 4
3 4 5 6 7 8 9 7 8 9 10 11 12 13 5 6 7 8 9 10 11
10 11 12 13 14 15 16 14 15 16 17 18 19 20 12 13 14 15 16 17 18
17 18 19 20 21 22 23 21 22 23 24 25 26 27 19 20 21 22 23 24 25
24 25 26 27 28 29 30 28 29 30 26 27 28 29 30 31
31
clear
sync
数据同步写入磁盘,更新信息速度很快。
