使用命令行进行组织:命令库
我们每天都会创建/发现新的有用的命令(我确实......),但第二天我就忘记了它们,最重要的是那些复杂的命令管道......我使用历史| grep 但这还不够。
我想要一个程序来保存和分类我最喜欢的命令,以便您轻松搜索并执行它们。
如果你知道的话那就太好了 如果没有,我正在写一个..你不认为这是一个好主意吗?
we all create/discover new and useful commands every day (I do...) but I forget them the day after, above all those complicated command pipes.. I use history | grep but that's not enough.
I'd like a program to save and categorize my favorite commands, that lets you search them and execute them easily.
If you know any, that'd be cool
if not, I'm writing one.. don't you thing this is a good idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
在 Windows 上:Slickrun 可以提供帮助。 我将所有快捷方式和命令都放在这里,并将其附加到 WIN-R 键,这样我就可以轻松访问它们! 请参阅此处:http://www.bayden.com/SlickRun/
On windows: Slickrun helps here. I put all my shorcuts and commands in here and I attach it to the WIN-R key so I can get to them easily! See here : http://www.bayden.com/SlickRun/
好的,我正在写一篇!
这是一个简单的 ruby 脚本,命令保存在 yaml 文件中,每个命令都有标题、描述和实际命令。
如果它可用的话,也许我会把它发布到某个地方。 最大的问题是执行命令:我想在当前 shell 中执行它们,并且也许能够在执行之前编辑它们,所以唯一的方法是将它们复制并粘贴到同一个终端中。
我正在使用 osascript (applescript) 自动执行此操作,因此它只能在 OS X 上运行。
谢谢大家
OK, I'm writing one!
It's a simple ruby script, commands are saved in a yaml file, each one with a title, description and the actual command.
maybe I'll post it somewhere if it gets usable. The biggest problem is executing commands: I want to execute them in the current shell, and maybe be able to edit them before executing, so only way is to copy and paste them in the same terminal.
I'm automating that with osascript (applescript) therefore it'll work only on OS X.
thanks to you all
我只需使用
alias
并将它们存储在~/.bashrc
或~/.bash_profile
中。如果您需要记住别名,您可以使用 # 注释别名条目,并使用 alias 命令来列出它们。
I'd just use
alias
and store them in~/.bashrc
or~/.bash_profile
.If you need to remember your aliases you could comment the alias entries with # and alias a command to list them.
将以下行添加到您的 .bashrc:
现在您可以使用 CTRL+R 或打开 ~/.bash_history 找到所有旧命令。
如果您想记录一些更复杂的组合,请将它们作为函数添加到
.bashrc
中:Add the following lines to your .bashrc:
Now you can find all your old commands using
CTRL+R
, or by opening ~/.bash_history.If you want to document some more complex combinations, add them as functions in your
.bashrc
:我个人会获得一份数字格式的基本快速参考表,并在进行时添加我自己的参考表(如果适合的话,可以在他们拥有的分组下或创建一个新组)。 如果使用 GUI shell,我会将其作为我的桌面,否则我会定期将其打印出来。
创建和使用更加简单,并且浪费的时间也少得多。
I personally would get a basic quick reference sheet in digital format and add my own to it as I go (under the groupings they have if it fits or creating a new group). If using a GUI shell I would make it my desktop, otherwise I'd periodically print it out.
Much simpler to create and use, and wastes a lot less time.
在 Bash 中按
Ctrl + R
可以向后搜索命令历史记录并执行匹配的命令。Pressing
Ctrl + R
in Bash lets you search command history backwards and execute matching commands.