news 2026/5/19 16:45:57

ROS学习(五)清理日志

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
ROS学习(五)清理日志

背景

磁盘文件:rclpy 在终端输出日志的同时把日志写入 ~/.ros/log/<时间戳>/<节点名>.log,每次启动会建一个新目录;~/.ros/log/latest 是软链接指向最新一次
用 ros2 run 跑时,路径里能看到 servo_control_demo.log;
用 ros2 launch 跑时,还会有一份合并日志 launch.log。

清理7天前的日志

原样执行

# 先看看会删哪些(dry run,不真删)
find ~/.ros/log -mindepth 1 -maxdepth 1 -type d -mtime +7

# 确认没问题后再真删
find ~/.ros/log -mindepth 1 -maxdepth 1 -type d -mtime +7 -exec rm -rf {} +

清理命令-别名设置

查看当前shell

echo $0

1 如果shell是bash

# 1) 把别名追加到 ~/.bashrc(用 grep 防止重复添加)

grep -qxF "alias ros-logclean='find ~/.ros/log -mindepth 1 -maxdepth 1 -type d -mtime +7 -exec rm -rf {} +'" ~/.bashrc \ || echo "alias ros-logclean='find ~/.ros/log -mindepth 1 -maxdepth 1 -type d -mtime +7 -exec rm -rf {} +'" >> ~/.bashrc

# 2) 让当前终端立即识别新别名

source ~/.bashrc

2 如果shell是zsh

# 防重复追加

grep -qxF "alias ros-logclean='find ~/.ros/log -mindepth 1 -maxdepth 1 -type d -mtime +7 -exec rm -rf {} +'" ~/.zshrc \ || echo "alias ros-logclean='find ~/.ros/log -mindepth 1 -maxdepth 1 -type d -mtime +7 -exec rm -rf {} +'" >> ~/.zshrc

# 立即生效

source ~/.zshrc

用别名执行清理

ros-logclean
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/5/19 16:43:05

深度解析SacreBLEU:构建机器翻译评估的标准化技术栈

深度解析SacreBLEU&#xff1a;构建机器翻译评估的标准化技术栈 【免费下载链接】sacrebleu Reference BLEU implementation that auto-downloads test sets and reports a version string to facilitate cross-lab comparisons 项目地址: https://gitcode.com/gh_mirrors/sa…

作者头像 李华
网站建设 2026/5/19 16:35:47

从零部署Hermes大模型:vLLM与FastAPI构建私有化LLM服务

1. 项目概述&#xff1a;一个为Hermes模型量身定制的部署工具箱 如果你最近在关注大语言模型&#xff08;LLM&#xff09;的本地部署&#xff0c;尤其是那些能在消费级硬件上流畅运行的“小钢炮”模型&#xff0c;那么“Hermes”这个名字你大概率不会陌生。它不是一个单一的模型…

作者头像 李华