当前位置:网站首页>Rocky basic exercise -shell script 2
Rocky basic exercise -shell script 2
2022-07-26 09:55:00 【51CTO】
Write a script , Complete the following functions :
(1) List all disk devices recognized by the current system (2) If the number of disks is 1, The space usage information is displayed , otherwise , The space usage information on the last disk is displayed
#!/bin/bash
disk=/dev/`lsblk |egrep -o '^sd[a-z]' |tail -1`
disksum=`fdisk -l $disk|sed -rn 's/.* ([0-9]+) sectors/\1/p'`
parsum=`fdisk -l $disk |tail -1| awk '{print $3}'`
sumG=`fdisk -l $disk |sed -rn "s#^Disk /dev.* ([0-9]+) G.*#\1#p"`
used=`echo "(${disksum}-${parsum})*512/1024/1024/1024" |bc`
echo " Your disk ${disk} total ${sumG}GB, Used ${used}GB"
[[email protected] ~]# ./blk.sh
Your disk /dev/sde total 20GB, Used 16GB
边栏推荐
- Interview shock 68: why does TCP need three handshakes?
- [fluorescent character effect]
- 服务发现原理分析与源码解读
- RMQ学习笔记
- M-ary number STR to n-ary number
- Study notes at the end of summer vacation
- Node 内存溢出及V8垃圾回收机制
- 在.NET 6.0中配置WebHostBuilder
- AR model in MATLAB for short-term traffic flow prediction
- Transform between tree and array in JS (hide the children field if the child node of the tree is empty)
猜你喜欢

Node 内存溢出及V8垃圾回收机制

面试突击68:为什么 TCP 需要 3 次握手?

Wechat applet learning notes 1

Xiaobai makes a wave of deep copy and shallow copy

Draw arrows with openlayer

Registration module use case writing

SSG framework Gatsby accesses the database and displays it on the page

Mqtt x cli officially released: powerful and easy-to-use mqtt 5.0 command line tool
![Azkaban [basic knowledge 01] core concepts + features +web interface + Architecture +job type (you can get started with Azkaban workflow scheduling system in one article)](/img/f9/c86ccbb0967894d370498c3a9630eb.png)
Azkaban [basic knowledge 01] core concepts + features +web interface + Architecture +job type (you can get started with Azkaban workflow scheduling system in one article)

B站这个视频我是跪着看完的
随机推荐
[datawhale] [machine learning] Diabetes genetic risk detection challenge
[MySQL database] a collection of basic MySQL operations - the basis of seeing (adding, deleting, modifying, and querying)
The combination of officially issued SSL certificate and self signed certificate realizes website two-way authentication
Principle analysis and source code interpretation of service discovery
The diagram of user login verification process is well written!
AR model in MATLAB for short-term traffic flow prediction
POJ 1012 Joseph
Development to testing: a six-year road to automation starting from 0
Registration module use case writing
PMM (percona monitoring and management) installation record
Azkaban [basic knowledge 01] core concepts + features +web interface + Architecture +job type (you can get started with Azkaban workflow scheduling system in one article)
一种分布式深度学习编程新范式:Global Tensor
Applet record
R语言ggpubr包ggsummarystats函数可视化分组箱图(自定义分组颜色)并在X轴标签下方添加分组对应的统计值(样本数N、中位数median、四分位数的间距iqr、统计值的色彩和分组图色匹配
Alibaba cloud technology expert haochendong: cloud observability - problem discovery and positioning practice
JS one line code to obtain the maximum and minimum values of the array
Solve the problem of storing cookies in IE7 & IE8
Double authentication of server and client
在.NET 6.0中配置WebHostBuilder
Draw arrows with openlayer