如何获取“命令缓冲区” 在 Solaris 10 中?
在 linx CShell 上工作时,您可以选择按向上/向下箭头来选择最后输入的命令或命令缓冲区。 这甚至适用于 Windows。
然而,在我最近切换到的 Solaris 上工作时,这不起作用。 我猜这个 shell 也是一个 CShell。
请告诉我在 Solaris 上需要什么组合键才能使用此功能?
When working on a linx CShell u get the option to press the up / down arrows to select the last command/s typed or the Command Buffer. This even works on Windows.
However this is not functional when working on Solaris, to which i recently switched. I am guessing that the shell is also a CShell.
Please tell me what key combination is required to have this feature on Solaris ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
Solaris 中的默认 shell 具有命令历史记录,但您也可以使用 Bash,它对用户更加友好。 只需在命令行中输入“bash”(不带引号)即可。 您还可以编辑 /etc/passwd 以使 bash 成为默认 shell。
The default shell in Solaris has command history, but you can also use Bash instead, it's more user friendly. Just type 'bash' (no quotes) at the command line. You can also edit /etc/passwd to make bash your default shell.
Solaris 的“官方”默认 shell 实际上是
sh
,即原始的 Bourne shell(请参阅 Solaris 高级用户指南第 10 章 了解更多信息)。 如果您想将其更改为csh
或tcsh
,并且您不是root
(通常认为使用除sh
作为root
的默认设置)—只需发出passwd -e /path/to/shell_of_your_choice
。 我猜这可能看起来像passwd -e /bin/csh
,但您可能首先要确保它存在。The "official" default shell for Solaris is actually
sh
, the original Bourne shell (see Chapter 10 of the Advanced User Guide for Solaris for more info). If you'd like to change it tocsh
ortcsh
—and you're notroot
(it's generally considered bad practice to use anything butsh
asroot
's default)—just issuepasswd -e /path/to/shell_of_your_choice <loginname>
. I'm guessing this would probably look likepasswd -e /bin/csh <loginname>
, but you'd probably want to make sure it exists, first.可能是 Korn shell,在这种情况下尝试k。
bash 至少允许您使用“set -o vi”或“set -o emacs”切换模式。
It may be that it's the Korn shell in which case try <ESC>k.
bash at least will allow you to switch modes with "set -o vi" or "set -o emacs".
也许您可以使用 !! 命令来重复上一个命令。
Maybe you can use the !! command, to repeat the previous one.
使用“echo $SHELL”查看您的登录 shell 是什么。 如果是 ksh 或 bash,请尝试“set -o emacs”。 如果有效,您将能够使用 ^P 返回命令。 ^R 可让您搜索命令,^F 和 ^B 可在命令内移动。
Use "echo $SHELL" to see what your login shell is. If it's ksh or bash, try "set -o emacs". If that works, you'll be able to use ^P to go back a command. ^R lets you search for a command, ^F and ^B to move around within the command.
如果您无法更改默认 shell,或者您只是想尝试一个有效的 shell,则可以从命令行启动任何其他 shell。 我推荐您 tcsh,它将使用箭头键进行良好的命令行编辑和历史记录。 在提示符处输入 /bin/tcsh 进行尝试。 如果您喜欢 tcsh,可以使用之前的响应来更改默认 shell。 确保 $HOME/.cshrc 文件中有以下内容:
set filec
set History=1000 # 或其他一些大数字
set autologout=0 # 如果您使用您的帐户远程登录。
我希望这有帮助。
If you can´t change your default shell, or you just want to try out one that works, you can kick off any other shell from your command line. I recommend you tcsh, which will have good command line editing and history using the arrow keys. Type /bin/tcsh at your prompt to try it out. You can use the earlier responses to change your default shell if you like tcsh. Make sure your have the following in your $HOME/.cshrc file:
set filec
set history=1000 # or some other large number
set autologout=0 # if you are logging in remotely under your account.
I hope this helps.
如果您使用 BASH,则可以通过键入来暂时启用历史记录
,这将启用向上和向下键并存储 1000 个命令。 暂时断开连接后,所有历史记录都将消失。
这适用于 Solaris 10。
对于永久解决方案,请将这些行添加到 ~/.bashrc
You enable history temporarily if you use BASH by typing
which will enable up and down keys and store 1000 commands. After termal disconnetion all history will be gone.
This works on solaris 10.
For permanent solution add these lines to ~/.bashrc