AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-130518

Karl Morrison's questions

Martin Hope
Karl Morrison
Asked: 2021-06-04 23:18:03 +0800 CST

过滤输出并设置变量

  • 0

我想运行一个调用命令的 bash 脚本,然后在脚本中设置一个变量,其中包含第一个命令的部分输出。就我而言,我想将变量设置URL为https://loady-7jmiymbtlg-uc.a.run.app.

my-script.sh:

gcloud run deploy loady

# echo $URL <--- how to set this with the output from the above command

当我运行我的脚本(示例输出)时:

karl@Karls-MacBook-Pro ~ $ ./my-script.sh
Deploying container to Cloud Run service [loady] in project [loady] region [us-central1]
✓ Deploying new service... Done.                                                               
  ✓ Creating Revision...                                                                       
  ✓ Routing traffic...                                                                         
  ✓ Setting IAM Policy...                                                                      
Done.                                                                                          
Service [loady] revision [loady-00001-nod] has been deployed and is serving 100 percent of traffic.
Service URL: https://loady-7jmiymbtlg-uc.a.run.app

如您所见,最后一行。

command-line
  • 1 个回答
  • 393 Views
Martin Hope
Karl Morrison
Asked: 2018-01-30 07:12:14 +0800 CST

ls 颜色白色与绿色

  • 1

我试着看一下ls中不同颜色的含义是什么?,但该列表没有说明白色。

看下图:

Gnome 终端截图

什么是绿色,什么是白色(libfuse.so和libfuse3.so)?

command-line ls 16.04
  • 1 个回答
  • 5823 Views
Martin Hope
Karl Morrison
Asked: 2017-08-03 05:46:51 +0800 CST

为 ssh 连接创建别名

  • 17

我想加快连接到特定服务器的速度。

我有服务器让我们说:

123.123.123.1
123.123.123.2
123.123.123.3

我通常连接以下内容:

ssh -p 12345 [email protected]

这很痛苦,因为服务器之间的唯一区别是 ip 的最后一个数字。

我尝试了以下代码:

alias ssht='{ ip=$(cat -); ssh -p 12345 my_user@"123.123.123.$ip"; }<<<'

但是我收到一个错误:

karl@karls-laptop ~/scripts $ ssht 1
Pseudo-terminal will not be allocated because stdin is not a terminal.

有没有办法让这个工作?

bash
  • 5 个回答
  • 17205 Views
Martin Hope
Karl Morrison
Asked: 2017-08-02 06:50:55 +0800 CST

一条线显示 CPU、RAM 和 HDD 使用情况

  • 18

我已经看到一些关于使用的帖子想要相同的内容,但是答案总是指安装一些第三方工具。

我不想安装任何东西。

任何一个衬垫?以下将是一个不错的输出:

CPU 11% RAM 20% HDD 85%
command-line
  • 2 个回答
  • 16406 Views
Martin Hope
Karl Morrison
Asked: 2017-07-31 03:09:43 +0800 CST

以下软件包具有未满足的依赖关系: libpulse-dev

  • 4

好的,所以我正在尝试从源代码构建,为此我必须安装它的依赖项。

因此,其中一个依赖项如下:

karl@karl-ux303ln:~/dev/RBDOOM-3-BFG/neo(master)$ sudo apt-get install libsdl2-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 libsdl2-dev : Depends: libpulse-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

所以我检查libpulse-dev:

The following packages have unmet dependencies.
 libpulse-dev : Depends: libpulse0 (= 1:4.0-0ubuntu11.1) but 1:4.0-0ubuntu11.1+kxstudio1 is to be installed
                Depends: libpulse-mainloop-glib0 (= 1:4.0-0ubuntu11.1) but 1:4.0-0ubuntu11.1+kxstudio1 is to be installed
E: Unable to correct problems, you have held broken packages.

从这里我几乎被困住了。我知道脉冲是造成声音的原因,但我不知道如何解决这个问题。

我还尝试了这个答案必须提供的一切:https ://askubuntu.com/a/142808/130518

14.04
  • 1 个回答
  • 1746 Views
Martin Hope
Karl Morrison
Asked: 2017-07-21 23:57:29 +0800 CST

命令 -v 自定义输出

  • 2

我目前有命令:

command -v gpg 2>/dev/null || { echo "Cound not find gpg. Aborting."; }

我不想将输出重定向到 /dev/null,而是想显示一条消息,说明 command 和 afterwords 的输出found!。

IE

  • 如果没有找到 gpg:Cound not find gpg. Aborting.
  • 如果找到 gpg:gpg found at /usr/local/bin/gpg
bash
  • 3 个回答
  • 1648 Views
Martin Hope
Karl Morrison
Asked: 2017-06-17 00:35:12 +0800 CST

@command -v gpg 为什么命令前有版本标志?

  • 2
verify:
    @command -v gpg 2>/dev/null || { echo "Cound not find gpg. Aborting."; exit 1; }

我在 Makefile 中看到了以下命令。我了解它执行以下操作:

  1. verify之前build在 Makfile 中调用
  2. @command用于不回显正在运行的命令,也不回显将被调用的命令的输出
  3. -v gpg 2>/dev/null将检查版本,如果未找到 gpg,它将错误输出(sterr)重定向到 null(无处)
  4. || { echo "Cound not find gpg. Aborting."; exit 1; }如果上一个命令产生错误,将回显一条消息并以错误 1 ​​退出当前脚本(返回 false,这就是 || 存在的原因)

我不明白的是-v gpg。检查版本时,-v通常在命令之后。这样做有理由吗?

command-line
  • 1 个回答
  • 231 Views
Martin Hope
Karl Morrison
Asked: 2017-05-06 06:27:31 +0800 CST

16.04 命令列出启动时启动的所有服务

  • 31

我已经安装了 mongodb v3.4。这在启动时启动。

所以我想知道,如何找出启动它的原因(以及如何在启动时禁用它)?

以下没有工作:

如何阻止 mongodb 在系统启动时启动(旧)

命令列出启动时启动的服务?(老的)

16.04
  • 3 个回答
  • 103286 Views
Martin Hope
Karl Morrison
Asked: 2017-05-05 14:24:34 +0800 CST

supervisorctl 3.3.1 http://localhost:9001 拒绝连接

  • 14
root@dev-demo-karl:/srv/www# supervisord -v
3.3.1

试图开始supervisorctl工作:

root@dev-demo-karl:/srv/www# supervisorctl
http://localhost:9001 refused connection

我的配置:

[supervisord]
nodaemon=true

[supervisorctl]
16.04
  • 4 个回答
  • 31707 Views
Martin Hope
Karl Morrison
Asked: 2017-05-05 10:54:21 +0800 CST

错误:.ini 文件不包括 supervisorctl 部分

  • 13

Supervisorctl 似乎不让我进去:

$ supervisorctl -c /etc/supervisor/supervisord.conf
Error: .ini file does not include supervisorctl section
For help, use /usr/bin/supervisorctl -h
$ cat /etc/supervisor/supervisord.conf 
[supervisord]
nodaemon=true

我已经指定了配置和[supervisord]. 有没有可能我的配置放错地方了?

16.04
  • 4 个回答
  • 30342 Views
Martin Hope
Karl Morrison
Asked: 2017-05-05 07:21:44 +0800 CST

没有更多的磁盘空间:如何找到占用空间的内容?

  • 156

我在其中一台运行 16.04 的服务器上遇到了问题:没有剩余磁盘空间。

我不知道是什么占用了空间。是否有列出当前目录大小的命令,以便我可以遍历并最终进入占用所有空间的目录?

disk-usage
  • 13 个回答
  • 226407 Views
Martin Hope
Karl Morrison
Asked: 2017-04-22 05:27:28 +0800 CST

可以在前台运行cron吗?

  • 8

我想/usr/sbin/cron在前台运行命令,而不是作为守护进程。这可能吗?

16.04
  • 1 个回答
  • 9695 Views
Martin Hope
Karl Morrison
Asked: 2017-04-22 05:10:26 +0800 CST

使用主管启动 cron 服务

  • 3

我的 supervisord.conf 中有以下内容:

[program:cron]
command=service cron start
autostart=true
autorestart=false
stderr_logfile=/var/log/cron.err.log
stdout_logfile=/var/log/cron.out.log

好像失败了?:

root@srv:/# supervisorctl
cron                             FATAL     Exited too quickly (process log may have details)

但是它正在运行:

root@srv:/# ps aux | grep cron
root        52  0.0  0.1  26068  2464 ?        Ss   13:07   0:00 /usr/sbin/cron
root      3053  0.0  0.0  11284   936 ?        S+   13:08   0:00 grep --color=auto cron

我是否与主管正确启动 cron?

16.04
  • 2 个回答
  • 9853 Views
Martin Hope
Karl Morrison
Asked: 2017-03-05 09:59:35 +0800 CST

查找bash命令二进制文件的位置[重复]

  • 2
这个问题在这里已经有了答案:
用于输出二进制绝对路径的shell命令 4个答案
5年前关闭。

我有一个letsencrypt在终端中使用的命令。

我试图通过grep -R "letsencrypt" /. 这不是一个好主意,调用了某种循环。

是否有一个简单的命令可以查看该命令letsencrypt对二进制文件实际调用的内容?

bash
  • 2 个回答
  • 10771 Views
Martin Hope
Karl Morrison
Asked: 2017-03-04 07:21:38 +0800 CST

Systemd x.timer 拒绝启动

  • 2

我正在尝试这样做:https ://www.shivering-isles.com/lets-encrypt-renew-all-your-certs-using-systemd/

当我运行计时器时:

sudo systemctl start letsencrypt.timer

我得到错误:

Job for letsencrypt.timerfailed. See "systemctl status letsencrypt.timer" and "journlctl -xe" for details.

sudo journalctl -u letsencrypt.timer:

-- Logs begin at Sat 2017-02-25 05:28:36 UTC, end at Fri 2017-03-03 15:18:23 
Mar 03 14:54:17 instanty-dev systemd[1]: letsencrypt.timer: Refusing to start
Mar 03 14:54:17 instanty-dev systemd[1]: Failed to start letsencrypt timer.

letsencrypt.service:

[Unit]
Description=Renews letsencrypt certificates  
After=network.target

[Service]
Type=oneshot  
WorkingDirectory=/opt/letsencrypt/  
ExecStart=/opt/letsencrypt/letsencrypt-auto renew  

letsencrypt.timer:

[Unit]
Description=letsencrypt timer

[Timer]
OnCalendar=daily  
Persistent=true  
Unit=letsencrypt.service

[Install]
WantedBy=basic.target
16.04
  • 1 个回答
  • 4215 Views
Martin Hope
Karl Morrison
Asked: 2017-02-17 05:01:25 +0800 CST

带有文本的日期到文件

  • 0

我正在尝试将文本通过管道传输到文件中:

'date +"%H:%M" development' > log

示例:12:12 开发

但这实际上是管道date +"%H:%M" development而不是12:12 development

bash
  • 2 个回答
  • 3854 Views
Martin Hope
Karl Morrison
Asked: 2017-02-14 00:57:35 +0800 CST

Killall 节点不杀死节点进程

  • 11

我通过以下输出ps aux | grep node:

karlm    17551  1.4  0.7 1000592 93604 pts/2   Sl   09:54   0:01 node -r babel-register -r babel-polyfill src/index.js --config=c.json

我试图用killall node.

它不会杀死进程吗?

command-line
  • 1 个回答
  • 45203 Views
Martin Hope
Karl Morrison
Asked: 2017-01-14 05:26:21 +0800 CST

ls -l 回显什么?[复制]

  • 2
这个问题在这里已经有了答案:
'ls -la' 有什么作用? (2 个回答)
5年前关闭。
$ ls -l
-rw------- 1 root root 2381 Jan 13 08:20 authorized_keys
-rw-r--r-- 1 root root  444 Jan 13 08:20 known_hosts
  • 第一个是权限
  • 第二个是?
  • 第三个是所有权
  • 第四个是?
  • 第五个是?
  • 第 6 个是创建日期
  • 第7个是文件名

有没有人可以填补空白!

bash
  • 2 个回答
  • 146 Views
Martin Hope
Karl Morrison
Asked: 2017-01-14 05:13:13 +0800 CST

在终端中显示文件的完整路径[重复]

  • 13
这个问题在这里已经有了答案:
如何快速获取文件的完整路径以在终端中使用? (7 个回答)
5年前关闭。

我有一个文件。我想在终端中回显出它的完整路径。

哪个命令会?

command-line
  • 4 个回答
  • 62710 Views
Martin Hope
Karl Morrison
Asked: 2016-11-02 05:22:17 +0800 CST

Ubuntu终端中的Ctrl + C和Ctrl + V [重复]

  • 0
这个问题在这里已经有了答案:
在 gnome-terminal 中制作 Ctrl+C 复制文本? (11 个回答)
5年前关闭。

我非常清楚在 Ubuntu 中执行此操作的标准方法是Ctrl++和⇬++ 。CCtrl⇬V

我来自基本的操作系统背景,他们实际上解决了这个问题。所以如果 EOS 可以解决这个问题,我也应该在 vanilla Ubuntu 中解决这个问题。

如何解决这个问题?例如,Ctrl++⇬必须C位于设置中的某个位置?

16.04
  • 1 个回答
  • 1436 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve