工具与资源github.com
UP:带即时预览编写 Linux 管道的工具
UP: A tool for writing Linux pipes with instant live preview
2018 — 2021,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
up 是一个交互式命令行工具:把任意命令的输出接给它后,可以即时输入后续管道命令并实时预览结果,边试边拼出完整的 Linux 管道。它用 Go 编写,旨在让构建和调试 shell 管道变得更快、更直观。
为什么经久不衰:它把『试错式』拼管道的过程变成即时反馈,这个痛点多年不变,所以 2018 到 2021 反复登上首页,至今仍是学习 shell 管道的实用工具。
HN 评论精选
实时预览工具中逐字输入危险命令可能造成灾难性后果
小心 rm:逐字输入 r、rm、rm -、rm -rf、rm -rf ~、rm -rf ~/、rm -rf ~/tmp——我的文件去哪了?
ptman查看英文原文
Careful with rm: r rm rm - rm -rf rm -rf ~ rm -rf ~/ rm -rf ~/tmp # where did my files go?
赞赏工具的同时建议加沙箱保护,并顺带学到了新的 shell 技巧
这工具看起来有趣又实用!最好别以 root 运行,也许可以加个 --safe 标志,用 Docker 沙箱跑命令。我还第一次见到 paste - - 和 foo |& bar,工作这么多年还能学到新技巧真难得。
pjungwir查看英文原文
This looks like a fun and helpful tool! (Perhaps best to ignore the notice from lshw and not run it as root, ha ha. Maybe even only in some kind of sandbox. I bet they could add a --safe flag so it would make an on-the-fly Docker image with a copy of your cwd, and run the commands in there. Then you have different problems I suppose, but still....) I've never seen `paste - -` before, but that is amazing too! I can't count how many times I've wanted something like that. Surely that will help my own shell pipelines in the future. Also I've never seen `foo |& bar` before. What a neat idea! The surprisingly-valid creativity of it reminds me of Duff's Device. Has anyone else ever found uses for that idiom? After so many years working in the shell, it's such a rare and delightful treat to learn new tricks. Thank you for sharing this with us!
担心交互式执行带来的副作用风险
工具自带警告:写入 rm 或 dd 之类的命令可能像拿着电锯乱跑。副作用对我来说总像潜在的灾难。
crvdgc查看英文原文
> WARNING: Please be careful when using it! It could be dangerous. In particular, writing "rm" or "dd" into it could be like running around with a chainsaw. But you'd be careful writing "rm" anywhere in Linux anyway, no? Side effects always seems like potential disasters for me.
分享不依赖该工具的替代方案:watch 加文件迭代,以及管道中间日志技巧
为了快速迭代管道,我把命令写进文件用 watch -n1 运行,容易修改、可临时注释部分内容。还写了个 plog 函数,用 tee 在管道中间步骤打印日志查看发生了什么。
rgrau查看英文原文
For fast iteration with pipes, using only basic unix tools, and arguably less risky to fat-fingering, I write it in a file, and use watch -n1. Easy to modify, temporarily comment parts of it, etc... Also, I wrote this plog function (for pipe-log, or something): plog() { local msg=${1:-plog} tee >(sed -e "s/^/[$msg] /" | cat 1>&2 ) } That allows me to see what's happening in the middle steps of the pipeline. I ended up compiling a list of tricks like that in https://raimonster.com/scripting-field-guide/ , in case anyone is interested (and feedback is appreciated)
历次讨论
同类还值得读
直接在浏览器中启动 Linux 内核
Boot a linux kernel right inside your browser.
Fabrice Bellard 的 JSLinux 页面,用 JavaScript 在浏览器里启动一个 Linux 内核,并提供一个可交互的终端环境。
工具与资源上首页 5 次 · 2011–2025bellard.orgHacker News 未公开功能与行为清单(2018)
A List of Hacker News's Undocumented Features and Behaviors (2018)
数据科学家 Max Woolf 整理的 Hacker News 未公开功能与行为清单,涵盖投票机制、排名算法、账号惩罚等社区运作细节。
工具与资源上首页 5 次 · 2019–2025github.comMapSCII:在终端中用盲文和 ASCII 渲染地图
MapSCII – Braille and ASCII map renderer for the console
MapSCII 是一个在命令行终端里渲染地图的开源工具,用盲文字符和 ASCII 字符把地理数据画成可交互浏览的字符地图。
工具与资源上首页 5 次 · 2017–2025github.com顶尖大学的免费在线课程
Free Online Courses from Top Universities
Open Culture 整理的一份免费在线课程合集,汇集了全球顶尖大学(如 MIT、斯坦福、耶鲁等)向公众开放的网络课程资源,涵盖音频、视频等多种形式。
工具与资源上首页 5 次 · 2010–2022openculture.com淘气字符串:容易引发用户输入问题的字符串清单
Naughty Strings: A list of strings likely to cause issues as user-input data
一个 GitHub 仓库,收录了大量容易让程序出问题的用户输入字符串,如特殊字符、emoji、SQL 注入片段、系统命令等,供开发者用于测试输入处理逻辑。
工具与资源上首页 4 次 · 2015–2020github.com