如何停止显示`ls`的长文件列表?

Fre*_*ind 8 linux putty ls

有一个大目录,在远程服务器上包含100k文件,我输入命令:ls在我的putty中.

它开始显示一个很长的文件列表,似乎永远不会结束.

如何在不关闭腻子计划的情况下阻止它?

rak*_*ib_ 6

您可以使用lessmore命令控制 ls 输出,如下所示:

ls | more
ls | less
Run Code Online (Sandbox Code Playgroud)

他们将以交互方式工作。或者您可以使用 head 或 tail 命令截断输出,例如:

ls | head
ls | tail
Run Code Online (Sandbox Code Playgroud)

head 将显示从 head 开始的默认 10 行,tail 将显示从 tail 开始的默认 10 行。


jul*_*mme 4

如果结束SSH,可以使用转义序列。例如,要发送中断,请按:

enter~B

当然不输入“enter”,只需按回车键(我想“重置”当前命令缓冲区)

其他有趣的

终止超时会话

enter~.

发送转义字符

enter~~

您可以使用以下命令列出这些命令

enter~?

在我的系统上,上面打印:

# ~?
Supported escape sequences:
  ~.  - terminate connection (and any multiplexed sessions)
  ~B  - send a BREAK to the remote system
  ~C  - open a command line
  ~R  - Request rekey (SSH protocol 2 only)
  ~^Z - suspend ssh
  ~#  - list forwarded connections
  ~&  - background ssh (when waiting for connections to terminate)
  ~?  - this message
  ~~  - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)
Run Code Online (Sandbox Code Playgroud)