Linux 查找包含特定关键词的文件
grep -r -E 'word1|word2|word3' yourpath > gather.log
如果要and关系查找,则要用管道
grep pattern1 files| grep pattern2
参考:
- https://blog.csdn.net/rocklee/article/details/106943399
Linux 清理内存
参考:
- https://unix.stackexchange.com/questions/58553/how-to-clear-memory-cache-in-linux
- How to Clear RAM Memory Cache, Buffer and Swap Space on Linux
使用命令:sudo sh -c "echo 1 > /proc/sys/vm/drop_caches"
git 使用相关
git mergetool 使用vimdiff解决conflict
参考:https://stackoverflow.com/questions/14904644/how-do-i-use-vimdiff-to-resolve-a-git-merge-conflict
- 输入
:qc
退出当前文件,暂时放弃merge - 输入:
navigate to the bottom buffer (merge result): Ctrl-W j
navigate to next diff with j/k; or, better, use ] c
and [ c
to navigate to the next and previous diff respectively
use z o while on a fold to open it, if you want to see more context
for each diff, as per @chepner’s answer, you can either get the code from a local, remote or base version, or edit it and redo as you see fit
to get it from the local version, use :diffget LO
from remote: :diffget RE
from base: :diffget BA
from local: diffget LO
or, if you want to edit code yourself, get a version from local/remote/base first, and then go to the insert mode and edit the rest
once done, save the merge result, and quit all windows :wqa
if you want to abort merging the current file and not mark it as resolved, quit with :cquit instead: How do you cancel an external git diff?
normally, git detects that the merge was made and creates the merge commitL
批量kill进程
ps -ef | grep test | grep -v grep | awk '{print $2}' | xargs -i kill -9 {}
说明:
- 第一个grep用于获取相关进程;
- 第二个grep用于除去grep自身进程
- awk用于找到对应的pid
批量更改文件名称
rename -v 's/images.npy/images_org.npy/' `find . -name *images.npy`
rename的用法是:rename `s/org_string/new_string/` {文件列表}
Find 配合 xargs
find ./ -maxdepth 1 -name "*" | xargs -i rosbag play {}
FFmpeg
ffmpeg -start_number 837 -f image2 -framerate 24 -y -i frames/frame_%010d.png -pix_fmt yuv420p -frames:v 100 sequence_0000000950.gif
其中 -pix_fmt yuv420p 定义图片的数据格式;如果报错,可以去掉使用默认值;-start_nunmber为起始图片序号;-frames:v 为图片序列长度
ffmpeg -start_number 837 -f image2 -framerate 24 -y -i frmaes/frame_%010d.png -pix_fmt yuv420p outdoor_day2_data_cut.mp4
ROS
rosrun image_view extract_images image:=/cam0/image_raw _sec_per_frame:=0.01
其中 _sec_per_frame 定义每秒中保存图像的数量,如果比实际的数量低,则保存bag文件中所有的图像。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)