您的位置:首页 > 运维架构 > Linux

linux系统管理文件和目录管理命令测试

2017-10-29 18:57 295 查看
1. 查看系统中cpu及内存的信息。

[root@xuexi ~]# cat /proc/cpuinfo (查看cpu)
processor : 0
vendor_id :GenuineIntel
cpu family : 6
model : 142
model name :Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
stepping : 9
cpu MHz :2712.000
cache size : 3072KB
fpu : yes
fpu_exception :yes
cpuid level : 22
wp : yes
flags : fpuvme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dtsmmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc up arch_perfmonpebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pnipclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnttsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm3dnowprefetch ida arat epb xsaveopt pln pts dts fsgsbase bmi1 avx2 smep bmi2invpcid
bogomips :5424.00
clflush size : 64
cache_alignment : 64
address sizes : 42bits physical, 48 bits virtual
power management:

[root@xuexi ~]# cat /proc/meminfo (查看内存)
MemTotal: 1004412 kB
MemFree: 904152 kB
Buffers: 9844 kB
Cached: 28600 kB
SwapCached: 0 kB
Active: 19440 kB
Inactive: 27952 kB
Active(anon): 8976 kB
Inactive(anon): 196 kB
Active(file): 10464 kB
Inactive(file): 27756 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 1023992 kB
SwapFree: 1023992 kB
Dirty: 56 kB
Writeback: 0 kB
AnonPages: 8964 kB
Mapped: 6176 kB
Shmem: 224 kB
Slab: 30892 kB
SReclaimable: 8848 kB
SUnreclaim: 22044 kB
KernelStack: 592 kB
PageTables: 1744 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 1526196 kB
Committed_AS: 52656 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 153184 kB
VmallocChunk: 34359579312 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 6144 kB
DirectMap2M: 1042432 kB
DirectMap1G: 0 kB

2. 将/etc/passwd文件复制到/root/passwd文件。

[root@xuexi ~]# cp /etc/passwd /root/passwd (将/etc/passwd文件复制到/root/passwd文件)
cp: overwrite `/root/passwd'? y

3. 使用一条命令创建一个/test目录、并使该目录下有/test/user1、/test/user2两个子目录。

[root@xuexi ~]# mkdir -p /test/{user1,user2}
[root@xuexi /]# tree /test
/test
├── user1
└── user2
4. 将/etc目录复制到/tmp目录下、并保持原有权限。

[root@xuexi /]# cp -frp /etc /tmp/
[root@xuexi /]# ls /tmp/
etc
5. 在/root目录下创建空文件file1、file2、file3,使用一条命令完成。

[root@xuexi /]# touch /root/{file1,file2,file3}
[root@xuexi /]# ls /root/|grep file
file1
file2
file3

6. 查找/root目录下以file开头的文件、并删除它们。用一条命令完成。

[root@xuexi /]# find /root/ -type f -name"file*"|xargs rm -f
[root@xuexi /]# ls /root/|grep file
[root@xuexi /]# ls /root/
a b install.log zhou2
anaconda-ks.cfg c.txt install.log.syslog passwd zhou3
a.txt eet.txt zhou4

7. 使用find、wc命令结合管道符,统计当前linux系统中共包含多少个目录。

[root@xuexi /]# find / -type d|wc -l
find: `/proc/2700/task/2700/fd/5': No such file ordirectory
find: `/proc/2700/task/2700/fdinfo/5': No such file ordirectory
find: `/proc/2700/fd/5': No such file or directory
find: `/proc/2700/fdinfo/5': No such file or directory
11636
8. 查找 /boot 目录中 大小超过 1024KB 且 名称以“vmlinuz”开头的文件

[root@xuexi /]# find /boot/ -size +1024 -name"vmlinuz*"
/boot/vmlinuz-2.6.32-431.el6.x86_64
9. 如何查看内核的版本

[root@xuexi /]# uname -r
2.6.32-431.el6.x86_64
10. 在centos 6.5中,如何表示第三块SCSI硬盘的第2个逻辑分区

答:sdc6
11. 如何关闭或重启centos 6.5

答:关机:halt,poweroff,shutdown -h now
重启:reboot,shutdown -r now
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  命令 linux 简单