Linux iZbp13wljqcqo06186qf2wZ 5.4.0-47-generic #51-Ubuntu SMP Fri Sep 4 19:50:52 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
#WSL
0b01:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
46ab:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
56aa:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
5fad:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
7fcd:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio console (rev 01)
85b7:00:00.0 System peripheral: Red Hat, Inc. Virtio file system (rev 01)
9fda:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
aec1:00:00.0 3D controller: Microsoft Corporation Device 008e
bc9c:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
be77:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
e2ab:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
e6a8:00:00.0 SCSI storage controller: Red Hat, Inc. Virtio filesystem (rev 01)
f0e3:00:00.0 3D controller: Microsoft Corporation Device 008e
#云服务器
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Communication controller: Red Hat, Inc. Virtio console
00:04.0 SCSI storage controller: Red Hat, Inc. Virtio block device
00:05.0 Ethernet controller: Red Hat, Inc. Virtio network device
00:06.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 252:0 0 60G 0 disk
└─vda1 252:1 0 60G 0 part /
Disk /dev/vda: 60 GiB, 64424509440 bytes, 125829120 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xecf55593
Device Boot Start End Sectors Size Id Type
/dev/vda1 * 2048 125829086 125827039 60G 83 Linux
Filesystem 1K-blocks Used Available Use% Mounted on
udev 1891232 0 1891232 0% /dev
tmpfs 383892 1872 382020 1% /run
/dev/vda1 61795304 12005284 47047524 21% /
tmpfs 1919456 0 1919456 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 1919456 0 1919456 0% /sys/fs/cgroup
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/434f9e483d1ad260541e52951cc951468e1f5d76fef9795e9d97779e6eb83ba1/merged
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/c19c2daafcbd115885a11703bb8824d9e591fff6e61ae957a7c20b8d386f3a1d/merged
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/97912319a9768ae77605bccbd2f2f4d02cf38ac149f12a26272739f37dea4aa9/merged
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/733c5b8d55b43781795dab82e2e6f55e68720a1f82b4b78c1f58d78547ab10a0/merged
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/45d4227904db50e2f6813cd6ff53c03d2b96673fc7ea15a82de69cde33921e30/merged
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/1bf9a94a249c9e780cde02bae8eefc2178586fb4033115e2e1bc9c22f56e9c6d/merged
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/3f90ed3d8e204d1c82a110e2134d471998c23c2dee318eec64fb63ef23fd556b/merged
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/6539ebd24c7cddb3b7d6e9e099732f0d0593480dee41b6dacc042289f7eb874d/merged
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/70909b79a7dc2e7d492302886525194685e4af128c7d3b3c234c624e66b52043/merged
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/2eaeee319ae30b9a4d0dc631c1ab4632475d298969b8ebf9ac7b964818fb0ba2/merged
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/822ac236fb2a79188807f5f6f008f5ec3383603032540f27c5bae1c59ae87a2a/merged
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/a17fc322441fd1e8089dd62e7617e73949913c189b4bd98dfbc457cd085b30e6/merged
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/456bf4c900748da69f4724d9baf7a3f8c3d3d1d01189ced0ae675b472c53d5c6/merged
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/f29bb0c96ffa19a19b0a97f6ab5fe71e8f395a8eea928c6a14edbfddddcdcf0d/merged
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/d98233283c106b28629f3e642dc82422b01e1851484606f024511d4628286675/merged
overlay 61795304 12005284 47047524 21% /var/lib/docker/overlay2/992ae29786c9ee861ffcc865cdb350a99981bbc68fbcd55a7ffd629ec4b89b86/merged
tmpfs 383888 0 383888 0% /run/user/0
#编辑当前用户任务
crontab -e
#查看当前用户创建任务列表
crontab -l
#crontab指定用户创建定时任务
sudo crontab -u root -e
#以其他用户执行脚本
su otheruser -s script.sh
#将xx.sh脚本置于后台执行,关闭终端仍然生效
nohup {/path/{xx.sh}} &
// Tip:systemctl是Linux下的服务管理软件,他与 service命令的语法也稍许不同。
#显示linux所有服务
service --status-all
#重启服务
service {serviceName} restart
#开启服务
service {serviceName} start
#关闭
service {serviceName} stop
//watch命令配合sensors,每隔2s查看cpu温度
sudo apt install lm-sensors
sudo chmod +x {.bundle文件}
dpkg安装不提供依赖检测,使用以下的命令兼容安装,sudo apt-get install -f
/etc/issue
/profile/version
/etc/rc.local
#日志文件crontab(需要手动开启)
/var/log/cron.log
#开启日志
sudo vim /etc/rsyslog.d/50-default.conf
#重启系统日志
sudo service rsyslog restart
...
Linux version 5.4.0-47-generic (buildd@lcy01-amd64-014) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #51-Ubuntu SMP Fri Sep 4 19:50:52 UTC 2020
#仅显示系统版本
cat /etc/issue
cat /etc/lsb-release
cat /etc/os-release
cat /proc/cpuinfo
在这里插入代码片
#376926.04为系统开启的时间,后面的应该是现在的时间(未验证)
cat /proc/uptime
376926.04 734590.12
#服务器启动的时间
date -d “$(awk -F. ‘{print $1}’ /proc/uptime) second ago” +“%Y-%m-%d %H:%M:%S”
2022-11-22 13:20:44
#用户
/etc/passwd
#用户组
/etc/group
#
uid=0(root) gid=0(root) groups=0(root)
WSL没有输出,云服务器有输出,比较有意思,这个问题先放着。。
#云服务器
22:23:26 up 4 days, 9:02, 1 user, load average: 0.01, 0.08, 0.08
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 211.138.116.17 21:35 1.00s 0.10s 0.00s w
#WSL
22:23:49 up 3 min, 0 users, load average: 0.01, 0.02, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
额,云服务器貌似没有交换分区,是没有输出的,我用WSL(ubuntu22.04lts)进行实验
swapon
NAME TYPE SIZE USED PRIO
/dev/sdb partition 2G 0B -2
swapon -s
Filename Type Size Used Priority
/dev/sdb partition 2097152 0 -2
在这里插入代码片
引用:
https://blog.csdn.net/qq_31278903/article/details/83146031