Linux 网络编程——libpcap详解 linux网络编程视频
sinye56 2024-12-23 13:26 32 浏览 0 评论
libpcap 是一个网络数据包捕获函数库,功能非常强大,Linux 下著名的 tcpdump 就是以它为基础的。
libpcap主要的作用
- 捕获各种数据包,列如:网络流量统计。
- 过滤网络数据包,列如:过滤掉本地上的一些数据,类似防火墙。
- 分析网络数据包,列如:分析网络协议,数据的采集。
- 存储网络数据包,列如:保存捕获的数据以为将来进行分析。
libpcap 的安装
libpcap 的抓包框架
- pcap_lookupdev():函数用于查找网络设备,返回可被 pcap_open_live() 函数调用的网络设备名指针。
- pcap_lookupnet():函数获得指定网络设备的网络号和掩码。
- pcap_open_live(): 函数用于打开网络设备,并且返回用于捕获网络数据包的数据包捕获描述字。对于此网络设备的操作都要基于此网络设备描述字。
- pcap_compile(): 函数用于将用户制定的过滤策略编译到过滤程序中。
- pcap_setfilter():函数用于设置过滤器。
- pcap_loop():函数 pcap_dispatch() 函数用于捕获数据包,捕获后还可以进行处理,此外 pcap_next() 和 pcap_next_ex() 两个函数也可以用来捕获数据包。
- pcap_close():函数用于关闭网络设备,释放资源。
利用 libpcap 函数库开发应用程序的基本步骤:
- 打开网络设备
- 设置过滤规则
- 捕获数据
- 关闭网络设备
抓包详细步骤
首先要使用 libpcap,我们必须包含 pcap.h 头文件,可以在 /usr/local/include/pcap/pcap.h 找到,其中包含了每个类型定义的详细说明。
1、获取网络接口设备名
char *pcap_lookupdev(char *errbuf);
功能:
得到可用的网络设备名指针
参数:
errbuf:存放出错信息字符串,里面有个宏定义:PCAP_ERRBUF_SIZE,为错误缓冲区大小
返回值:
成功返回设备名指针(第一个合适的网络接口的字符串指针);
失败返回 NULL,同时,errbuf 存放出错信息字符串。
实例如下:
char error_content[PCAP_ERRBUF_SIZE] = {0}; // 出错信息
char *dev = pcap_lookupdev(error_content);
if(NULL == dev)
{
printf(error_content);
exit(-1);
}
2、获取网络号(ip 地址)和掩码
int pcap_lookupnet( char *device,
bpf_u_int32 *netp,
bpf_u_int32 *maskp,
char *errbuf );
功能:
获取指定网卡的 ip 地址,子网掩码
参数:
device:网络设备名,为第一步获取的网络接口字符串(pcap_lookupdev() 的返回值 ),也可人为指定,如“eth0”。
netp:存放 ip 地址的指针,bpf_u_int32 为 32 位无符号整型
maskp:存放子网掩码的指针,bpf_u_int32 为 32 位无符号整型
errbuf:存放出错信息
返回值:
成功返回 0,失败返回 -1
需要C/C++ Linux服务器架构师学习资料私信“资料”(资料包括C/C++,Linux,golang技术,Nginx,ZeroMQ,MySQL,Redis,fastdfs,MongoDB,ZK,流媒体,CDN,P2P,K8S,Docker,TCP/IP,协程,DPDK,ffmpeg等),免费分享
实例如下:
char error_content[PCAP_ERRBUF_SIZE] = {0}; // 出错信息
char *dev = pcap_lookupdev(error_content);
if(NULL == dev)
{
printf(error_content);
exit(-1);
}
bpf_u_int32 netp = 0, maskp = 0;
pcap_t * pcap_handle = NULL;
int ret = 0;
//获得网络号和掩码
ret = pcap_lookupnet(dev, &netp, &maskp, error_content);
if(ret == -1)
{
printf(error_content);
exit(-1);
}
3、打开网络接口
pcap_t *pcap_open_live( const char *device,
int snaplen,
int promisc,
int to_ms,
char *ebuf );
功能:
打开一个用于捕获数据的网络接口
参数:
device:网络接口的名字,为第一步获取的网络接口字符串(pcap_lookupdev() 的返回值 ),也可人为指定,如“eth0”。
snaplen:捕获数据包的长度,长度不能大于 65535 个字节。
promise:“1” 代表混杂模式,其它非混杂模式。什么为混杂模式,请看《原始套接字编程》。
to_ms:指定需要等待的毫秒数,超过这个数值后,获取数据包的函数就会立即返回(这个函数不会阻塞,后面的抓包函数才会阻塞)。0 表示一直等待直到有数据包到来。
ebuf:存储错误信息。
返回值:
返回 pcap_t 类型指针,后面的所有操作都要使用这个指针。
实例如下:
char error_content[PCAP_ERRBUF_SIZE] = {0}; // 出错信息
char *dev = pcap_lookupdev(error_content); // 获取网络接口
if(NULL == dev)
{
printf(error_content);
exit(-1);
}
// 打开网络接口
pcap_t * pcap_handle = pcap_open_live(dev, 1024, 1, 0, error_content);
if(NULL == pcap_handle)
{
printf(error_content);
exit(-1);
}
4、获取数据包
a)
const u_char *pcap_next(pcap_t *p, struct pcap_pkthdr *h);
功能:
捕获一个网络数据包,收到一个数据包立即返回
参数:
p:pcap_open_live()返回的 pcap_t 类型的指针
h:数据包头
pcap_pkthdr 类型的定义如下:
struct pcap_pkthdr
{
struct timeval ts; // 抓到包的时间
bpf_u_int32 caplen; // 表示抓到的数据长度
bpf_u_int32 len; // 表示数据包的实际长度
}
len 和 caplen的区别:
因为在某些情况下你不能保证捕获的包是完整的,例如一个包长 1480,但是你捕获到 1000 的时候,可能因为某些原因就中止捕获了,所以 caplen 是记录实际捕获的包长,也就是 1000,而 len 就是 1480。
返回值:
成功返回捕获数据包的地址,失败返回 NULL
实例如下:
const unsigned char *p_packet_content = NULL; // 保存接收到的数据包的起始地址
pcap_t *pcap_handle = NULL;
struct pcap_pkthdr protocol_header;
pcap_handle = pcap_open_live("eth0", 1024, 1, 0,NULL);
p_packet_content = pcap_next(pcap_handle, &protocol_header);
//p_packet_content 所捕获数据包的地址
printf("Capture Time is :%s",ctime((const time_t *)&protocol_header.ts.tv_sec)); // 时间
printf("Packet Lenght is :%d\n",protocol_header.len); // 数据包的实际长度
// 分析以太网中的 源mac、目的mac
struct ether_header *ethernet_protocol = NULL;
unsigned char *p_mac_string = NULL; // 保存mac的地址,临时变量
ethernet_protocol = (struct ether_header *)p_packet_content; //struct ether_header 以太网帧头部
p_mac_string = (unsigned char *)ethernet_protocol->ether_shost;//获取源mac
printf("Mac Source Address is %02x:%02x:%02x:%02x:%02x:%02x\n",*(p_mac_string+0),*(p_mac_string+1),*(p_mac_string+2),*(p_mac_string+3),*(p_mac_string+4),*(p_mac_string+5));
p_mac_string = (unsigned char *)ethernet_protocol->ether_dhost;//获取目的mac
printf("Mac Destination Address is %02x:%02x:%02x:%02x:%02x:%02x\n",*(p_mac_string+0),*(p_mac_string+1),*(p_mac_string+2),*(p_mac_string+3),*(p_mac_string+4),*(p_mac_string+5));
b)
int pcap_loop( pcap_t *p,
int cnt,
pcap_handler callback,
u_char *user );
功能:
循环捕获网络数据包,直到遇到错误或者满足退出条件。每次捕获一个数据包就会调用 callback 指定的回调函数,所以,可以在回调函数中进行数据包的处理操作。
参数:
p:pcap_open_live()返回的 pcap_t 类型的指针。
cnt:指定捕获数据包的个数,一旦抓到了 cnt 个数据包,pcap_loop 立即返回。如果是 -1,就会永无休止的捕获,直到出现错误。
callback:回调函数,名字任意,根据需要自行起名。
user:向回调函数中传递的参数。
callback 回调函数的定义:
void callback( u_char *userarg,
const struct pcap_pkthdr * pkthdr,
const u_char * packet )
userarg:pcap_loop() 的最后一个参数,当收到足够数量的包后 pcap_loop 会调用callback 回调函数,同时将pcap_loop()的user参数传递给它
pkthdr:是收到数据包的 pcap_pkthdr 类型的指针,和 pcap_next() 第二个参数是一样的。
packet :收到的数据包数据
返回值:
成功返回0,失败返回负数
实例如下:
if( pcap_loop(pcap_handle, -1, ethernet_protocol_callback, NULL) < 0 )
{
perror("pcap_loop");
}
/*******************************回调函数************************************/
void ethernet_protocol_callback(unsigned char *argument,const struct pcap_pkthdr *packet_heaher,const unsigned char *packet_content)
{
unsigned char *mac_string; //
struct ether_header *ethernet_protocol;
unsigned short ethernet_type; //以太网类型
printf("----------------------------------------------------\n");
printf("%s\n", ctime((time_t *)&(packet_heaher->ts.tv_sec))); //转换时间
ethernet_protocol = (struct ether_header *)packet_content;
mac_string = (unsigned char *)ethernet_protocol->ether_shost;//获取源mac地址
printf("Mac Source Address is %02x:%02x:%02x:%02x:%02x:%02x\n",*(mac_string+0),*(mac_string+1),*(mac_string+2),*(mac_string+3),*(mac_string+4),*(mac_string+5));
mac_string = (unsigned char *)ethernet_protocol->ether_dhost;//获取目的mac
printf("Mac Destination Address is %02x:%02x:%02x:%02x:%02x:%02x\n",*(mac_string+0),*(mac_string+1),*(mac_string+2),*(mac_string+3),*(mac_string+4),*(mac_string+5));
ethernet_type = ntohs(ethernet_protocol->ether_type);//获得以太网的类型
printf("Ethernet type is :%04x\n",ethernet_type);
switch(ethernet_type)
{
case 0x0800:printf("The network layer is IP protocol\n");break;//ip
case 0x0806:printf("The network layer is ARP protocol\n");break;//arp
case 0x0835:printf("The network layer is RARP protocol\n");break;//rarp
default:break;
}
usleep(800*1000);
}
c)
int pcap_dispatch(pcap_t * p, int cnt, pcap_handler callback, u_char * user);
这个函数和 pcap_loop() 非常类似,只是在超过 to_ms 毫秒后就会返回( to_ms 是pcap_open_live() 的第4个参数 )
5、释放网络接口
void pcap_close(pcap_t *p);
功能:
关闭 pcap_open_live() 打开的网络接口(即其返回值,pcap_t 类型指针),并释放相关资源。注意,操作完网络接口,应该释放其资源。
参数:
p:需要关闭的网络接口,pcap_open_live() 的返回值(pcap_t 类型指针)
返回值:
无
实例如下:
// 打开网络接口
pcap_t * pcap_handle = pcap_open_live("eth0", 1024, 1, 0, error_content);
if(NULL == pcap_handle)
{
printf(error_content);
exit(-1);
}
//// ……
//// ……
pcap_close(pcap_handle); //释放网络接口
例子1(接收一个数据包):
#include <stdio.h>
#include <pcap.h>
#include <arpa/inet.h>
#include <time.h>
#include <stdlib.h>
struct ether_header
{
unsigned char ether_dhost[6]; //目的mac
unsigned char ether_shost[6]; //源mac
unsigned short ether_type; //以太网类型
};
#define BUFSIZE 1514
int main(int argc,char *argv[])
{
pcap_t * pcap_handle = NULL;
char error_content[100] = ""; // 出错信息
const unsigned char *p_packet_content = NULL; // 保存接收到的数据包的起始地址
unsigned char *p_mac_string = NULL; // 保存mac的地址,临时变量
unsigned short ethernet_type = 0; // 以太网类型
char *p_net_interface_name = NULL; // 接口名字
struct pcap_pkthdr protocol_header;
struct ether_header *ethernet_protocol;
//获得接口名
p_net_interface_name = pcap_lookupdev(error_content);
if(NULL == p_net_interface_name)
{
perror("pcap_lookupdev");
exit(-1);
}
//打开网络接口
pcap_handle = pcap_open_live(p_net_interface_name,BUFSIZE,1,0,error_content);
p_packet_content = pcap_next(pcap_handle,&protocol_header);
printf("------------------------------------------------------------------------\n");
printf("capture a Packet from p_net_interface_name :%s\n",p_net_interface_name);
printf("Capture Time is :%s",ctime((const time_t *)&protocol_header.ts.tv_sec));
printf("Packet Lenght is :%d\n",protocol_header.len);
/*
*分析以太网中的 源mac、目的mac
*/
ethernet_protocol = (struct ether_header *)p_packet_content;
p_mac_string = (unsigned char *)ethernet_protocol->ether_shost;//获取源mac
printf("Mac Source Address is %02x:%02x:%02x:%02x:%02x:%02x\n",*(p_mac_string+0),*(p_mac_string+1),*(p_mac_string+2),*(p_mac_string+3),*(p_mac_string+4),*(p_mac_string+5));
p_mac_string = (unsigned char *)ethernet_protocol->ether_dhost;//获取目的mac
printf("Mac Destination Address is %02x:%02x:%02x:%02x:%02x:%02x\n",*(p_mac_string+0),*(p_mac_string+1),*(p_mac_string+2),*(p_mac_string+3),*(p_mac_string+4),*(p_mac_string+5));
/*
*获得以太网的数据包的地址,然后分析出上层网络协议的类型
*/
ethernet_type = ntohs(ethernet_protocol->ether_type);
printf("Ethernet type is :%04x\t",ethernet_type);
switch(ethernet_type)
{
case 0x0800:printf("The network layer is IP protocol\n");break;//ip
case 0x0806:printf("The network layer is ARP protocol\n");break;//arp
case 0x0835:printf("The network layer is RARP protocol\n");break;//rarp
default:printf("The network layer unknow!\n");break;
}
pcap_close(pcap_handle);
return 0;
}
注意:gcc 编译时需要加上 -lpcap,运行时需要使用超级权限
例子2(接收多个数据包):
#include <stdio.h>
#include <pcap.h>
#include <arpa/inet.h>
#include <time.h>
#include <stdlib.h>
#define BUFSIZE 1514
struct ether_header
{
unsigned char ether_dhost[6]; //目的mac
unsigned char ether_shost[6]; //源mac
unsigned short ether_type; //以太网类型
};
/*******************************回调函数************************************/
void ethernet_protocol_callback(unsigned char *argument,const struct pcap_pkthdr *packet_heaher,const unsigned char *packet_content)
{
unsigned char *mac_string; //
struct ether_header *ethernet_protocol;
unsigned short ethernet_type; //以太网类型
printf("----------------------------------------------------\n");
printf("%s\n", ctime((time_t *)&(packet_heaher->ts.tv_sec))); //转换时间
ethernet_protocol = (struct ether_header *)packet_content;
mac_string = (unsigned char *)ethernet_protocol->ether_shost;//获取源mac地址
printf("Mac Source Address is %02x:%02x:%02x:%02x:%02x:%02x\n",*(mac_string+0),*(mac_string+1),*(mac_string+2),*(mac_string+3),*(mac_string+4),*(mac_string+5));
mac_string = (unsigned char *)ethernet_protocol->ether_dhost;//获取目的mac
printf("Mac Destination Address is %02x:%02x:%02x:%02x:%02x:%02x\n",*(mac_string+0),*(mac_string+1),*(mac_string+2),*(mac_string+3),*(mac_string+4),*(mac_string+5));
ethernet_type = ntohs(ethernet_protocol->ether_type);//获得以太网的类型
printf("Ethernet type is :%04x\n",ethernet_type);
switch(ethernet_type)
{
case 0x0800:printf("The network layer is IP protocol\n");break;//ip
case 0x0806:printf("The network layer is ARP protocol\n");break;//arp
case 0x0835:printf("The network layer is RARP protocol\n");break;//rarp
default:break;
}
usleep(800*1000);
}
int main(int argc, char *argv[])
{
char error_content[100]; //出错信息
pcap_t * pcap_handle;
unsigned char *mac_string;
unsigned short ethernet_type; //以太网类型
char *net_interface = NULL; //接口名字
struct pcap_pkthdr protocol_header;
struct ether_header *ethernet_protocol;
//获取网络接口
net_interface = pcap_lookupdev(error_content);
if(NULL == net_interface)
{
perror("pcap_lookupdev");
exit(-1);
}
pcap_handle = pcap_open_live(net_interface,BUFSIZE,1,0,error_content);//打开网络接口
if(pcap_loop(pcap_handle,-1,ethernet_protocol_callback,NULL) < 0)
{
perror("pcap_loop");
}
pcap_close(pcap_handle);
return 0;
}
运行情况如下:
过滤数据包
我们抓到的数据包往往很多,如何过滤掉我们不感兴趣的数据包呢?
几乎所有的操作系统( BSD, AIX, Mac OS, Linux 等)都会在内核中提供过滤数据包的方法,主要都是基于 BSD Packet Filter( BPF ) 结构的。libpcap 利用 BPF 来过滤数据包。
1)设置过滤条件
BPF 使用一种类似于汇编语言的语法书写过滤表达式,不过 libpcap 和 tcpdump 都把它封装成更高级且更容易的语法了,具体可以通过 man tcpdump查看:
以下是一些例子:
src host 192.168.1.177
只接收源 ip 地址是 192.168.1.177 的数据包
dst port 80
只接收 tcp/udp 的目的端口是 80 的数据包
not tcp
只接收不使用 tcp 协议的数据包
tcp[13] == 0x02 and (dst port 22 or dst port 23)
只接收 SYN 标志位置位且目标端口是 22 或 23 的数据包( tcp 首部开始的第 13 个字节)
icmp[icmptype] == icmp-echoreply or icmp[icmptype] == icmp-echo
只接收 icmp 的 ping 请求和 ping 响应的数据包
ehter dst 00:e0:09:c1:0e:82
只接收以太网 mac 地址是 00:e0:09:c1:0e:82 的数据包
ip[8] == 5
只接收 ip 的 ttl=5 的数据包(ip首部开始的第8个字节)
2)编译 BPF 过滤规则
int pcap_compile( pcap_t *p,
struct bpf_program *fp,
char *buf,
int optimize,
bpf_u_int32 mask );
功能:
编译 BPF 过滤规则
参数:
p:pcap_open_live() 返回的 pcap_t 类型的指针
fp:存放编译后的 bpf,应用过滤规则时需要用到这个指针
buf:过滤条件
optimize:是否需要优化过滤表达式
mask:指定本地网络的网络掩码,不需要时可写 0
返回值:
成功返回 0,失败返回 -1
3)应用 BPF 过滤规则
int pcap_setfilter( pcap_t * p, struct bpf_program * fp );
功能:
应用 BPF 过滤规则,简单理解为让过滤生效
参数:
p:pcap_open_live() 返回的 pcap_t 类型的指针
fp:pcap_compile() 的第二个参数
返回值:
成功返回 0,失败返回 -1
这个编译应用过程,有点类似于,我们写一个 C 程序,先编译,后运行的过程。
应用完过滤表达式之后我们便可以使用 pcap_loop() 或 pcap_next() 等抓包函数来抓包了。
下面的程序演示了如何过滤数据包,我们只接收目的端口是 80 的数据包:
#include <pcap.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
void getPacket(u_char * arg, const struct pcap_pkthdr * pkthdr, const u_char * packet)
{
int * id = (int *)arg;
printf("id: %d\n", ++(*id));
printf("Packet length: %d\n", pkthdr->len);
printf("Number of bytes: %d\n", pkthdr->caplen);
printf("Recieved time: %s", ctime((const time_t *)&pkthdr->ts.tv_sec));
int i;
for(i=0; i<pkthdr->len; ++i)
{
printf(" %02x", packet[i]);
if( (i + 1) % 16 == 0 )
{
printf("\n");
}
}
printf("\n\n");
}
int main()
{
char errBuf[PCAP_ERRBUF_SIZE], * devStr;
/* get a device */
devStr = pcap_lookupdev(errBuf);
if(devStr)
{
printf("success: device: %s\n", devStr);
}
else
{
printf("error: %s\n", errBuf);
exit(1);
}
/* open a device, wait until a packet arrives */
pcap_t * device = pcap_open_live(devStr, 65535, 1, 0, errBuf);
if(!device)
{
printf("error: pcap_open_live(): %s\n", errBuf);
exit(1);
}
/* construct a filter */
struct bpf_program filter;
pcap_compile(device, &filter, "dst port 80", 1, 0);
pcap_setfilter(device, &filter);
/* wait loop forever */
int id = 0;
pcap_loop(device, -1, getPacket, (u_char*)&id);
pcap_close(device);
return 0;
}
相关推荐
- CTO偷偷传我的系统性能优化十大绝招(万字干货)
-
上篇引言:取与舍软件设计开发某种意义上是“取”与“舍”的艺术。关于性能方面,就像建筑设计成抗震9度需要额外的成本一样,高性能软件系统也意味着更高的实现成本,有时候与其他质量属性甚至会冲突,比如安全性、...
- 提升效率!VMware虚拟机性能优化十大实用技巧
-
我40岁,干跨境婚恋中介的。为服务各国用户,常得弄英语、日语、俄语系统环境,VMware虚拟机帮了不少忙。用久了发现优化下性能,效率能更高。今儿就来聊聊优化技巧和同类软件。一、VMware虚拟...
- 低延迟场景下的性能优化实践
-
本文摘录自「全球C++及系统软件技术大会」ScottMeyers曾说到过,如果你不在乎性能,为什么要在C++这里,而不去隔壁的Pythonroom呢?今天我们就从“低延迟的概述”、“低延迟系...
- Linux性能调优之内存负载调优的一些笔记
-
写在前面整理一些Linux内存调优的笔记,分享给小伙伴博文没有涉及的Demo,理论方法偏多,可以用作内存调优入门博文内容涉及:Linux内存管理的基本理论寻找内存泄露的进程内存交换空间调优不同方式的...
- 优化性能套路:带你战胜这只后段程序员的拦路虎
-
来源|极客时间《卖桃者说》作者|池建强编辑|成敏你好,这里是卖桃者说。今天给大家推荐一篇文章,来自倪朋飞老师的专栏《Linux性能优化实战》,文章主要讲的是优化性能的套路,这几乎是每个后端程序员...
- SK海力士CXL优化解决方案已成功搭载于Linux:带宽提升30%,性能提升12%以上
-
SK海力士宣布,已将用于优化CXL(ComputeExpressLink)存储器运行的自研软件异构存储器软件开发套件(HMSDK)中主要功能成功搭载于全球最大的开源操作系统Linux上,不但提升了...
- Linux内核优化:提升系统性能的秘诀
-
Linux内核优化:提升系统性能的艺术在深入Linux内核优化的世界之前,让我们先来理解一下内核优化的重要性。Linux内核是操作系统的核心,负责管理系统资源和控制硬件。一个经过精心优化的内核可以显著...
- Linux系统性能优化:七个实战经验
-
Linux系统的性能是指操作系统完成任务的有效性、稳定性和响应速度。Linux系统管理员可能经常会遇到系统不稳定、响应速度慢等问题,例如在Linux上搭建了一个web服务,经常出现网页无法打开、打开速...
- 腾讯面试:linux内存性能优化总结
-
【1】内存映射Linux内核给每个进程都提供了一个独立且连续的虚拟地址空间,以便进程可以方便地访问虚拟内存;虚拟地址空间的内部又被分为内核空间和用户空间两部分,不同字长的处理器,地址空间的范围也不同...
- Linux文件系统性能调优《参数优化详解》
-
由于各种的I/O负载情形各异,Linux系统中文件系统的缺省配置一般来说都比较中庸,强调普遍适用性。然而在特定应用下,这种配置往往在I/O性能方面不能达到最优。因此,如果应用对I/O性能要求较高,除...
- Nginx 性能优化(吐血总结)
-
一、性能优化考虑点当我需要进行性能优化时,说明我们服务器无法满足日益增长的业务。性能优化是一个比较大的课题,需要从以下几个方面进行探讨当前系统结构瓶颈了解业务模式性能与安全1、当前系统结构瓶颈首先需要...
- Linux问题分析与性能优化
-
排查顺序整体情况:top/htop/atop命令查看进程/线程、CPU、内存使用情况,CPU使用情况;dstat2查看CPU、磁盘IO、网络IO、换页、中断、切换,系统I/O状态;vmstat2查...
- 大神级产品:手机装 Linux 运行 Docker 如此简单
-
本内容来源于@什么值得买APP,观点仅代表作者本人|作者:灵昱Termux作为一个强大的Android终端模拟器,能够运行多种Linux环境。然而,直接在Termux上运行Docker并不可行,需要...
- 新手必须掌握的Linux命令
-
Shell就是终端程序的统称,它充当了人与内核(硬件)之间的翻译官,用户把一些命令“告诉”终端程序,它就会调用相应的程序服务去完成某些工作。现在包括红帽系统在内的许多主流Linux系统默认使用的终端是...
- Linux 系统常用的 30 个系统环境变量全解析
-
在Linux系统中,环境变量起着至关重要的作用,它们犹如隐藏在系统背后的“魔法指令”,掌控着诸多程序的运行路径、配置信息等关键要素。尤其在shell脚本编写时,巧妙运用环境变量,能让脚本如虎...
你 发表评论:
欢迎- 一周热门
- 最近发表
- 标签列表
-
- oracle忘记用户名密码 (59)
- oracle11gr2安装教程 (55)
- mybatis调用oracle存储过程 (67)
- oracle spool的用法 (57)
- oracle asm 磁盘管理 (67)
- 前端 设计模式 (64)
- 前端面试vue (56)
- linux格式化 (55)
- linux图形界面 (62)
- linux文件压缩 (75)
- Linux设置权限 (53)
- linux服务器配置 (62)
- mysql安装linux (71)
- linux启动命令 (59)
- 查看linux磁盘 (72)
- linux用户组 (74)
- linux多线程 (70)
- linux设备驱动 (53)
- linux自启动 (59)
- linux网络命令 (55)
- linux传文件 (60)
- linux打包文件 (58)
- linux查看数据库 (61)
- linux获取ip (64)
- linux进程通信 (63)