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 ...
随机推荐
- Adnc如何本地调试 - 一个轻量级的.Net Core微服务开发框架
前言 Adnc是一个轻量级的.Net Core微服务开发框架,同样适用于单体架构系统的开发. 如果只是想本地调试,只需要安装必备软件,必备软件除开发工具外,其它软件建议大家都使用`do ...
- 记一次SqlServer大表查询语句优化和执行计划分析
数据库: sqlserver2008r2 表: device_data 数据量:2000w行左右 表结构 CREATE TABLE [dbo].[device_data]( [Id] [int] ID ...
- netcore项目中使用 SpringCloudConfig 和apollo做配置中心
版权所有,转载请注明出处 https://www.cnblogs.com/netqq/p/14251403.html 一.使用apollo作为配置中心 首先apollo 项目简介和安装请自行百度,本文 ...
- collection常用功能:
collection常用功能: Collection是所有单列集合的父接口,因此在collection中定义了单列集合(List)和(Set)通用的一些方法.这些方法可用于操作所有的单列集合,方法如下 ...
- CSS卡片旋转
html{ perspective: 800px; } body{ display:flex; flex-wrap: wrap; } .card{ transform-style: preserve- ...
- Spark Streaming处理Flume数据练习
把Flume Source(netcat类型),从终端上不断给Flume Source发送消息,Flume把消息汇集到Sink(avro类型),由Sink把消息推送给Spark Streaming并处 ...
- 记汉化zabbix后图形界面没有任何汉字的问题
1.安装并汉化后zabbix,所有的图形界面都没有任何字图,如下图 2.郁闷不已,去/var/www/html/zabbix/fonts目录下面查看,发现之前上传字体的文件名后缀是.ttc,猜着一般见 ...
- VB基础总结
前段时间用VB写了一个简单窗口小应用,久了不碰VB,都忘了,下面用思维导图简单总结了一些基础的东西,方便以后快速查阅.
- 使用idea插件识别log文件的相关设置
最近要读一些spring boot项目产生的log文件,众所周知,idea拥有强大的插件系统.当我打开log文件时,idea自动帮我推荐了ideolog这个插件. 但是当我安装好之后发现系统并不能完全 ...
- Python安装教程之anaconda篇
[导读]我们知道,Python的功能非常强大.那么对于迫切想学习Python的新手同学来说,第一件事情可能需要了解python是什么?能用来做什么?语法结构是怎样的?这些我们几句话很难介绍清楚,后续会 ...