`
qindongliang1922
  • 浏览: 2171289 次
  • 性别: Icon_minigender_1
  • 来自: 北京
博客专栏
7265517b-f87e-3137-b62c-5c6e30e26109
证道Lucene4
浏览量:117081
097be4a0-491e-39c0-89ff-3456fadf8262
证道Hadoop
浏览量:125424
41c37529-f6d8-32e4-8563-3b42b2712a50
证道shell编程
浏览量:59496
43832365-bc15-3f5d-b3cd-c9161722a70c
ELK修真
浏览量:71017
社区版块
存档分类
最新评论

shell脚本杂记(五)

阅读更多
1,找出多个文件所占用的磁盘空间 du  f1 f2
[root@master hadoopsys]# du hosts pub.sh 
4       hosts
4       pub.sh
[root@master hadoopsys]# 

默认以字节为单位
显示每个目录的大小du -a dir
[root@master hadoopsys]# du -a hadoopconf/
8       hadoopconf/mapred-queues.xml.template
4       hadoopconf/httpfs-signature.secret
4       hadoopconf/httpfs-env.sh
4       hadoopconf/mapred-env.sh
4       hadoopconf/mapred-site.xml
4       hadoopconf/core-site.xml
4       hadoopconf/yarn-site.xml
4       hadoopconf/yarn-env.sh
4       hadoopconf/hadoop-env.cmd
4       hadoopconf/hadoop-metrics2.properties
4       hadoopconf/mapred-env.cmd
4       hadoopconf/hdfs-site.xml
4       hadoopconf/hadoop-metrics.properties
4       hadoopconf/configuration.xsl
4       hadoopconf/container-executor.cfg
4       hadoopconf/httpfs-site.xml
4       hadoopconf/slaves
12      hadoopconf/log4j.properties
4       hadoopconf/capacity-scheduler.xml
4       hadoopconf/hadoop-env.sh
4       hadoopconf/httpfs-log4j.properties
12      hadoopconf/hadoop-policy.xml
4       hadoopconf/ssl-client.xml.example
4       hadoopconf/ssl-server.xml.example
4       hadoopconf/yarn-env.cmd
124     hadoopconf/
[root@master hadoopsys]# 

单独执行du dir
[root@master hadoopsys]# du hadoopconf/
124     hadoopconf/
[root@master hadoopsys]# 

如果想采用更好的方式显示,可以使用du -h dir
还可以使用du -c来计算所有文件或目录总共占了多少磁盘空间:
[root@master hadoopsys]# du -c pub.sh 
4       pub.sh
4       总用量
[root@master hadoopsys]# 

除此之外,统计还支持过滤:
[root@master hadoopsys]# du -c *.sh
4       begin.sh
4       pub.sh
4       repack.sh
12      总用量
[root@master hadoopsys]# 


通常我们使用du -sh *来显示当前目录相下,文件大小情况:
[root@master hadoopsys]# du -sch *
5.4M    apache-ant-1.9.4-bin.tar.gz
52M     apache-hive-0.13.1-bin.tar.gz
5.0M    apache-maven-3.0.5-bin.tar.gz
4.0K    begin.sh
8.0K    etc
92M     hadoop-2.2.0.tar.gz
124K    hadoopconf
76M     hbase-0.96.2-hadoop2-bin.tar.gz
36K     hbaseconf
4.0K    hosts
92M     jdk-7u25-linux-x64.gz
4.0K    pub.sh
4.0K    repack.sh
16K     zkconf
16M     zookeeper-3.4.5.tar.gz
338M    总用量
[root@master hadoopsys]# 


排除部分文件:
[root@master hadoopsys]# du    --exclude "*.sh"  ./   
4       ./etc
108     ./hadoopconf
28      ./hbaseconf
16      ./zkconf
345132  ./
[root@master hadoopsys]# 


指定深度,统计
du --ma-depth 2 dir
df -h 查看磁盘信息
[root@master hadoopsys]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       9.7G  2.3G  6.9G  25% /
tmpfs           495M     0  495M   0% /dev/shm
/dev/sda1       194M   28M  157M  15% /boot
/dev/sda3       9.9G  889M  8.6G  10% /home
[root@master hadoopsys]#


2,time命令,统计命令脚本耗时
[root@master hadoopsys]# time ls
apache-ant-1.9.4-bin.tar.gz    begin.sh             hadoopconf                       hosts                  repack.sh
apache-hive-0.13.1-bin.tar.gz  etc                  hbase-0.96.2-hadoop2-bin.tar.gz  jdk-7u25-linux-x64.gz  zkconf
apache-maven-3.0.5-bin.tar.gz  hadoop-2.2.0.tar.gz  hbaseconf                        pub.sh                 zookeeper-3.4.5.tar.gz

real    0m0.004s
user    0m0.001s
sys     0m0.003s


3,收集与当前登录用户,启动日志,和启动故障相关的信息
who ,w ,users ,uptime ,last .lastb
[root@master hadoopsys]# who
root     pts/0        2014-09-23 01:48 (192.168.46.24)
root     pts/1        2014-09-23 01:13 (192.168.46.24)
[root@master hadoopsys]# 
[root@master hadoopsys]# 
[root@master hadoopsys]# 
[root@master hadoopsys]# 
[root@master hadoopsys]# w
 03:08:48 up  4:59,  2 users,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    192.168.46.24    01:48    0.00s  0.13s  0.00s w
root     pts/1    192.168.46.24    01:13   37:06   0.03s  0.03s -bash
[root@master hadoopsys]# 
[root@master hadoopsys]# 
[root@master hadoopsys]# 
[root@master hadoopsys]# 
[root@master hadoopsys]# users 
root root
[root@master hadoopsys]# 
[root@master hadoopsys]# 
[root@master hadoopsys]# 
[root@master hadoopsys]# 
[root@master hadoopsys]# uptime 
 03:08:57 up  4:59,  2 users,  load average: 0.00, 0.00, 0.00
[root@master hadoopsys]# 
[root@master hadoopsys]# 
[root@master hadoopsys]# 
[root@master hadoopsys]# 
[root@master hadoopsys]# last
root     pts/0        192.168.46.24    Tue Sep 23 01:48   still logged in   
root     pts/0        192.168.46.24    Tue Sep 23 01:30 - 01:48  (00:17)    
root     pts/0        192.168.46.24    Tue Sep 23 01:17 - 01:30  (00:13)    
root     pts/0        192.168.46.24    Tue Sep 23 01:17 - 01:17  (00:00)    
root     pts/0        192.168.46.24    Tue Sep 23 01:16 - 01:17  (00:00)    
root     pts/1        192.168.46.24    Tue Sep 23 01:13   still logged in   
root     pts/0        192.168.46.24    Tue Sep 23 01:00 - 01:16  (00:15)    
root     pts/0        192.168.46.24    Tue Sep 23 00:59 - 01:00  (00:00)    
dong     pts/1        zk1              Mon Sep 22 22:34 - 22:35  (00:00)    
root     pts/0        192.168.46.24    Mon Sep 22 22:16 - 23:38  (01:21)    
root     tty1                          Mon Sep 22 22:10 - 23:10  (01:00)    
reboot   system boot  2.6.32-431.el6.x Mon Sep 22 22:09 - 03:09  (04:59)    
root     pts/0        192.168.46.19    Wed Jun 11 00:12 - crash (103+21:56) 
root     tty1                          Wed Jun 11 00:12 - crash (103+21:57) 
reboot   system boot  2.6.32-431.el6.x Wed Jun 11 00:12 - 03:09 (104+02:56) 
root     pts/3        192.168.46.16    Fri May 30 17:19 - crash (11+06:53)  
root     pts/2        192.168.46.16    Fri May 30 17:01 - crash (11+07:10)  
root     pts/3        192.168.46.16    Fri May 30 16:19 - 17:19  (01:00)    
root     pts/2        192.168.46.16    Fri May 30 16:01 - 17:01  (01:00)    
root     pts/3        192.168.46.16    Fri May 30 15:19 - 16:19  (01:00)    
root     pts/2        192.168.46.16    Fri May 30 15:01 - 16:01  (01:00)    
root     pts/3        192.168.46.16    Fri May 30 14:19 - 15:19  (01:00)    
root     pts/2        192.168.46.16    Fri May 30 14:01 - 15:01  (01:00)    
root     pts/3        192.168.46.16    Fri May 30 13:18 - 14:18  (01:00)    
root     pts/2        192.168.46.16    Fri May 30 13:01 - 14:01  (01:00)    
root     pts/3        192.168.46.16    Fri May 30 12:18 - 13:18  (01:00)    
root     pts/2        192.168.46.16    Fri May 30 12:01 - 13:01  (01:00)    
root     pts/3        192.168.46.16    Fri May 30 11:18 - 12:18  (01:00)    
root     pts/2        192.168.46.16    Fri May 30 11:01 - 12:01  (01:00)    
root     pts/3        192.168.46.16    Fri May 30 10:18 - 11:18  (01:00)    
root     pts/2        192.168.46.16    Fri May 30 10:01 - 11:01  (01:00)    
root     pts/3        192.168.46.16    Fri May 30 09:18 - 10:18  (01:00)    
root     pts/2        192.168.46.16    Fri May 30 09:01 - 10:01  (01:00)    
root     pts/3        192.168.46.16    Fri May 30 08:18 - 09:18  (01:00)    
root     pts/2        192.168.46.16    Fri May 30 08:01 - 09:01  (01:00)    
root     pts/3        192.168.46.16    Fri May 30 07:18 - 08:18  (01:00)    
root     pts/2        192.168.46.16    Fri May 30 07:01 - 08:01  (01:00)    
root     pts/3        192.168.46.16    Fri May 30 06:18 - 07:18  (01:00)    
root     pts/2        192.168.46.16    Fri May 30 06:01 - 07:01  (01:00)    
root     pts/2        192.168.46.16    Fri May 30 04:26 - 06:00  (01:34)    
root     pts/1        192.168.46.16    Fri May 30 04:00 - crash (11+20:11)  
root     tty1                          Fri May 30 03:59 - 04:59  (01:00)    
root     pts/0        192.168.46.16    Fri May 30 03:52 - 06:18  (02:26)    
root     pts/0        192.168.46.16    Thu May 29 18:34 - 03:48  (09:13)    
reboot   system boot  2.6.32-431.el6.x Thu May 29 18:33 - 03:09 (116+08:35) 
root     pts/3        192.168.46.16    Thu May 29 06:01 - crash  (12:31)    
root     pts/2        192.168.46.16    Thu May 29 05:56 - crash  (12:37)    
root     pts/1        192.168.46.16    Thu May 29 05:56 - crash  (12:37)    
root     pts/0        192.168.46.16    Thu May 29 05:55 - crash  (12:38)    
reboot   system boot  2.6.32-431.el6.x Thu May 29 05:54 - 03:09 (116+21:14) 
root     pts/6        192.168.46.16    Thu May 29 05:48 - down   (00:05)    
root     pts/5        192.168.46.16    Thu May 29 05:46 - down   (00:07)    
root     pts/5        192.168.46.16    Thu May 29 05:46 - 05:46  (00:00)    
root     pts/5        192.168.46.16    Thu May 29 05:41 - 05:46  (00:04)    
root     pts/3        192.168.46.16    Thu May 29 05:39 - down   (00:14)    
root     pts/2        192.168.46.16    Thu May 29 05:38 - down   (00:15)    
root     pts/2        192.168.46.16    Thu May 29 05:37 - 05:38  (00:00)    
root     pts/1        192.168.46.16    Thu May 29 05:37 - down   (00:16)    
root     pts/0        192.168.46.18    Thu May 29 04:43 - down   (01:10)    
root     pts/5        192.168.46.18    Thu May 29 03:42 - 04:43  (01:00)    
(00:03)    
root     pts/4        master           Fri Mar  7 01:16 - down   (00:13)    
root     pts/3        192.168.211.253  Fri Mar  7 01:05 - down   (00:25)    
root     pts/2        localhost        Fri Mar  7 01:04 - down   (00:25)    
root     pts/1        localhost        Fri Mar  7 01:04 - down   (00:25)    
root     pts/0        192.168.211.36   Thu Mar  6 22:46 - down   (02:43)    
root     tty1                          Thu Mar  6 22:46 - down   (02:44)    
reboot   system boot  2.6.32-431.el6.x Thu Mar  6 22:45 - 01:30  (02:44)    
root     tty1                          Thu Mar  6 22:32 - crash  (00:12)    
reboot   system boot  2.6.32-431.el6.x Thu Mar  6 22:32 - 01:30  (02:58)    
root     tty1                          Thu Mar  6 22:05 - crash  (00:26)    
reboot   system boot  2.6.32-431.el6.x Thu Mar  6 22:04 - 01:30  (03:25)    
root     tty1                          Thu Mar  6 21:58 - down   (00:06)    
reboot   system boot  2.6.32-431.el6.x Thu Mar  6 21:58 - 22:04  (00:06)    
root     tty1                          Thu Mar  6 21:53 - crash  (00:04)    
reboot   system boot  2.6.32-431.el6.x Thu Mar  6 21:52 - 22:04  (00:11)    
root     tty1                          Thu Mar  6 21:50 - crash  (00:02)    
reboot   system boot  2.6.32-431.el6.x Thu Mar  6 21:49 - 22:04  (00:14)    

wtmp begins Thu Mar  6 21:49:33 2014
[root@master hadoopsys]# 
[root@master hadoopsys]# 
[root@master hadoopsys]# 
[root@master hadoopsys]# lastb
root     ssh:notty    192.168.46.18    Thu May 29 03:35 - 03:35  (00:00)    
root     ssh:notty    192.168.75.1     Thu May 29 02:03 - 02:03  (00:00)    
root     ssh:notty    192.168.75.1     Thu May 29 02:03 - 02:03  (00:00)    

btmp begins Thu May 29 02:0


last USER获取最后登录的用户
last reboot最后重启会话信息
lastb 获取失败用户登录会话信息



3,使用watch命令,监控目录情况

[root@master hadoopsys]# watch 'ls -l  | grep "^d" '  
Every 2.0s: ls -l  | grep "^d"                                                                                                                          Tue Sep 23 03:15:59 2014

drwxr-xr-x 2 root root     4096 9月  23 01:02 etc
drwxr-xr-x 2 root root     4096 9月  22 16:58 hadoopconf
drwxr-xr-x 2 root root     4096 9月  22 16:58 hbaseconf
drwxr-xr-x 2 root root     4096 9月  22 16:58 zkconf



默认是2秒,我们也可以指定时间
[root@master hadoopsys]# watch -n 4 'ls -l'
Every 4.0s: ls -l                                                                                                                                       Tue Sep 23 03:18:04 2014

总用量 344992
-rw-r--r-- 1 root root  5564593 6月   9 16:00 apache-ant-1.9.4-bin.tar.gz
-rw-r--r-- 1 root root 54246778 7月  24 17:22 apache-hive-0.13.1-bin.tar.gz
-rw-r--r-- 1 root root  5144659 7月  10 12:50 apache-maven-3.0.5-bin.tar.gz
-rw-r--r-- 1 root root     3693 9月  23 02:18 begin.sh
drwxr-xr-x 2 root root     4096 9月  23 01:02 etc
-rw-r--r-- 1 root root 96183833 6月   9 17:27 hadoop-2.2.0.tar.gz
drwxr-xr-x 2 root root     4096 9月  22 16:58 hadoopconf
-rw-r--r-- 1 root root 79367504 7月  14 10:55 hbase-0.96.2-hadoop2-bin.tar.gz
drwxr-xr-x 2 root root     4096 9月  22 16:58 hbaseconf
-rw-r--r-- 1 root root       42 9月  23 02:07 hosts
-rw-r--r-- 1 root root 96316511 11月 20 2013 jdk-7u25-linux-x64.gz
-rw-r--r-- 1 root root      235 9月  23 02:30 pub.sh
-rw-r--r-- 1 root root       95 9月  23 02:18 repack.sh
drwxr-xr-x 2 root root     4096 9月  22 16:58 zkconf
-rw-r--r-- 1 root root 16402010 6月  12 13:54 zookeeper-3.4.5.tar.gz

突出差异,watch -d 'cmd'
4,使用logrotate来管理日志文件,可以像JAVA里面的log4j一样,滚动生成日志文件,

logrorate的配置目录在/et/logrotate.d里面
我们可以定义一个日志如下所示:
/var/log/yum.log {
    missingok
    notifempty
    size 30k
    yearly
    create 0600 root root
}


下面看下如何向系统日志文件,写入日志信息:
[root@master logrotate.d]# logger  LOG_MESSAGE
[root@master logrotate.d]# logger  你好啊 
[root@master logrotate.d]# tail -n 1 /var/log/messages
Sep 23 03:25:17 master root: 你好啊
[root@master logrotate.d]# 


加一个特定的标记:
[root@master logrotate.d]# logger  -t "==>" 我我我我
[root@master logrotate.d]# tail -n 1 /var/log/messages
Sep 23 03:27:22 master ==>: 我我我我
[root@master logrotate.d]# 


5,查看电源测量:
安装yum install powertop
PowerTOP 2.3      Overview   Idle stats   Frequency stats   Device stats   Tunables                                     

Summary: 5.9 wakeups/second,  0.0 GPU ops/seconds, 0.0 VFS ops/sec and 5.9% CPU use

                Usage       Events/s    Category       Description
             44.7 ms/s      0.00        Process        [khugepaged]
              8.0 ms/s       1.0        Process        powertop
              1.8 ms/s       2.0        Process        [events/0]
              3.1 ms/s       1.0        Process        [kswapd0]
             10.3 µs/s       1.0        Process        [vmmemctl]
              5.5 µs/s       1.0        Process        [flush-8:0]
            464.4 µs/s      0.00        Timer          rh_timer_func
            216.5 µs/s      0.00        Timer          tick_sched_timer
            187.0 µs/s      0.00        Process        sshd: root@pts/0
            137.0 µs/s      0.00        Interrupt      [9] RCU(softirq)
             94.6 µs/s      0.00        Interrupt      [3] net_rx(softirq)
             93.3 µs/s      0.00        Interrupt      [19] eth0
             25.5 µs/s      0.00        Timer          delayed_work_timer_fn
             24.7 µs/s      0.00        Interrupt      [1] timer(softirq)
             22.6 µs/s      0.00        Process        [mpt_poll_0]
             16.8 µs/s      0.00        Timer          hrtimer_wakeup
             16.4 µs/s      0.00        Timer          process_timeout
              9.8 µs/s      0.00        Process        [ksoftirqd/0]
              2.6 µs/s      0.00        Timer          ipmi_timeout
              2.6 µs/s      0.00        Timer          tcp_write_timer









6,监控磁盘的io
使用iotop
iotop -o 显示正在进行的io活动的进程
iotop -b -n 2打印两次统计数据
iotop -p pid 显示需要监视的pid进程的io情况

7,检查磁盘及文件系统错误
fsck /dev/sdb3检查指定的路径
fsck -A 检查所有的文件系统
fsck -a /dev/sda2 自动修复错误
fsck -AN 模拟fsck执行的操作

8,which命令查找某个命令的位置:
[root@master ~]# which  java
/usr/local/jdk/bin/java
[root@master ~]#

9,whereis 命令找出源码的路径,如果有的话:
[root@master ~]# whereis java
java: /etc/java /usr/lib/java /usr/share/java
[root@master ~]# 



10,file命令,来确定文件类型:
[root@master ~]# file bb.sh 
bb.sh: UTF-8 Unicode text
[root@master ~]# 



11,whatis 输出简短的描述信息:
12,kill命令
列出所有信号:
[root@master ~]# kill -l
 1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL       5) SIGTRAP
 6) SIGABRT      7) SIGBUS       8) SIGFPE       9) SIGKILL     10) SIGUSR1
11) SIGSEGV     12) SIGUSR2     13) SIGPIPE     14) SIGALRM     15) SIGTERM
16) SIGSTKFLT   17) SIGCHLD     18) SIGCONT     19) SIGSTOP     20) SIGTSTP
21) SIGTTIN     22) SIGTTOU     23) SIGURG      24) SIGXCPU     25) SIGXFSZ
26) SIGVTALRM   27) SIGPROF     28) SIGWINCH    29) SIGIO       30) SIGPWR
31) SIGSYS      34) SIGRTMIN    35) SIGRTMIN+1  36) SIGRTMIN+2  37) SIGRTMIN+3
38) SIGRTMIN+4  39) SIGRTMIN+5  40) SIGRTMIN+6  41) SIGRTMIN+7  42) SIGRTMIN+8
43) SIGRTMIN+9  44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13
48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12
53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9  56) SIGRTMAX-8  57) SIGRTMAX-7
58) SIGRTMAX-6  59) SIGRTMAX-5  60) SIGRTMAX-4  61) SIGRTMAX-3  62) SIGRTMAX-2
63) SIGRTMAX-1  64) SIGRTMAX
[root@master ~]# 


kill 9 pid 最常用的终止进程命令
killall 进程名,终止一组相关的进程


13,trap命令,可以捕捉信号,并执行新的命令
14,wall命令,同一个终端广播信息,mesg y 或者mesg n可以禁止或允许写入信息
15,采集系统信息:
[root@master ~]# hostname
master
[root@master ~]# uname -n
master
[root@master ~]# unmae -a
-bash: unmae: command not found
[root@master ~]# uname -a
Linux master 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@master ~]# uname -r
2.6.32-431.el6.x86_64
[root@master ~]# uname -m
x86_64
[root@master ~]# cat /proc/cpuinfo 
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 58
model name      : Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz
stepping        : 9
cpu MHz         : 3192.789
cache size      : 6144 KB
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
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 rdtscp lm constant_tsc up arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt aes xsave avx f16c rdrand hypervisor lahf_lm ida arat epb xsaveopt pln pts dts fsgsbase smep
bogomips        : 6385.57
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

[root@master ~]# cat /proc/meminfo 
MemTotal:        1012352 kB
MemFree:          242180 kB
Buffers:           19320 kB
Cached:           670172 kB
SwapCached:            0 kB
Active:           360848 kB
Inactive:         335756 kB
Active(anon):       7124 kB
Inactive(anon):      212 kB
Active(file):     353724 kB
Inactive(file):   335544 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                16 kB
Writeback:             0 kB
AnonPages:          7128 kB
Mapped:             5132 kB
Shmem:               224 kB
Slab:              57144 kB
SReclaimable:      35492 kB
SUnreclaim:        21652 kB
KernelStack:         592 kB
PageTables:         1308 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      506176 kB
Committed_AS:      48544 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      144700 kB
VmallocChunk:   34359588136 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:        8192 kB
DirectMap2M:     1040384 kB
[root@master ~]# cat /proc/partitions 
major minor  #blocks  name

   8        0   20971520 sda
   8        1     204800 sda1
   8        2   10240000 sda2
   8        3   10525696 sda3
[root@master ~]# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000791d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          26      204800   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              26        1301    10240000   83  Linux
/dev/sda3            1301        2611    10525696   83  Linux
[root@master ~]# lshw
-bash: lshw: command not found
[root@master ~]# ls
ls        lsattr    lsblk     lscpu     lsinitrd  lsmod     
[root@master ~]# ls
ls        lsattr    lsblk     lscpu     lsinitrd  lsmod     
[root@master ~]# lscpu 
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                1
On-line CPU(s) list:   0
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 58
Stepping:              9
CPU MHz:               3192.789
BogoMIPS:              6385.57
Hypervisor vendor:     VMware
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              6144K
NUMA node0 CPU(s):     0
[root@master ~]#



1
1
分享到:
评论

相关推荐

    LinuxShell脚本学习基础视频

    资源名称:Linux Shell脚本学习基础视频资源目录:【】11a00d99b60c4e2eba3440b8aa3a6bdd【】linux_shell脚本编程_01认识shell,如何编写shell脚本和执行【】linux_shell脚本编程_02vivim简单的常用操作【】linux_...

    109个shell脚本合集.pdf

    Shell脚本合集 Shell脚本是一种脚本语言,利用Shell的命令解释的功能,对一个纯文本的文件进行解析,然后执行这些功能。 Shell脚本可以直接使用在Windows、Unix、Linux上面,并且可以调用大量系统内部的功能来解释...

    shell脚本编程100例

    shell脚本编程100例 Shell脚本编程是一种强大的编程语言,广泛应用于Linux和Unix操作系统中。本书《shell脚本编程100例》为读者提供了100个实战性的shell脚本编程实例,涵盖了检测网段主机状态、猜数字游戏、打印...

    IDEA中编写并运行shell脚本的实现

    IDEA中编写并运行shell脚本的实现 IDEA中编写并运行shell脚本的实现是指在Integrated Development Environment(IDE)中编写、配置和运行shell脚本的过程。该过程需要安装bashsupport插件,配置插件,安装git软件,...

    shell脚本写的加密脚本

    在IT领域,Shell脚本是Linux和Unix操作系统中不可或缺的一部分,它是一种强大的自动化工具,能够帮助用户执行一系列命令,简化日常任务。通过编写Shell脚本,你可以实现对系统的自动化管理,例如文件操作、数据处理...

    Shell脚本中获取进程ID的方法

    我该如何在shell脚本中得到PID。 当我在执行shell脚本时,它会启动一个叫子shell的进程。作为主shell的子进程,子shell将shell脚本中的命令作为批处理运行(因此称为“批处理进程”)。 在某些情况下,你也许想要...

    Shell脚本编程100例

    Shell脚本编程是Linux系统管理中的重要技能,它允许用户自动化执行一系列命令,大大提高工作效率。以下是一些关于Shell脚本编程的关键知识点: 1. **Hello World脚本**:这是所有编程语言的基础,用于验证环境设置...

    Shell脚本学习教程PDF版

    Shell脚本,作为Linux/Unix系统中的编程工具,是一种强大的自动化任务执行手段。它基于Bourne shell或者其扩展版本,如bash(Bourne-Again SHell),提供了一种编写简单或复杂程序的方式,使得用户能够通过命令行...

    android系统中调用shell脚本

    在Android系统中,由于安全性和权限的限制,直接调用shell脚本并不像在Linux或Unix环境下那样简单。然而,对于非root用户来说,确实有一些方法可以实现对shell脚本的调用,尤其是在开发和调试过程中。下面我们将深入...

    shell脚本与Makefile区别.docx

    "shell脚本与Makefile区别" shell 脚本和 Makefile 是两个不同的工具,它们都用于自动化构建和编译过程,但是它们有很大的不同之处。本文将详细介绍 shell 脚本和 Makefile 的区别。 首先,shell 脚本和 Makefile ...

    C语言中文网shell脚本教程

    **C语言中文网shell脚本教程** 这是一份关于Shell脚本编程的离线学习资料,包含了一系列HTML文件,旨在帮助用户深入理解并掌握Linux Shell脚本编程技术。以下是其中涉及的一些关键知识点: 1. **Shell命令的本质**...

    如何让Android系统或Android应用执行shell脚本

    Android 系统或 Android 应用执行 shell 脚本的方法 Android 系统或 Android 应用执行 shell 脚本是 Android 开发中的一项重要技术,通过执行 shell 脚本,可以实现一些复杂的操作,例如设置网络参数、启动服务等...

    解决Unity不能调用shell脚本传递参数的问题

    ### 解决Unity不能调用shell脚本传递参数的问题 在Unity开发过程中,有时我们需要与操作系统进行交互,例如执行shell脚本来处理一些特定的任务。但在实际操作中,可能会遇到Unity无法正确调用shell脚本并传递参数的...

    linux下shell脚本实现数据的导出

    在Linux环境下,shell脚本是自动化任务的强大工具,尤其对于数据导出这样的操作,通过编写shell脚本可以方便地实现定期备份或者按需导出。本文将深入讲解如何使用shell脚本来实现数据的导出,并结合Java代码进行调用...

    shell脚本shell脚本shell脚本

    Shell脚本是Linux/Unix操作系统中的命令行脚本语言,用于自动化执行一系列系统操作。它是一种强大的工具,能够帮助用户批量处理任务、管理系统资源、执行周期性任务以及整合多个命令到一个可执行文件中。在深入讲解...

    shell脚本大全

    在IT领域,Shell脚本是Linux和Unix操作系统中不可或缺的一部分,它是一种强大的自动化工具,能够帮助用户执行一系列命令,简化日常任务。"shell脚本大全"这个资源可能包含了大量的示例脚本,涵盖了各种用途和场景,...

    Linux 命令与Shell 脚本编程pdf书籍

    《Linux命令行与Shell脚本编程大全》是一本专为Linux初学者编写的经典教材,旨在帮助读者深入理解和掌握Linux操作系统中的基本命令行操作以及Shell脚本编程技术。这本书全面覆盖了从基础到进阶的各种主题,对于想要...

    Linux-shell脚本全面学习.pdf

    Linux Shell 脚本编程基础知识点总结 Linux 脚本编写基础 1.1 语法基本介绍 * `#!` 符号用来告诉系统它后面的参数是用来执行该文件的程序 * 在 Linux 中,使用 `/bin/sh` 来执行程序 * 编辑好脚本后,需要使其可...

    Shell脚本专家指南

    Shell脚本专家指南》旨在为Linux、Unix以及OSx系统管理员提供短小精悍且功能强大的shell实现解决方案,教会读者如何使用现有调试器调试shell脚本。全书分为3个部分:脚本技术基础、系统交互和高级技术、有用的脚本...

Global site tag (gtag.js) - Google Analytics