1、显示系统中所有进程
ps -ef
运行效果:
[root@redhat-9 ~]# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 19:01 ? 00:00:01 /usr/lib/systemd/systemd rhgb --switched-r
root 2 0 0 19:01 ? 00:00:00 [kthreadd]
root 3 2 0 19:01 ? 00:00:00 [rcu_gp]
root 4 2 0 19:01 ? 00:00:00 [rcu_par_gp]
2、显示你所用机器CPU的利用率,内存利用情况,10秒刷新一次
[root@redhat-9 ~]# top -d 10
top - 17:41:20 up 3:22, 4 users, load average: 0.00, 0.02, 0.07
Tasks: 337 total, 1 running, 336 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.0 sy, 0.0 ni, 99.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 1707.7 total, 73.1 free, 1286.7 used, 513.0 buff/cache
MiB Swap: 4056.0 total, 3801.5 free, 254.5 used. 421.0 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
42709 root 20 0 4112800 123636 51756 S 0.1 7.1 0:04.44 gnome-shell
42842 root 20 0 531112 6188 5908 S 0.1 0.4 0:00.23 goa-identity-se
42937 root 20 0 535128 25744 19144 S 0.1 1.5 0:02.83 vmtoolsd
43033 root 20 0 376140 38164 13708 S 0.1 2.2 0:01.16 rhsm-service
45322 root 20 0 0 0 0 I 0.1 0.0 0:00.78 kworker/2:0-events_power_effic+
45409 root 20 0 226132 4500 3516 R 0.1 0.3 0:00.04 top
1 root 20 0 174852 15768 8140 S 0.0 0.9 0:02.71 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.03 kthreadd
3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_par_gp
5 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 slub_flushwq
6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 netns
8 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0:0H-events_highpri
10 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu_wq
12 root 20 0 0 0 0 I 0.0 0.0 0:00.00 rcu_tasks_kthre
13 root 20 0 0 0 0 I 0.0 0.0 0:00.00 rcu_tasks_rude_
14 root 20 0 0 0 0 I 0.0 0.0 0:00.00 rcu_tasks_trace
15 root 20 0 0 0 0 S 0.0 0.0 0:00.02 ksoftirqd/0
16 root 20 0 0 0 0 S 0.0 0.0 0:00.00 pr/tty0
17 root 20 0 0 0 0 I 0.0 0.0 0:00.19 rcu_preempt
18 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
19 root -51 0 0 0 0 S 0.0 0.0 0:00.00 idle_inject/0
21 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/0
3、挂载你的光盘,实现linux中访问光盘中的内容,写出完整过程
1)开机启动光盘
2)挂载
[root@redhat-9 ~]# mount /dev/sr0 /mnt|media
bash: media: command not found...
mount: /mnt: WARNING: source write-protected, mounted read-only.
并查看光盘文件
[root@redhat-9 ~]# ls /mnt
AppStream EULA images RPM-GPG-KEY-redhat-beta
BaseOS extra_files.json isolinux RPM-GPG-KEY-redhat-release
EFI GPL media.repo
4、显示所有包含其他使用者的进程
[root@redhat-9 ~]# ps -a
PID TTY TIME CMD
1522 tty1 00:00:00 dbus-run-sessio
1523 tty1 00:00:00 dbus-daemon
···
2016 tty1 00:00:00 ibus-x11
2029 tty1 00:00:00 ibus-portal
2049 tty1 00:00:00 ibus-engine-sim
2172 pts/0 00:00:00 ps
5、查看/ etc目录占用的磁盘空间
[root@redhat-9 ~]# df /etc
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/rhel-root 66482176 5189100 61293076 8% /
6、显示当前登录系统的用户
[root@redhat-9 ~]# who
root pts/0 2024-12-01 19:01 (192.168.159.1)
[root@redhat-9 ~]# who am i
root pts/0 2024-12-01 19:01 (192.168.159.1)
[root@redhat-9 ~]# whoami
root