OOZOU
与我们联系
返回 TIL 列表今日所学

shell

来自 OOZOU 团队的 shell 笔记,共 30 篇。

全部主题shell 30ruby on rails 22ruby 12macos 10vim 7figma 4cli 3javascript 3heroku 1elixir 1
shellDecember 8, 2020

在 Bash 和 Zsh 运行无痕/私密命令

只要在命令前面加一个空格,它就不会被存进 ~/.bash\_history。例如 qrencode -o out.png "Some secret text"

shellOctober 22, 2020

用 homebrew 升级 postgres 数据库

要升级 postgres,可以运行

shellOctober 13, 2020

用 Amazon AWS S3 CLI 复制文件并设置权限

打开 term(或同类终端)并粘贴下面的内容:

shellOctober 13, 2020

愤怒的 Docker 大清除

如果你在 Docker 上遇到 No Space left 错误,这是暴力解法:

shellOctober 13, 2020

用相同文件名 + 前缀来备份文件

注意:其实你可以在任何命令中使用 !#:1,因为它代表传给该命令的最后一个参数。

shellOctober 13, 2020

Bash alias 与魔法

我在用户目录下单独放了一个文件 ~/.aliases,用来存放我所有的 bash alias。我很常用 alias,也经常新增,所以写了一个 bash function 来随手添加…

shellOctober 13, 2020

查询 IKEA 商品库存

如果你正在等某件 IKEA 商品补货,这里有一个能自动掌握最新状态的实用解法。这篇指南会说明如何用 shell script 检查 IKEA 的库存状况,并在…

shellOctober 13, 2020

用 shell script 检查命令是否存在

用 shell script 检查命令是否存在

shellOctober 13, 2020

创建你自己的 git 命令(alias)

有没有想过把 git 命令缩短一点?你当然可以用 shell alias,但那样得时刻记住上下文,才不会忘记每个 alias 代表什么。其实你可以用 alias 在 git 里定义自己的…

shellOctober 13, 2020

删除 Git 中已经 merge 的 branch

你可以在 egrep -v 'master|develop|foo|bar' 里加上更多想保留的 branch

shellOctober 13, 2020

删除已 merge 的 git branch

删除所有已经 merge 的本地 git branch 的实用 git 命令 git branch --merged | egrep -v "(^\\|master|dev)" | xargs git branch -d*

shellOctober 13, 2020

在 Git 中比较本地文件与远程版本的差异

只要运行下面这条命令,就能拿到与远程版本的 diff

shellOctober 13, 2020

根据 commit 找出所属的 branch

c198bb715 Make default expired description logic pretty `

shellOctober 13, 2020

把先前的 commit 强制 push 到 repo

如果你已经 push 了一些代码,想要 force push 某个较早的 commit,可以这样做 shell git push origin +commit\sha^:branch\name

shellOctober 13, 2020

获取当前的 git branch 名称

获取当前的 git branch 名称

shellOctober 13, 2020

浏览单个文件的 Git 历史记录(GUI)

浏览单个文件的 Git 历史记录(GUI)

shellOctober 13, 2020

终止卡住的 rails

我想终止在特定 port 上运行的 rails。(我的笔记本上跑着好几个 rails 服务器。)

shellOctober 13, 2020

终止无响应的 SSH session

SSH session 偶尔会失去响应。如果我让笔记本进入睡眠,这种情况相当常见。与其直接关掉标签页,你可以使用 SSH Escape Characters 来终止 session

shellOctober 13, 2020

列出目录结构并排除一个或多个目录

想过在显示当前目录结构时排除一两个目录吗?

shellOctober 13, 2020

用 hub 从命令行创建 pr

先用 brew 安装 hub:brew install hub 然后使用像下面示例这样的简单命令:hub pull-request -m "best pr ever" -b oozou:develop -h feature/awesome-improvements

shellOctober 13, 2020

从你的 branch 移除不要的 commit

从你的 branch 移除不要的 commit

shellOctober 13, 2020

在 Git 中还原被删除的文件

在 Git 中还原被删除的文件

shellOctober 13, 2020

对不同的输入重复运行同一条命令

如果你必须对不同的输入重复运行同一条命令。

shellOctober 13, 2020

查看先前 commit 中被删除的文件 [git]

查看先前 commit 中被删除的文件 [git]

shellOctober 13, 2020

用 cURL 发送消息到 Slack

Slack 允许你通过 Webhooks 服务发送消息

shellOctober 13, 2020

对旧的 repo 做 shallow clone

如果你接下来要开发的 repo 不需要完整的 git 历史,可以指定 clone 深度,只 clone 这个 repo 的 x 个 revision。

shellOctober 13, 2020

用 `host` 获取更多域名信息

你可能会用 dig 从 DNS 服务器查询域名的 A/CNAME/MX 等记录。但如果只是想快速看个概况,就用 host 吧:

shellOctober 13, 2020

使用 Git 的 aliases 功能

Git 允许你通过 config 在内部创建 alias。你的全局 config 应该位于 ~/.gitconfig

shellOctober 13, 2020

在 Github 上监控 CI 状态

安装了 Github 的 hub 之后,你可以像这样获取当前 branch 的 ci-status:

shellOctober 13, 2020

列出文件树的 Zsh function

在命令行浏览目录时,若能以“tree”格式查看目录和子目录的结构,通常会很有帮助。虽然已经有很多现成工具,例如…

有项目想法吗?

我们很想听听您正在做的产品。

开始对话hello@oozou.com
OOZOU Logo

曼谷 · 新加坡 · 香港

X
Facebook
Instagram
LinkedIn
OOZOU Co., Ltd.
548 One City Centre
Ploenchit Road
Bangkok 10330
Thailand
+66 2544 0000
hello@oozou.com

服务

  • Web 开发
  • AI 智能体与生成式 AI
  • 移动应用开发
  • 数据分析与工程
  • UI/UX 与产品设计
  • 数字化转型

公司

  • 关于我们
  • 加入我们
  • 博客
  • 案例研究
  • Today I Learned
  • 联系我们

更多

  • 行业
  • 合作伙伴网络
© 2026 OOZOU. 版权所有。
隐私政策行为准则反贿赂反贪腐政策