
Linux
linux学习笔记
优惠券已抵扣
余额抵扣
还需支付
¥39.90
¥99.00
购买须知?
本专栏为图文内容,最终完结不会低于15篇文章。
订阅专栏,享有专栏所有文章阅读权限。
本专栏为虚拟商品,基于网络商品和虚拟商品的性质和特征,专栏一经购买无正当理由不予退款,不支持升级,敬请谅解。
天使也有爱
Stay hungry,Stay foolish
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
ubuntu下虚拟串口调试
调试原创 2023-02-06 11:02:45 · 822 阅读 · 1 评论 -
在x86和arm编译libmodbus
libmobus原创 2022-12-17 20:59:13 · 729 阅读 · 0 评论 -
线程间发布和订阅
#include <stdio.h>#include <malloc.h>#include <string.h>typedef unsigned char BOOL_T;typedef unsigned char U8_T;typedef signed char S8_T;typedef unsigned short U16_T;typedef signed short S16_T;type原创 2022-02-17 10:41:40 · 877 阅读 · 0 评论 -
修改qt pro文件适配x86和arm架构
外部.so库和相应头文件所在目录位置./x86_lib./arm_lib修改qt pro文件适配x86和arm架构TEMPLATE = appCONFIG += console c++11CONFIG -= app_bundleCONFIG -= qt#message("x86")#QT_ARCH是Qt5新增的,在Qt4上没效果#打印当前Qt构建套件的信息message($$QT_ARCH){}#表示arm平台构建套件contains(QT_ARCH, arm){win32原创 2022-01-22 13:02:32 · 416 阅读 · 0 评论 -
arm linux vsftpd 移植 以及vstftpd.conf配置
vstftpd.conf# Example config file /etc/vsftpd.conf## The default compiled in settings are fairly paranoid. This sample file# loosens things up a bit, to make the ftp daemon more usable.# Please see vsftpd.conf.5 for all compiled in defaults.## READ原创 2021-12-01 17:20:04 · 839 阅读 · 0 评论 -
tftp 开发板linux上传下载
(1)在Uboot下tftp上传下载操作:用处在uboot’下载内核、设备树文件tftp 0x80800000 zImage // 0x80800000在emmc里面内核写入读取地址tftp 0x83800000 100ask_imx6ull-14x14.dtb // 0x83800000 在emmc里面设备树写入读取地址1、下载 tftp addr file设置服务器ip地址setenv serverip 192.168.1.140saveenv // 保存设置下载 tftp 0x1原创 2021-11-18 09:12:03 · 753 阅读 · 1 评论 -
linux处理日志命令
1、#查找/home/vmuser/test下所有目录列表ls -F /home/vmuser/test | grep '/$'2、#把目录列表写入文件ls -F /home/vmuser/test | grep '/$' > log.txt3、#显示前几个文件列表tail -n 3 log.txt 4、#find linux 指定后缀_文件查找:find命令,文件名后缀find test/ -name "*.c" 5、连续执行多条命令popen("cd.. &&am原创 2021-11-08 22:46:54 · 627 阅读 · 0 评论 -
除了配置桥接还要ubuntu连外网编辑interfaces
sudo gedit /etc/network/interfaces# interfaces(5) file used by ifup(8) and ifdown(8)auto loiface lo inet loopbackauto ens33iface ens33 inet dhcp#address 192.168.1.137#netmask 255.255.255.0#gateway 192.168.1.1原创 2021-11-04 13:59:51 · 179 阅读 · 0 评论 -
时区设置 TZ设置
#查找含有/TZ=字符串的行并删除,添加新的TZ=""mount rw -o remount /sed -e ‘/TZ=/d’ /etc/profile > /etc/profile #/删除/etc/profile中含"/TZ="的行,将操作之后的结果保存到etc/profileecho “export TZ=‘Asia/Shanghai’” >> /etc/profilesource /etc/profilehwclock -s[root@EPC-M6G2C de]#原创 2021-10-26 14:22:18 · 1862 阅读 · 0 评论 -
linux socket 客户端不绑定端口号,系统自动分配端口
arm-linux-gnueabihf-gcc client_line.c Delay.c -o client -pthread./client 192.168.1.139 & // 不绑定端口号,系统自动分配./client 192.168.1.139#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <原创 2021-09-11 20:55:21 · 1353 阅读 · 0 评论 -
linux socket客户端断线自动重连
arm-linux-gnueabihf-gcc client_line.c Delay.c -o client -pthread服务器ip 192.168.1.139 ./client 192.168.1.139#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/socket.h>#include原创 2021-09-11 16:04:33 · 1461 阅读 · 0 评论 -
linux socket客户端输出本地ip端口和远程ip端口信息,本地不绑定端口号
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <unistd.h>#include <errno.h>#define S原创 2021-09-11 11:54:02 · 418 阅读 · 0 评论 -
Mac地址修改错误SIOCSIFHWADDR: Cannot assign requested address
Mac地址修改错误SIOCSIFHWADDR: Cannot assign requested address问题设置mac地址 11:22:33:44:55:66, 在OpenWrt正在开发的主trunk上就没有SIOCSIFHWADDR: Cannot assign requested address, 这个问题。但是到attitude adjustment最新的trunk上就出现了,估计是内核版本不同,导致都mac地址的限制不同导致。最新的反而不严格了?这个不科学啊。解决方法:http:/转载 2021-09-11 10:12:52 · 3633 阅读 · 2 评论 -
linux socket客户端简单测试程序
ubuntu编译:arm-linux-gnueabihf-gcc client_line.c -o client -pthread开发板运行:./client 192.168.1.139#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.原创 2021-09-11 10:04:42 · 241 阅读 · 0 评论 -
linux C语言设置网络ip和子网掩码
#include <netinet/in.h>#include <netinet/tcp.h> /* TCP_NODELAY */#include <unistd.h> /* for convenience */#include <limits.h>#include <time.h>#include <pwd.h>#include <signal.h> /* for SIG_ERR */#include &原创 2021-09-09 17:20:49 · 972 阅读 · 0 评论 -
buildroot 修改和保存xxx_defconfig make savedconfig错误解决
修改BR2_DEFCONFIG为自己对应的路径 gedit 100ask_imx6ull_defconfig找到BR2_DEFCONFIG,我的路径是:/home/book/Documents/imx6ul_buildroot/configs/imx6ulevk_defconfig## Commands#BR2_WGET="wget --passive-ftp -nd -t 3"BR2_SVN="svn --non-interactive"BR2_BZR="bzr"BR2_GIT="git"原创 2021-09-06 09:34:52 · 617 阅读 · 0 评论 -
imx6ull 网络根文件系统挂载
imx6ull 文件系统挂载1、解压文件系统不要原目录sudo tar jxvf rootfs.tar.bz2 -C /home/book/nfs_rootfs/2、设置从emmc启动setenv bootargs 'console=ttymxc0,115200 root=/dev/mmcblk1p2 rootwait rw'3、网络挂载nfs根文件系统setenv ethaddr 32:34:46:78:9A:DC setenv ipaddr 192.168.1.136setenv原创 2021-08-28 11:45:33 · 498 阅读 · 0 评论 -
当前及前几天按天统计、当前月及前几月按月统计
create table test( id integer PRIMARY KEY AUTOINCREMENT, time TEXT NOT NULL, mony REAL);insert into test (time, mony) values('2020-07-30 01:10:10', 100);insert into test (time, mony) values('2020-07-30 01:10:10', 120);i原创 2021-08-02 13:52:02 · 153 阅读 · 0 评论 -
Linux下利用backtrace追踪函数调用堆栈以及定位段错误
gcc -g -rdynamic main.c -o test#include <stdio.h>#include <stdlib.h>#include <stddef.h>#include <execinfo.h>#include <signal.h>void dump(int signo){ void *buffer[100] = {0}; size_t size; char **strings = NULL; i.转载 2021-07-03 17:35:01 · 274 阅读 · 0 评论 -
MQTT cJSONS资料
相关文章:cJSON结构体构建原创 2020-08-27 14:59:46 · 357 阅读 · 0 评论 -
linux杀所有指定进程脚本
#!/bin/bash#杀main1ps aux | grep "main1" |grep -v grep| cut -c 9-15 | xargs kill -9if [ $? -eq 0 ];then echo "main1 is kill"else echo "main1 not exit"fi#杀main2ps aux | grep "main2" |grep -v grep| cut -c 9-15 | xargs kill -9if [ $? -eq 0原创 2021-06-09 09:12:45 · 200 阅读 · 0 评论 -
查看开发板是否支持使用POSIX 消息队列
msq_open打开失败:失败原因:mq_open: Function not implemented底层还不支持posix的消息队列。解决方法:让内核支持posix消息队列make menuconfigGeneral setup —> [ ] POSIX Message Queues -> [*] POSIX Message Queues ...转载 2021-05-08 16:46:40 · 1111 阅读 · 0 评论 -
linux 进程通信共享内存+互斥锁
编译: gcc main1.c -o main1 -lpthread -lrt #include <sys/mman.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <sys/stat.h> #include <sys/wait.h> #include <pthread.原创 2021-05-08 10:50:48 · 509 阅读 · 3 评论 -
system V信号量用于线程互斥
#include <stdio.h>#include <sys/types.h>#include <sys/ipc.h>#include <sys/sem.h>#include <errno.h>#include <stdlib.h>#include <semaphore.h>#include <unistd.h>#include <pthread.h>union semun{原创 2021-05-07 17:59:44 · 122 阅读 · 0 评论 -
消息队列用于故障记录
编译:gcc progress2.c -o progress1 -lpthread -lrt#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <string.h>#include <sys/ipc.h>#include <sys/types.h>#include <sys/msg.h>#include <unistd.h原创 2021-04-30 10:59:30 · 121 阅读 · 0 评论 -
open权限说明
int open(const char *pathname, int flags); 功能:打开文件 pathname:文件的路径 flags:打开的权限 O_RDONLY, 只读 O_WRONLY, 只写 O_RDWR, 读写 O_NOCTTY, 当打开的是终端设备文件,不要把该文件当作主控终端。 O_TRUNC, 清空 O_APPEND, 追加 返回值:成功则返回打..原创 2021-04-29 18:09:08 · 973 阅读 · 0 评论 -
用两个消息对列实现线程发送接收消息队列通信
#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <string.h>#include <sys/ipc.h>#include <sys/types.h>#include <sys/msg.h>#include <unistd.h>#include <pthread.h>#define TYPE_A 1原创 2021-04-29 10:33:28 · 237 阅读 · 0 评论 -
linu单独编译设备树
在根目录下打开终端指定ARCH、CROSS_COMPILE、PATHexport ARCH=arm export CROSS_COMPILE=arm-linux-gnueabihf-export PATH=$PATH:/opt/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin编译设备树make dtbs V=1原创 2021-04-27 22:48:46 · 610 阅读 · 0 评论 -
Linux设备树 pinctrl-names状态
pinctrl-names = "default"; “sleep”状态,“default”状态,“idle”状态三种状态原创 2021-03-24 22:03:11 · 3586 阅读 · 0 评论 -
sqlite3 收益统计sql语句测试记录
sqlite> create table test (id INTEGER primary key autoincrement,time text not null,mony int);sqlite> sqlite> insert into test values(1,'2020-12-13 01:10:10',10);sqlite> insert into test values(2,'2020-12-14 01:10:10',10);sqlite> sqlit原创 2020-12-13 22:58:21 · 228 阅读 · 0 评论 -
Linux板子RTC时间设置和修改
之前使用开发板时发现每次开机后,系统的时间都恢复到初始状态1970年。比 如说硬件时间要设置为2008年6月29日20时50分10秒,则应该先用date 062920502008.10,然后用命令:hwclock -w,这样RTC时间就跟系统时间一致了。1、方法一通用的设置格式:date 月日时分年.秒 即date -s [MMDDhhmm[[CC]YY][.ss]]设置系统时间:date 062920502020.10因此完整的设置RTC的时间可执行如下命令:date -s date 062原创 2020-12-11 11:47:43 · 5520 阅读 · 0 评论 -
编译linux gdb+gdbserver
我这边选跟发行版ubuntu系统一样的gdb版本查看发行版系统gsb版本gdb -v1、编译gdbvmuser@ubuntu:~/gdb-8.1/gdb/gdbserver$ sudo apt-get install texinfovmuser@ubuntu:~/gdb-8.1/gdb/gdbserver$ make distcleanvmuser@ubuntu:~/gdb-8.1/gdb/gdbserver$ ./configure -target=arm-linux-gnueabihf -原创 2020-12-06 16:22:33 · 279 阅读 · 0 评论 -
sqlite3使用简单示例
#include <stdio.h>#include "sqlite3.h" #define PATH_IPWALL_DB "./test.db"#define IPWALL_TBNAME "think_test" int main(){ sqlite3 *db; char sql[128]; char **result; char *zErr; int nrows, ncols; int原创 2020-12-03 10:28:04 · 516 阅读 · 2 评论 -
共享内存进程通信和进程、线程同步互斥都用有名信号量
progressA.c/* example.c*/ #include <sys/mman.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <sys/stat.h> #include <sys/wait.h> #include <pthread.h> #includ原创 2020-12-01 20:41:37 · 154 阅读 · 0 评论 -
sqlite3编译
编译: gcc -o main main.c sqlite3.c -lpthread -ldl原创 2020-11-18 23:42:08 · 184 阅读 · 0 评论 -
Linux socket can调试测试记录
每次重新设置Can参数必须先关闭ifconfig can0 down比如要重新设置波特率为1Mip link set can0 type can bitrate 1000000 #设置波特率为 1M开启ifconfig can0 up原创 2020-11-18 09:30:54 · 1336 阅读 · 3 评论 -
用两个消息对列实现线程消息队列双向通信
#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <string.h>#include <sys/ipc.h>#include <sys/types.h>#include <sys/msg.h>#include <unistd.h>#include <pthread.h>#define TYPE_A 1原创 2020-11-17 11:41:44 · 607 阅读 · 2 评论 -
消息队列用于双向进程通信
progressA.c#include<stdio.h>#include<unistd.h>#include<stdlib.h>#include<string.h>#include<sys/ipc.h>#include<sys/types.h>#include<sys/msg.h>#include <unistd.h>#define PROGRESS_A 1 //消息类型 #defin原创 2020-11-16 23:38:36 · 221 阅读 · 0 评论 -
进程互斥和线程互斥
progressA.c编译:gcc progressA.c -o progressA -lpthread -lrt运行:./progressA进程互斥:有名信号量线程互斥:互斥锁/* example.c*/ #include <sys/mman.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include &l原创 2020-11-16 21:19:43 · 317 阅读 · 0 评论 -
Ubuntu下创建虚拟调试串口
转载自ubuntu使用虚拟can(vcan)1.sudo modprobe vcan加载虚拟can模块2.sudo ip link add dev can0 type vcan添加can0网卡3.ifconfig -a查看can0相关文章:linux can canutils工具移植can-utils 进行简单的收发测试如何发送或接收 CAN 数据...转载 2020-11-14 22:21:47 · 1180 阅读 · 0 评论