- 博客(18)
- 资源 (20)
- 收藏
- 关注
原创 Linux 下常用的字符串 处理命令 记录 awk sed cut grep wc shell
1. awk 详细参数说明 awk '{print $3,$4}' /proc/net/arp 把arp文件的第三行和第四行,打印出来,可以重定向到文件root@OpenWrt:/tmp# awk '{print $3,$4}' /proc/net/arp >/tmp/net_arp_listroot@OpenWrt:/tmp# cat net_arp_list HW type...
2018-05-07 15:19:16 475 1
原创 linux c 创建线程 每隔2分钟,去check一个文件,若该文件大小大于1024k,删除文件
可以通过 pthread_create()函数创建新线程。#include <pthread.h>int pthread_create(pthread_t *restrict tidp, const pthread_attr_t *restrict attr, ...
2018-05-25 15:23:36 302
原创 dmesg 总结 iwpriv ra0 show stacountinfo
dmesg 可将mtk平台的iwpriv的一些命令的输出没有在用户态。使用的是printk打印。若想获取到打印信息,常用的两种方法。 1.使用ioctl,copy到user态 2.使用dmesg。 a.类似 dmesg -c 先把dmesg的buf清空。 b.然后执行iwpriv ra0 show stacountinfo 打印信息会保存到dmesg的buf里面(这个时候可以dm...
2018-05-22 17:19:09 1514 2
原创 shell
l3filter_num=`iptables -L -t filter --line | grep -A 10 "FORWARD" | grep "L3FILTER" | cut -c 1-3 ` echo "$SH_NAME l3filter_num:$l3filter_num" > /dev/kmsg if [ "$l3filter_num" != ...
2018-05-18 16:35:00 88
原创 [openwrt] firewall
root@OpenWrt:/etc/config# ls4g dataUsageCfg network8192eeshare dhcp qos8192eewpa dropbear remoteupgradeAPNProf...
2018-05-16 11:30:38 400
原创 C 字符串转大小写strupr , strlowr, tolower, toupper
转大写char *strupr(char *str){ char *orign=str; for (; *str!='\0'; str++) *str = toupper(*str); return orign;}转小写char *strlowr(char *str){ char *orign=str; for (; *str...
2018-05-14 15:41:15 23134 1
原创 fread fgets feof 读文件到buf里面
从dhcp.leases读文件,每次读一行,fgets,写到dst_dhcp_list指向的buf里面。feof(fp)有两个返回值:如果遇到文件结束,函数feof(fp)的值为非零值,否则为0。int conf_get_dhcp_list1_new(char* dst_dhcp_list){ FILE *f=NULL; if ((f = fopen("/tmp/dhc...
2018-05-09 14:54:18 501
原创 C 语言 查看文件,文件夹是否存在 access,opendir
int is_dir_exist(const char *dir_path){ if(dir_path == NULL) { return -1; } if(opendir(dir_path) == NULL) { return -1; } return 0;}在头文件unistd.h中的预定义...
2018-05-09 11:16:34 722
原创 du命令 查看当前文件夹,大小
du -h openwrt7621/ | tail -n 1du命令也是查看使用空间的,但是与df命令不同的是Linux du命令是对文件和目录磁盘使用的空间的查看,还是和df命令有一些区别的。-a或-all 显示目录中个别文件的大小。 -b或-bytes 显示目录或文件大小时,以byte为单位。 -c或–total 除了显示个别目录或文件的大小外,同时也显示所有目录或文件的总和。 ...
2018-05-09 10:03:34 3023
原创 把TortoiseSVN中默认的文件比较工具替换为Beyond Compare
1.打开TortoiseSVN的配置:2.Settings->Diff Viewer 把默认的 TortoiseMerge换成External,然后再设置为BeyondCompare。3.TortoiseSVNDiffSelect Settings from Explorer’s TortoiseSVN submenu.Switch to the Diff ...
2018-05-09 09:54:06 1219 1
原创 grep -A -B -C
-A -B -C 后面都跟阿拉伯数字 -A是显示匹配后和它后面的n行。 -B是显示匹配行和它前面的n行。 -C是匹配行和它前后各n行。 总体来说,-C覆盖面最大。用它保险些。哈哈。这3个开关都是关于匹配行的上下文的(context)。于是 grep -A 4 wikipedia 密码文件.txt 就是搜索密码文件,找到匹配“wikipedia”字串的行,显示该行后后面紧跟的4...
2018-05-08 15:46:00 82096 4
原创 openwrt如何编译
Compile1.download && install feedscd trunk/base;./scripts/feeds update -a ./scripts/feeds install -a 2.download default config:cd trunk/basecat ../cusconfig/diffconfig > .configma...
2018-05-08 15:29:00 300
原创 svn
查看本机和服务器,有啥不同。类似于git statussvn st -qlbo@donglebuild2:~/work/code/test/openwrt7621/trunk/base$ svn st -qM package/ramips/appcustom/confapp/src/main.cM package/ramips/ui/luci-mtk/src...
2018-05-08 14:43:17 153
原创 cprintf
#define cprintf(fmt, args...) do { \ FILE *fp = fopen("/dev/console", "w"); \ if (fp) { \ fprintf(fp, fmt , ## args); \ fclose(fp); \ } \} while (0)
2018-05-08 13:08:30 256
原创 aaaaaaaaaa
json_object *parse_dhcp_list_2json(char* src_str,int index,json_object *rsp_dhcp_list_json){ char *delim=" "; char mac[64] = {0} ; char *p; char *q; int type; char *one ="1";...
2018-05-07 17:13:02 237
原创 Linux C语言调用system命令并获取命令的返回值
思路:popen打开,命令执行完后,对fp进行读取,读到output参数里面。 注意:size不要太大。一般64,128够用。用1024或者4028,会出现段错误,栈报错。 popen()可以执行shell命令,并读取此命令的返回值; popen()函数通过创建一个管道,调用fork()产生一个子进程,执行一个shell以运行命令来开启一个进程。可以通过这个管道执行标准输入输出操作。这个...
2018-05-07 16:25:58 13387
原创 openwrt 显示客户端client 连接的信息 /proc/net/arp /tmp/dhcp.leases
显示当前路由器上,client的name,ip,mac,connect_type信息有两种方式:来自链接 一。通过DHCP client分配列表 (缺点:client列表会根据超时时间刷新,一般超时时间为12h,) 二。通过arp缓存列表/proc/net/arp(缺点:arp刷新时间默认为30s,这个时间的误差可以接受。)主要讲解第二种方法: Flags: 0x0是找不到这台主...
2018-05-07 16:03:51 8680
原创 批处理 bat 改文件后缀名
1.新建一个TXT文件,内容写如下:ren *.tmp *.jpg2.把TXT改为BAT文件后缀名。 3.把这个BAT文件放在要改后缀的文件同目录下面。 4.双击BAT文件就可以了。ren openwrt-ramips-mt7621-mt7621-squashfs-sysupgrade.bin openwrt-ramips-mt7621-mt7621-squashfs-...
2018-05-04 10:44:55 10218
QSslConfiguration的demo
2023-03-10
qt-creator-opensource-linux-x86_64-4.2.0.run
2021-01-29
qt-everywhere-opensource-src-4.8.4.tar.gz
2021-01-29
linuxdeployqt-7-x86_64.AppImage
2021-01-28
Qt 文件的拖放 drag - drop.zip
2020-07-22
TortoiseGit-2.8.0.0-64bit和中文语言包.zip
2019-10-11
MTK WIFI 手册 MTK_Wi-Fi_SoftAP_Software_Programming_Guide_v1.2
2018-08-31
网站小偷工具 Teleport Ultra 中文简体破解版
2018-05-17
自用的source insigth 配置文件
2017-12-18
如何给Qlabel添加clicked属性Demo
2016-09-05
QtXlsxWriter和ActivePerl
2016-08-03
DateTimePicker:jQuery日期和时间插件
2015-12-01
使用Inno Setup打包发行软件的说明
2015-09-22
Inno Setup 汉化版
2015-09-22
基于socket的一个简单的server和client
2015-09-20
pciscope v3.00.004.zip
2015-07-30
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人