unix 中是否有像 MATLAB 中那样方便的自动完成功能来自动完成之前输入的命令?
我喜欢通过键入几个单词并按下按键来自动完成 MATLAB 中的先前命令。在 python IDLE 中也是如此。 unix shell 中有类似的东西吗?如果有帮助的话,我正在使用 csh。
I like how you can autocomplete previous commands in MATLAB by typing a few words and pressing the key. The same works in python IDLE. Is there an equivalent of that in unix shells? If it helps, I'm using csh.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我不知道在 csh 中,但在 bash 中你有几个命令来操纵历史记录。特别是,CTRL-R 可能很有用。查看更多信息:
http://www.delorie.com/gnu/docs/bash /bashref_97.html
I don't know in csh, but in bash you have several commands to manipulate the history. In particular, CTRL-R could be useful. See more in:
http://www.delorie.com/gnu/docs/bash/bashref_97.html
在 csh 中,您可以使用 历史替换 访问以前的命令(请参阅
man csh
)。示例:
In csh, you can access previous commands using history substitution (see
man csh
).Examples:
您可以像这样设置别名:
当您输入
prev foo
时,它会在历史记录中搜索所有出现的foo
并输出一个列表,如下所示:其中第一列是命令编号,第二个是执行时间,最后一个是命令。您可以通过输入
!<命令号>
来重新执行上一个命令You can set an alias like so:
when you type
prev foo
, it searches your history for all occurrences offoo
and spits out a list like so:where the first column is the command number, the second is the time it was executed and the last is the command. You can re-execute the previous command by typing
!<command number>
rlwrap
将 gnu readline 编辑功能添加到任何控制台命令中。rlwrap
adds gnu readline editing to any console command.与 Jesus 之前的回答相同,但有更多说明,
点击
CTRL + R
开始输入,瞧! (您可以多次点击CTRL+R
来循环匹配)双重答案,但如果人们像我一样快速阅读,他们会跳过答案,因为我读了“工具”一词并看到了我认为是的链接第三方工具,但它是内置的。
Same as previous answer by Jesus, but with more clarification
Hit
CTRL + R
start typing and voila! (you can hitCTRL+R
more times to cycle matches)Double answer but if people are speed reading like me, they will skip the answer since I read words "tool" and saw link I assumed it is 3rd party tool, but it comes built in.