小编kos*_*kos的帖子

在 Ubuntu 上安装 Linux Mint Cinnamon 的抛光 Ctrl+R/“reverse-i-search”?

在 Mint 中,当你在任何终端中点击Ctrl+R时,你会得到一个非常漂亮的反向搜索用户界面。

(澄清一下 - 我指的是 Mint 中提供的额外润色 - 用户界面比我在 Ubuntu 和其他发行版中习惯的基本历史搜索更高级)

我想在我的 Ubuntu 机器上安装这个。

我不确定它是 Mint 功能还是 Cinnamon 功能,或者某些可以安装的第三方工具。

谷歌搜索它没有返回任何东西......有没有办法在Ubuntu上安装这个功能?

薄荷:

在此处输入图片说明

Ubuntu/其他:

在此处输入图片说明

bash bash-history

8
推荐指数
1
解决办法
1141
查看次数

如何替换文件中以某个前缀开头的所有字符串

例子:

1:20 2:25 3:0.432 2:-17 10:12
Run Code Online (Sandbox Code Playgroud)

我想替换所有以to开头的字符串。2:2:0

输出:

1:20 2:0 3:0.432 2:0 10:12
Run Code Online (Sandbox Code Playgroud)

command-line text-processing

7
推荐指数
1
解决办法
1万
查看次数

使用 tree 命令显示每个目录中的 n 个文件

我有以下目录结构:

bocoup_data/
??? text_reuse
?   ??? v2
?       ??? json
?           ??? alignments
?           ??? texts
??? topic_modelling
    ??? v2
        ??? json
Run Code Online (Sandbox Code Playgroud)

我希望能够显示这些目录中文件的子集,因为上图中的某些目录有数千个文件。tree在 Ubuntu 中调用命令时,有没有办法只显示每个目录中的前 n 个文件?

command-line tree

7
推荐指数
2
解决办法
966
查看次数

SSH 进入机器,然后启动交互式命令行程序

我想实际上 ssh 进入一台机器(而不是远程执行像 那样的命令ssh -i key.pem user@host 'bash -s' < script.sh),然后一旦完成运行命令以在远程机器上启动交互式命令行程序。有任何想法吗?请注意,所有这些都是在脚本中完成的,最终结果应该是在远程主机上的 shell运行的交互式命令行程序。

到目前为止,我已经在 Ubuntu 14.04 上尝试过 Python 2.7

import os
os.system("xterm -e ssh -tt -i key.pem -o StrictHostKeyChecking=no ubuntu@ip_address yRouter/src/yrouter --interactive=1 user")
Run Code Online (Sandbox Code Playgroud)

xterm会话随即关闭。“yrouter”是远程机器上的可执行文件,--interactive=1 user是它的参数。

澄清一下:运行上面的 Python 代码后的结果应该是一个xterm(或任何终端窗口)打开,已经进入远程主机并yrouter运行交互式命令行程序。

ssh command-line bash

7
推荐指数
1
解决办法
2万
查看次数

错误“*ERROR* UVD 没有响应,试图重置 VCPU!!!”

启动系统时出现以下错误。

现在我正在使用恢复模式,我该怎么办?

*ERROR* UVD not responding, trying to reset the VCPU!!!
*ERROR* UVD not responding, trying to reset the VCPU!!!
*ERROR* UVD not responding, trying to reset the VCPU!!!
*ERROR* UVD not responding, trying to reset the VCPU!!!
*ERROR* UVD not responding, trying to reset the VCPU!!!
*ERROR* UVD not responding, trying to reset the VCPU!!!
*ERROR* UVD not responding, trying to reset the VCPU!!!
*ERROR* UVD not responding, trying to reset the VCPU!!!
*ERROR* UVD not responding, trying to …
Run Code Online (Sandbox Code Playgroud)

boot

7
推荐指数
2
解决办法
3万
查看次数

我应该选择哪个版本的 Ubuntu?

我只是一个对 Windows 10 感到沮丧的简单用户,我想完全离开 Windows。

但是,我不想花三周时间学习如何安装新系统,然后让我当前的所有程序都可以运行。

我不是在设置服务器,我不是开发人员,我不希望我的所有东西都在云上。

system-installation

7
推荐指数
2
解决办法
9940
查看次数

如何告诉 shell 脚本我的密码?

我一直在试图创建一个脚本,运行sudo apt-get updatesudo apt-get autoremove每当我登录它是这样的:

#!/bin/bash
(sudo apt-get update)
(sudo apt-get autoremove)
Run Code Online (Sandbox Code Playgroud)

但是每当我运行脚本时,它都会冻结我的计算机。我假设这是因为它正在等待脚本提供密码。如果我PASSWD:mypassword在这样的命令之后添加它会起作用吗:

#!/bin/bash
(sudo apt-get update)PASSWD:mypassword
(sudo apt-get autoremove)PASSWD:mypassword
Run Code Online (Sandbox Code Playgroud)

或者还有什么我应该做的吗?甚至有办法吗?如果是这样请告诉我!

apt sudo scripts

6
推荐指数
2
解决办法
3090
查看次数

如何使用 bash 脚本检查是否安装了两个或多个程序?

我想使用 bash 脚本检查是否安装了两个或多个程序:

hash foo &> /dev/null
if [ $? -eq 1 ]; then
    echo >&2 "foo not found."
else
    echo "foo found"
fi
Run Code Online (Sandbox Code Playgroud)

上面的脚本适用于单个程序,我想检查系统中安装的多个程序。我怎样才能做到这一点?

command-line bash scripts

6
推荐指数
1
解决办法
2863
查看次数

“$: command not found” 每次启动时都会在终端顶部打印。为什么要这样做?

每当我打开一个新终端时,我都会收到此错误:

$: command not found
sandeep@sandepp:~$ 
Run Code Online (Sandbox Code Playgroud)

它照常工作没有任何问题,但为什么它会在顶部显示该消息?我的笔记本电脑有 Ubuntu 14.04。

我的~/.bashrc文件:

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for …
Run Code Online (Sandbox Code Playgroud)

command-line bash

6
推荐指数
1
解决办法
4127
查看次数

如何设置 gnome-terminal 的 X 和 Y 启动位置?

我一直在尝试gnome-terminal --geometry x y永久设置的位置。我知道我需要找到一个包含终端设置的文件,但我不知道它的位置。基本上,我想要的是控制终端窗口在启动时的位置。

gnome-terminal

6
推荐指数
1
解决办法
7882
查看次数