Linux常用命令详解(第三章)(ping、kill、seq、du、df、free、date、tar)
本章命令(共7个):
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|
| ping | kill | seq | du | df | free | date | tar |
1、" ping "
作用:向网络主机发送ICMP(检测主机是否在线)
╭─root@localhost.localdomain ~
╰─➤ ping -c 2 -w 5 -i 0.1 baidu.com #-c 发送包的数量 ;-w 等待时间 ;-i <间隔秒数>几秒发一个包;
PING baidu.com (123.125.114.144) 56(84) bytes of data.
64 bytes from 123.125.114.144 (123.125.114.144): icmp_seq=1 ttl=128 time=25.9 ms
64 bytes from 123.125.114.144 (123.125.114.144): icmp_seq=2 ttl=128 time=49.9 ms
--- baidu.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 100ms
rtt min/avg/max/mdev = 25.991/37.979/49.968/11.990 ms
2、" kill "
作用:终止进程
kill PID
kill -9 #强制终止
kill -15 #kill 默认kill -15
kill -l #打印信号名列表
3、" seq "
作用:生成数列
╭─root@localhost.localdomain ~
╰─➤ seq 4 #指定结束位置
1
2
3
4
╭─root@localhost.localdomain ~
╰─➤ seq 3 7 #指定起始和结束位置
3
4
5
6
7
╭─root@localhost.localdomain ~
╰─➤ seq 3 3 14 #指定起始位置结束位置和步长
3
6
9
12
4、" du "
作用:输出文件及目录大小(文本占用磁盘块的大小 默认最小4k单位)
-s或--summarize 仅显示总计
常用选项:
╭─root@localhost.localdomain ~/2
╰─➤ du -s /root #仅显示总和
9320 /root
╭─root@localhost.localdomain ~/2
╰─➤ du -sh /root
9.2M /root #人类易懂显示总和
du 目录 #会默认显示一个目录下的所有的文件,最后一行会有大小的总和(可自行尝试);
5、" df "
作用:报告文件系统磁盘空间的使用情况
╭─root@localhost.localdomain ~/2
╰─➤ df -h #-h 人类易懂的输出
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/cl-root 17G 4.7G 13G 28% /
devtmpfs 473M 0 473M 0% /dev
tmpfs 489M 144K 489M 1% /dev/shm
tmpfs 489M 7.1M 482M 2% /run
tmpfs 489M 0 489M 0% /sys/fs/cgroup
/dev/sda1 1014M 173M 842M 18% /boot
tmpfs 98M 8.0K 98M 1% /run/user/0
/dev/sr0 4.1G 4.1G 0 100% /run/media/root/CentOS 7 x86_64
- 第一列指定文件系统的名称
- 第二列指定一个特定的文件系统1K-块1K是1024字节为单位的总内存。用和可用列正在使用中,分别指定的内存量。
- 第三列使用列指定使用的内存的百分比
- 而最后一列"安装在"指定的文件系统的挂载点。
6、" free "
作用:显示系统中已用和未用的内存空间总和
常用选项:
╭─root@localhost.localdomain ~/2
╰─➤ free -m #以m为单位
total used free shared buff/cache available
Mem: 976 506 62 8 407 253
Swap: 2047 0 2047
╭─root@localhost.localdomain ~/2
╰─➤ free -h #人类易读 (human)
total used free shared buff/cache available
Mem: 976M 504M 65M 8.5M 407M 256M
Swap: 2.0G 0B 2.0G
╭─root@localhost.localdomain ~/2
╰─➤ free -s 3 #-s <间隔秒数> 持续观察内存使用状况。
total used free shared buff/cache available
Mem: 999936 516164 66896 8704 416876 262392
Swap: 2097148 0 2097148
total used free shared buff/cache available
Mem: 999936 516164 66896 8704 416876 262392
Swap: 2097148 0 2097148
total used free shared buff/cache available
Mem: 999936 516164 66896 8704 416876 262392
Swap: 2097148 0 2097148
^C #Ctrl + c 停止
7、" date "
作用: 打印或设置系统日期和时间
常用选项:
-s: 根据 STRING 设置时间
%Y 年(用 4 位表示) (1970...)
%m 月份(用两位表示) (01..12)
%d (月份中的)几号(用两位表示) (01..31)
%H 小时(按 24 小时制显示,用两位表示) (00..23)
%M 分钟数(用两位表示) (00..59)
%S 秒数(用两位表示)(00..60)
%T 时间,按 24 小时制显示(hh:mm:ss)
%F 显示 %Y-%m-%d
实例1:
[root@fda ~]# date '+%F %T'
2019-01-13 13:29:56
实例2:
[root@fda ~]# date -s "2019-01-13 13:30:00"
Sun Jan 13 13:30:00 CST 2019
[root@fda ~]# date
Sun Jan 13 13:30:01 CST 2019
8、tar
常用组合:
- 创建压缩归档:czvf
v:显示过程细节
z:有gzip属性的 - 解压:xzvf (xf)
- 查看tar包里的内容:tf
╭─root@localhost.localdomain ~/test
╰─➤ touch file{1..35}
╭─root@localhost.localdomain ~/test
╰─➤ ls
file1 file13 file17 file20 file24 file28 file31 file35 file7
file10 file14 file18 file21 file25 file29 file32 file4 file8
file11 file15 file19 file22 file26 file3 file33 file5 file9
file12 file16 file2 file23 file27 file30 file34 file6
╭─root@localhost.localdomain ~/test
╰─➤ tar -cvzf file.tar.zg ./*
./file1
./file10
./file11
./file12
./file13
./file14
./file15
./file16
./file17
./file18
./file19
./file2
./file20
./file21
./file22
./file23
./file24
./file25
./file26
./file27
./file28
./file29
./file3
./file30
./file31
./file32
./file33
./file34
./file35
./file4
./file5
./file6
./file7
./file8
./file9
╭─root@localhost.localdomain ~/test
╰─➤ ls
file1 file13 file17 file20 file24 file28 file31 file35 file7
file10 file14 file18 file21 file25 file29 file32 file4 file8
file11 file15 file19 file22 file26 file3 file33 file5 file9
file12 file16 file2 file23 file27 file30 file34 file6 file.tar.zg
╭─root@localhost.localdomain ~/test
╰─➤ rm file{1..35}
╭─root@localhost.localdomain ~/test
╰─➤ ls
file.tar.zg
╭─root@localhost.localdomain ~/test
╰─➤ tar -xzvf file.tar.zg ./
./file1
./file10
./file11
./file12
./file13
./file14
./file15
./file16
./file17
./file18
./file19
./file2
./file20
./file21
./file22
./file23
./file24
./file25
./file26
./file27
./file28
./file29
./file3
./file30
./file31
./file32
./file33
./file34
./file35
./file4
./file5
./file6
./file7
./file8
./file9
╭─root@localhost.localdomain ~/test
╰─➤ ls
file1 file13 file17 file20 file24 file28 file31 file35 file7
file10 file14 file18 file21 file25 file29 file32 file4 file8
file11 file15 file19 file22 file26 file3 file33 file5 file9
file12 file16 file2 file23 file27 file30 file34 file6 file.tar.zg
╭─root@localhost.localdomain ~/test
╰─➤#tar -tf httpd.tar
httpd/
httpd/apr-1.4.8-3.el7.x86_64.rpm
httpd/apr-util-1.5.2-6.el7.x86_64.rpm
httpd/httpd-2.4.6-40.el7.centos.x86_64.rpm
httpd/httpd-tools-2.4.6-40.el7.centos.x86_64.rpm
httpd/._httpd.conf
httpd/httpd.conf
httpd/._index.cgi
httpd/index.cgi
httpd/._index.html
httpd/index.html
httpd/install.sh
httpd/mailcap-2.1.41-2.el7.noarch.rpm
httpd/mod_ssl-2.4.6-40.el7.centos.x86_64.rpm
#打时间包
tar czf file_$(data +%Y%m%d).tar.gz /home/*

Linux常用命令详解(第三章)(ping、kill、seq、du、df、free、date、tar)的更多相关文章
- Linux常用命令详解(第二章)(cat、more、less、head、tail、clear、poweroff、reboot、alias、unalias、uname、hostname、history、whitch、wc、w、who、whoami、)
本章命令(共18个): 1 2 3 4 5 6 7 8 9 10 cat more less head tail clear poweroff reboot alias unalias uname h ...
- Linux常用命令详解(第一章)(ls、man、pwd、cd、mkdir、echo、touch、cp、mv、rm、rmdir、)
本章命令(共11个): 1 2 3 4 5 6 ls man pwd cd mkdir echo touch cp mv rm rmdir 1. " ls " 作用:列出指定目录下 ...
- Linux常用命令详解(week1_day1_2)--技术流ken
本节内容 aliasunaliasunamesuhostnamehistorywhichwcwwhowhoamipingkillseqdudffreedate 命令详解 1. alias 设置.’查看 ...
- Linux常用命令详解(2)
aliasunaliasunamesuhostnamehistorywhichwcwwhowhoamipingkillseqdudffreedate 命令详解 1. alias 设置.’查看别名 实例 ...
- Linux常用命令详解下
Linux常用命令详解 目录 一.Linux常用命令 1.1.查看及切换目录(pwd.cd.ls.du) 1.2.创建目录和文件(mkdir.touch.ln) 1.3.复制.删除.移动目录和文件(c ...
- Linux常用命令详解上
Linux常用命令详解上 目录 一.shell 二.Linux命令 2.1.内部命令与外部命令的区别 2.2.Linux命令行的格式 2.3.编辑Linux命令行的辅助操作 2.4.获得命令帮助的方法 ...
- Linux常用命令详解(week1_day1_1)--技术流ken
本节内容 基础命令:lsmanpwdcdmkdirechotouchcpmvrmrmdircatmorelessheadtailclearpoweroffreboot进阶命令(下一章节):aliasu ...
- Linux常用命令详解—基于CentOS7
## Linux 目录- /:根目录,一般只存放目录,不存放文件- /bin -> /usr/bin:可执行二进制文件的目录,也是常用命令目录,如常用的命令 ls.cat.mv 等- /boot ...
- Linux常用命令详解(1)
基础命令:lsmanpwdcdmkdirechotouchcpmvrmrmdircatmorelessheadtailclearpoweroffreboot进阶命令(下一章节):aliasunalia ...
随机推荐
- JavaScript AMD模块化规范
浏览器环境 有了服务器端模块以后,很自然地,大家就想要客户端模块.而且最好两者能够兼容,一个模块不用修改,在服务器和浏览器都可以运行. 但是,由于一个重大的局限,使得CommonJS规范不适用于浏览器 ...
- ES6模板字符串及字符串的扩展方法
一.ES6模板字符串 传统定义字符串的方式是: const str='hello es2015,this is a string' ES6新增了一种定义字符串的方式用反引号进行标识 const str ...
- HDFS中大数据常见运维指令总结
一.查看HDFS下的参数信息 [root@master ~]# hdfs Usage: hdfs [--config confdir] COMMAND where COMMAND is one of: ...
- SQL操作符的优化
操作符优化 IN 操作符 用IN写出来的SQL的优点是比较容易写及清晰易懂,这比较适合现代软件开发的风格. 但是用IN的SQL性能总是比较低的,从ORACLE执行的步骤来分析用IN的SQ ...
- Linux LVM Logical Volume Management 逻辑卷的管理
博主是一个数据库DBA,但是一般来说,是不做linux服务器LVM 逻辑卷的创建.扩容和减容操作的,基本上有系统管理员操作,一是各司其职,专业的事专业的人做,二是做多了你的责任也多了,哈哈! 但是li ...
- Linux学习笔记 | 配置ssh
目录: SSH的必要性 将默认镜像源修改为清华镜像源 Linux安装ssh软件 使用putty软件实现ssh连接 Windows下安装winscp SSH的必要性 一般服务器都位于远程而非本地,或者及 ...
- 如何构建一个多人(.io) Web 游戏,第 1 部分
原文:How to Build a Multiplayer (.io) Web Game, Part 1 GitHub: https://github.com/vzhou842/example-.io ...
- docker 创建数据卷容器
数据卷容器 --volumes-from 容器名/id 先起一个容器 docker run -it --name docker01 centos 然后同步 docker01 的数据卷 --volume ...
- Github Python计算器开源项目 二次开发--增加函数图形
先上原项目链接:https://github.com/xhf79/Calculator_pyqt python+Qt 开发的计算器 原项目界面和功能如图所示: 科学计算的内容基本都有,但按照项目的提示 ...
- 检查Mysql主从状态
.检查MySQL主从同步状态 #!/bin/bash USER=bak PASSWD=123456 IO_SQL_STATUS=$(mysql -u$USER -p$PASSWD -e show s ...