Pan*_*dya 41 command-line gnome-terminal execute-command
如何在另一个终端窗口中运行任何命令?
示例:我打开了一个终端窗口,如果我运行类似 的命令apropos editor,则它会在该窗口上运行并输出。但我想在另一个终端窗口(新窗口)上运行相同的命令,而不是在第一个终端的当前窗口上运行。
进一步说明:
我需要suggest-command <command>打开新的终端窗口并运行<command>该(新打开的)窗口中提到的。(suggest-command命令的建议示例在哪里。)
怎么做?
cha*_*aos 37
这可能是您搜索的内容:
gnome-terminal -e "bash -c \"!!; exec bash\""
Run Code Online (Sandbox Code Playgroud)
或(不久):
gnome-terminal -x sh -c "!!; bash"
Run Code Online (Sandbox Code Playgroud)
它打开GNOME终端与你的最后一个命令(!!)执行,并保持与外壳的命令输出开路,即使像交互式命令top或less...
在你的情况下:
gnome-terminal -e "bash -c \"apropos editor; exec bash\""
Run Code Online (Sandbox Code Playgroud)
或者
gnome-terminal -x sh -c "apropos editor; bash"
Run Code Online (Sandbox Code Playgroud)
Oli*_*Oli 10
启动您要运行的任何终端的另一个实例:
xterm -hold -e 'apropos editor' &
Run Code Online (Sandbox Code Playgroud)
请注意-hold. 大多数终端将在运行您提供给它们的命令后退出。网站上已经有十几个关于这个的问题:
另一种方法是使用需要退出的应用程序。nano将保持开放状态。如果您只是输出到屏幕,则可以将其通过管道输入less:
xterm -e 'apropos editor | less' &
Run Code Online (Sandbox Code Playgroud)
也就是说,在您的情况下(正如其他两个所说),您只需打开另一个终端并运行您的命令似乎更容易。
每个终端甚至是一个程序,您可以像任何其他程序一样启动它,将&其置于后台,提供参数列表等。
使用哪个终端首先取决于您使用的系统的可用性(如果它们已安装或未安装),其次取决于它们的特性,然后取决于您的个人品味。
konsole --hold -e "ls" &
xterm -hold -e "ls" &
gnome-terminal -e "ls" & ...
Run Code Online (Sandbox Code Playgroud)
请注意-holdofxterm和--holdof之间的区别konsole。
每个实现都有不同的选项,您必须通过帮助进行检查。甚至可以以不同的方式调用帮助。您会发现它man konsole不起作用,因此您必须直接向可执行文件询问--help.
这是您可以在系统上搜索的终端列表
aterm - AfterStep terminal with transparency support
gnome-terminal - default terminal for GNOME
guake - A dropdown terminal for GNOME
konsole - default terminal for KDE
Kuake - a dropdown terminal for KDE
mrxvt - Multi-tabbed rxvt clone
rxvt - for the X Window System (and, in the form of a Cygwin port,
for Windows)
rxvt-unicode - rxvt clone with unicode support
xfce4-terminal - default terminal for Xfce desktop
environment with dropdown support
Terminator - is a GPL terminal emulator. It is available on
Microsoft Windows, Mac OS X, Linux and other Unix X11 systems.
Terminology - enhanced terminal supportive of multimedia
and text manipulation for X11 and Linux framebuffer
tilda - A drop down terminal
wterm - It is a fork of rxvt, designed to be lightweight, but still
full of features
xterm - default terminal for the X Window System
Yakuake - (Yet Another Kuake), a dropdown terminal for KDE
Run Code Online (Sandbox Code Playgroud)
小智 5
tty。/dev/pts/0和/dev/pts/1。exec:exec 1>/dev/pts/1exec 1>/dev/pts/0