Linux之系统管理
进程管理
一 进程查看
二 终止进程
二 工作管理
[root@localhost ~]# tar -zcf root.tar.gz / & #将此放入后台 执行 [1] 2676 [root@localhost ~]# tar: Removing leading `/' from member names [root@localhost ~]# top #将 top,Ctrl+z放入后台 暂停 top - 09:33:20 up 3:12, 2 users, load average: 0.37, 0.22, Tasks: 96 total, 2 running, 94 sleeping, 0 stopped, 0 %Cpu(s): 42.9 us, 57.1 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi ...... [root@localhost ~]# vi #将 vi,Ctrl+z放入后台 暂停 [3]+ Stopped vi #查看 [root@localhost ~]# jobs -l [1] 2676 Running tar -zcf root.tar.gz / & #运行状态 [2]- 2686 Stopped (signal) top #暂停状态 [3]+ 2717 Stopped vi #暂停状态
[root@localhost ~]# vi a.txt [1]+ Stopped vi a.txt [root@localhost ~]# jobs -l [1]+ 3544 Stopped vi a.txt [root@localhost ~]# bg 1 [1]+ vi a.txt & [root@localhost ~]# jobs -l [1]+ 3544 Stopped (tty output) vi a.txt [root@localhost ~]# #打包压缩,这些可以在 后台运行。而像 vi ,top 就不可以,只会让其在后台暂停
三 系统资源其它查看
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
[root@localhost ~]# dmesg | grep CPU [ 0.000000] smpboot: Allowing 128 CPUs, 127 hotplug CPUs [ 0.000000] setup_percpu: NR_CPUS:5120 nr_cpumask_bits:128 nr_cpu_ids:128 nr_node_ids:1 [ 0.000000] PERCPU: Embedded 35 pages/cpu @ffff88003c600000 s104536 r8192 d30632 u262144 [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=128, Nodes=1 [ 0.000000] RCU restricting CPUs from NR_CPUS=5120 to nr_cpu_ids=128. [ 0.003354] CPU: Physical Processor ID: 0 [ 0.005274] mce: CPU supports 0 MCE banks [ 0.135250] smpboot: CPU0: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz (fam: 06, model: 4e, stepping: 03) [ 0.135361] core: CPUID marked event: 'cpu cycles' unavailable [ 0.135364] core: CPUID marked event: 'instructions' unavailable [ 0.135366] core: CPUID marked event: 'bus cycles' unavailable [ 0.135368] core: CPUID marked event: 'cache references' unavailable [ 0.135369] core: CPUID marked event: 'cache misses' unavailable [ 0.135371] core: CPUID marked event: 'branch instructions' unavailable [ 0.135373] core: CPUID marked event: 'branch misses' unavailable [ 0.148515] Brought up 1 CPUs [ 1.174575] microcode: CPU0 sig=0x406e3, pf=0x1, revision=0xba [root@localhost ~]# cat /proc/cpuinfo #断电信息会消失,开启会自动收集 processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 78 model name : Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz stepping : 3 microcode : 0xba cpu MHz : 2400.000 cache size : 3072 KB physical id : 0 siblings : 1 core id : 0 cpu cores : 1 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 22 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf 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 epb invpcid_single fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap xsaveopt dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp bogomips : 4800.00 clflush size : 64 cache_alignment : 64 address sizes : 42 bits physical, 48 bits virtual power management:
## 查看Linux发行版本 [root@localhost ~]# cat /etc/centos-release CentOS Linux release 7.4.1708 (Core)
四 系统定时任务
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
CentOS5 开启 /sbin/service crond start 停止 /sbin/service crond stop 重启 /sbin/service crond restart 重载 /sbin/service crond reload 状态 /sbin/service crond status CentOS7 开启 /bin/systemctl start crond.service 停止 /bin/systemctl stop crond.service 重启 /bin/systemctl restart crond.service 重载 /bin/systemctl reload crond.service 状态 /bin/systemctl status crond.service 常用命令 列表 crontab -l 新建 crontab -e
# ---- 例子
[root@localhost ~]# crontab -e no crontab for root - using an empty one crontab: installing new crontab [root@localhost ~]# cat /tmp/test 123 [root@localhost ~]# crontab -l * * * * * echo 123 >> /tmp/test [root@localhost ~]# [root@localhost ~]# crontab -r #全部删除 [root@localhost ~]# [root@localhost ~]# crontab -l no crontab for root