1. 程式人生 > >linux系統管理文件和目錄管理命令測試

linux系統管理文件和目錄管理命令測試

linux 簡單 命令

  1. 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

  1. 2. /etc/passwd文件復制到/root/passwd文件。

[root@xuexi ~]# cp /etc/passwd /root/passwd /etc/passwd文件復制到/root/passwd文件

cp: overwrite `/root/passwd‘? y

  1. 3. 使用一條命令創建一個/test目錄、並使該目錄下有/test/user1/test/user2兩個子目錄。

[root@xuexi ~]# mkdir -p /test/{user1,user2}

[root@xuexi /]# tree /test

/test

├── user1

└── user2

  1. 4. /etc目錄復制到/tmp目錄下、並保持原有權限。

[root@xuexi /]# cp -frp /etc /tmp/

[root@xuexi /]# ls /tmp/

etc

  1. 5. /root目錄下創建空文件file1file2file3,使用一條命令完成。

[root@xuexi /]# touch /root/{file1,file2,file3}

[root@xuexi /]# ls /root/|grep file

file1

file2

file3

  1. 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

  1. 7. 使用findwc命令結合管道符,統計當前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

  1. 8. 查找 /boot 目錄中 大小超過 1024KB 且 名稱以“vmlinuz”開頭的文件

[root@xuexi /]# find /boot/ -size +1024 -name"vmlinuz*"

/boot/vmlinuz-2.6.32-431.el6.x86_64

  1. 9. 如何查看內核的版本

[root@xuexi /]# uname -r

2.6.32-431.el6.x86_64

  1. 10. 在centos 6.5中,如何表示第三塊SCSI硬盤的第2個邏輯分區

答:sdc6

  1. 11. 如何關閉或重啟centos 6.5

答:關機:halt,poweroff,shutdown -h now

重啟:reboot,shutdown -r now


本文出自 “Linux” 博客,轉載請與作者聯系!

linux系統管理文件和目錄管理命令測試