![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
linux命令
zhi_cary
这个作者很懒,什么都没留下…
展开
-
linux查找系统所有文件的指定内容
xargs grep test* : 是查找find路径的文件内的内容 “test*”find / : 是搜索所有文件。原创 2023-01-17 19:49:37 · 232 阅读 · 0 评论 -
ubuntu 20.04 工控机定时断开网卡问题
机器人上的工控机,新装了ubuntu 20的系统,发现定时网卡会关闭,导致 ssh 链接断开;查看工控机网口灯断开时是熄灭的;打印系统日志查看:cat /var/log/syslog发现网卡设备管理休眠了;再次确认,输入指令:systemctl status sleep.target确认是休眠导致,禁止系统休眠就行。输入指令:sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target原创 2021-11-12 14:21:30 · 1717 阅读 · 0 评论 -
linux 指令记录
c++filt 还原函数名c++filt ZN36rosidl_typesupport_introspection_cpp31get_message_type_support_handleIN22unique_identifier_msgs3msg5UUID_ISaIvEEEEEPK29rosidl_message_type_support_tvrosidl_message_type_support_t const* rosidl_typesupport_introspection_cpp::get_m原创 2021-11-05 18:11:22 · 757 阅读 · 0 评论 -
linux 播放音频
1、指令播放音频我我使用的是 aplay 指令,是 alsa 的一个指令,也就是说需要先安装有 alsa,由于我 linux 本身就带有,所以我这边就没放安装过程了。2、查机器设备sudo aplay -l有的用户权限不够,不加 sudo 会发现没有设备;这里记下音响设备名称sudo aplay -L这里的指令参数不一样,前一个是小写 l,这里是大写的 L;这里会打印很多,找到 hw 的部分,设备名和前面的对的上,就说明设备被识别是正常的;3、播放音频sudo aplay -D hw原创 2021-09-15 14:48:32 · 5172 阅读 · 0 评论 -
守护进程脚本
守护进程读取配置文件的参数,根据参数去守护对应的进程,参数的设置可以由对应进程的启动脚本去更新参数;守护脚本内容#!/bin/bashconf=./daemon.conf #配置文件if [ ! -d "/opt/ros/log/daemon/" ]; then mkdir /opt/ros/log/daemon/filog=/opt/ros/log/daemon/daemon-`date "+%Y-%m-%d"`.logapp_num=0 #记录进程数ap原创 2021-06-22 16:48:25 · 1099 阅读 · 0 评论 -
linux 多进程开机脚本
此处参考linux本身的开机脚本模式会自动开启同目录下 S+两位数字的(S01-zhi) 脚本,并带 start 参数开启;将各进程的开机脚本按 Sxx 的格式命名即可;#!/bin/bash# Start all init scripts in path# executing them in numerical order.#path=`pwd`for i in $path/S??* ;do # Ignore dangling symlinks (if any). [原创 2021-06-21 16:01:03 · 154 阅读 · 0 评论 -
linux 时间校准
linux 设备有对时需求时,可用的操作一、采用指令,适合脚本方式1、ntpdatentpdate ntp.aliyun.com此指令如果设备没网或者服务器没响应,超时等待相对较久;在代码用 system 调用时,没有结果返回,无法知道成功还是失败;2、sntpsntp -S ntp.aliyun.com此指令超时响应会比 ntpdate 短;在代码用 system 调用会有结果返回,0为成功,其他值为失败;二、c语言代码实现,适合应用方式#include <stdio.h&原创 2021-06-16 14:22:57 · 708 阅读 · 0 评论 -
rm 删除目录内所有文件报错
-bash: /bin/rm: Argument list too long原因是目录内文件太多, 超出shell 参数个数限制所致解决方法ls | xargs -n 10 rm -fr ls结合 ls 10个文件一组删除原创 2021-06-04 09:46:11 · 124 阅读 · 0 评论 -
Linux给指定用户加sudo权限
Linux给指定用户加sudo权限1、在 /etc/gshadow 文件的 sudo 后加上指定的用户sudo:*::aaa,bbb2、在 /etc/group 文件的 sudo 后加上指定的用户sudo:x:27:aaa,bbb两个文件都改完即可生效原创 2021-02-03 12:11:20 · 195 阅读 · 1 评论 -
iperf 灌包报错
iperf 灌包报错linux开发板做iperf 服务器,windows 10 做客户端linux服务器端iperf -swin客户端.\iperf3.exe -c x.x.x.xiperf3: error - received an unknown control message会报如上错误错误原因:linux的iperf版本是2.0.13;win的iperf版本是3.1.3;版本不一致导致的,重新从官网下了个win的iperf,版本是2.0.9,再灌包正常。.\iperf3.exe原创 2020-10-14 11:50:02 · 4265 阅读 · 2 评论 -
linux 网络命令
IP 命令清除usb0网卡的IPip addr flush dev usb0删除网桥 br-lanip link delete br-laniptables打开nat功能echo 1 > /proc/sys/net/ipv4/ip_forward清除nat规则iptables -t nat -F端口转发tcp 目标端口为16767,转发至192.168.234.167:16767iptables -t nat -A PREROUTING -p tcp --dport 16767原创 2020-08-13 17:48:21 · 263 阅读 · 0 评论