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-181039

Elliptical view's questions

Martin Hope
Elliptical view
Asked: 2020-03-06 23:38:24 +0800 CST

配置 Debian 网络的最新参考资料是什么?

  • 1

配置 Debian 网络的最新参考文档是什么?


我陷入了看似陈旧过时的文档中。这是我到目前为止发现的:

  • 很多手册页。 其中一些是新的,一些是旧的,因为大多数都没有注明日期,很难看出什么是什么,就年龄而言,什么取代了什么。

    这是我正在查看的一些内容(我认为是最新的):

    • 第 2 层 - 链接
      接口(5) - 配置物理和逻辑网络接口,即本地硬件
      ifup (8).. - 运行脚本以启动或关闭接口
      ip link(8) - 启动或关闭接口的其他方式
      iw ( 8) - 无线网络接口
      networkctl (1) - 查询systemd-networkd看到的网络链接状态

    • 第 3 层 - 网络
      主机名(7) - 设置/获取我的主机名
      hosts (5) - 大部分已过时 - 现在似乎只被浏览器用来浏览本地文件
      网络(5) - 定义本地已知的网络名称、别名和 ip 地址 (过时了吗?)
      ip addr (8) - 管理本地 IP 地址
      networkmanager (8)、nmcli (1)、networkmanager.conf (5)、nm-applet (1)、nm-connection-editor (1) - 本地的更新方式管理网络??
      minissdpd (1) - 守护进程跟踪
      inetd上的 UPnP 设备(8) - 监听各种 TCP 和 UDP 端口并生成不能或不会自己做的程序的守护进程
      nmap (8) - 网络探索工具和安全/端口扫描器

    • 第 4 层以上 - 传输或以上
      ss (8) - 管理套接字 ssh (1) - 远程登录程序
      nfs (5) fstab 格式和 nfs 文件系统的选项
      ...

  • Debian 管理员手册- 第 8.2 章。配置网络- 未注明日期,但现在是 2 个主要版本,因为 Debian Buster 现在升级到版本 10。Debian 8 或 Jessie 于 2015 年 4 月发布,所以现在已经5 岁了。

  • Debian 参考- 第 5 章网络设置- 但遗憾的是:“这一章已经过时了,因为它基于 2013 年发布的 Debian 7.0 (Wheezy)。”,所以现在7 岁了。

  • Linux 网络管理员指南- 第 3 版(2005 年),现已15 岁!


我希望能更好地了解主要网络组件如何在我的系统上组合在一起或相互替换。

NetworkManager目前,我正在尝试了解使用/ nmcli、 vs 配置文件(如/etc/network/interfaces、ifup/ifdown和ip/ss命令)、 vs systemd.network(单位?)文件的来龙去脉。

我可以看到ip,ss和iw是要学习的新命令,并且正在研究它们。但我也可以看到这一点ifup并且ifdown不会消失,因为它们运行的​​脚本ip不会。

而且我仍然对我的系统如何从路由器上的 dhcp 获取它的 ip 感到困惑。


(顺便说一句,我对使用旧文档有点担心的部分原因。我已经浪费了很多时间学习iptables,后来发现它们很旧,我应该学习nftables。)

谢谢!


networking debian
  • 1 个回答
  • 66 Views
Martin Hope
Elliptical view
Asked: 2020-02-24 12:36:48 +0800 CST

sed 命令和 e 标志:`echo '$-' | sed 's/-//e'` 给出:`sh: $: command not found`

  • 0

当使用带有 ' e ' 标志的 ' s ' (搜索和替换命令)时,我遇到了sed的问题,如

sed 's/.../.../e'

问题是标准输入中的字符$,(和)似乎混淆了它。


我第一次在这里遇到它,现在把它归结为:

echo '$-' | sed 's/x//e'               # works when pattern is NOT matched
$-

echo '$-' | sed 's/-//e'               # fails when pattern is matched: gags on $
sh: $: command not found

echo '-' | sed 's/-//e'                # works when $ isn't present

echo '-(' | sed 's/-//e'               # Also fails when '(' or ')' are found
sh: -c: line 1: syntax error: unexpected end of file

echo '(' | sed 's/-//e'                # But works with this
(

echo '$-' | sed 's/-/echo xx/e'        # also fails
sh: xx: command not found

echo '$-' | sed 's/\(-\)/echo '\1'/e'  # also fails
sh: 1: command not found

这是GNU 手册所说的:

3.3 s 命令

...

s 命令后面可以跟零个或多个以下标志:

...

e

此命令允许将来自 shell 命令的输入通过管道传输到模式空间。如果进行了替换,则执行在模式空间中找到的命令,并将模式空间替换为其输出。尾随换行被抑制;如果要执行的命令包含 NUL 字符,则结果未定义。这是一个 GNU sed 扩展。


bash --version
GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu)

sed --version
sed (GNU sed) 4.7
Packaged by Debian

我错过了什么或做错了什么?

sed
  • 1 个回答
  • 725 Views
Martin Hope
Elliptical view
Asked: 2020-02-17 14:43:09 +0800 CST

如何将 bash 函数嵌入到 sed 表达式中?

  • 2

在 sed 中,如何使用 bash 函数创建替换字符串,尤其是一个或多个找到的部分的函数,通常标识为 \1、\2、...?

换句话说,我想做这样的事情:

sed -e 's/\(.*\)/<bash_function \1>/'

注意:这个Q类似于How to embed a shell command into a sed expression?,但我不想调用 GNU/Linux 命令,而是想简单地调用本地 bash 函数。

bash sed
  • 1 个回答
  • 1607 Views
Martin Hope
Elliptical view
Asked: 2020-02-14 12:14:39 +0800 CST

apt-get ...“配置正在使用中。”?

  • 2

在一个非常普通的结尾sudo apt-get install ...,我看到一条“ Config is in use. ”行。

这是一个问题吗? 如果是这样,我该如何解决?

已搜索 apt“配置正在使用中”。但似乎找不到任何线索。我以前见过这个,但我只是在追赶它。

谢谢!:-)


GNU/Linux - Debian Buster 10.2

$ uname 
Linux <hostname> 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11) x86_64 GNU/Linux

apt-get --version
apt 1.8.2 (amd64)
Supported modules:
*Ver: Standard .deb
*Pkg:  Debian dpkg interface (Priority 30)
 Pkg:  Debian APT solver interface (Priority -1000)
 Pkg:  Debian APT planner interface (Priority -1000)
 S.L: 'deb' Debian binary tree
 S.L: 'deb-src' Debian source tree
 Idx: Debian Source Index
 Idx: Debian Package Index
 Idx: Debian Translation Index
 Idx: Debian dpkg status file
 Idx: Debian deb file
 Idx: Debian dsc file
 Idx: Debian control file
 Idx: EDSP scenario file
 Idx: EIPP scenario file

示例 1

$ sudo apt-get install openssl libssl-dev libcurl4-openssl-dev zlib1g-dev libpng-dev libxml2-dev libjson-c-dev libbz2-dev libpcre3-dev ncurses-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libncurses-dev' instead of 'ncurses-dev'
libbz2-dev is already the newest version (1.0.6-9.2~deb10u1).
libbz2-dev set to manually installed.
libpng-dev is already the newest version (1.6.36-6).
libxml2-dev is already the newest version (2.9.4+dfsg1-7+b3).
libxml2-dev set to manually installed.
libncurses-dev is already the newest version (6.1+20181013-2+deb10u2).
libncurses-dev set to manually installed.
libssl-dev is already the newest version (1.1.1d-0+deb10u2).
openssl is already the newest version (1.1.1d-0+deb10u2).
libpcre3-dev is already the newest version (2:8.39-12).
libpcre3-dev set to manually installed.
zlib1g-dev is already the newest version (1:1.2.11.dfsg-1).
zlib1g-dev set to manually installed.
The following packages were automatically installed and are no longer required:
  libcmis-0.5-5v5 libmhash2 librasqal3 librdf0 libxslt1-dev libyajl-dev
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  libcurl4-doc librtmp-dev
The following packages will be REMOVED:
  libcmis-dev libcurl4-gnutls-dev libraptor2-dev librasqal3-dev librdf0-dev
The following NEW packages will be installed:
  libcurl4-openssl-dev libjson-c-dev
0 upgraded, 2 newly installed, 5 to remove and 4 not upgraded.
Need to get 458 kB of archives.
After this operation, 10.0 MB disk space will be freed.
Do you want to continue? [Y/n] y
Get:1 http://ftp.us.debian.org/debian buster/main amd64 libcurl4-openssl-dev amd64 7.64.0-4 [419 kB]
Get:2 http://ftp.us.debian.org/debian buster/main amd64 libjson-c-dev amd64 0.12.1+ds-2 [38.8 kB]
Fetched 458 kB in 1s (384 kB/s)          
(Reading database ... 552014 files and directories currently installed.)
Removing libcmis-dev (0.5.2-1) ...
Removing librdf0-dev (1.0.17-1.1+b1) ...
Removing librasqal3-dev (0.9.32-1+b1) ...
Removing libraptor2-dev (2.0.14-1+b1) ...
Removing libcurl4-gnutls-dev:amd64 (7.64.0-4) ...
Selecting previously unselected package libcurl4-openssl-dev:amd64.
(Reading database ... 551802 files and directories currently installed.)
Preparing to unpack .../libcurl4-openssl-dev_7.64.0-4_amd64.deb ...
Unpacking libcurl4-openssl-dev:amd64 (7.64.0-4) ...
Selecting previously unselected package libjson-c-dev:amd64.
Preparing to unpack .../libjson-c-dev_0.12.1+ds-2_amd64.deb ...
Unpacking libjson-c-dev:amd64 (0.12.1+ds-2) ...
Setting up libjson-c-dev:amd64 (0.12.1+ds-2) ...
Setting up libcurl4-openssl-dev:amd64 (7.64.0-4) ...
Processing triggers for man-db (2.8.5-2) ...
Config is in use.

示例 2:

$ sudo apt autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  libcmis-0.5-5v5 libmhash2 librasqal3 librdf0 libxslt1-dev libyajl-dev
0 upgraded, 0 newly installed, 6 to remove and 4 not upgraded.
After this operation, 5,343 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 551845 files and directories currently installed.)
Removing libcmis-0.5-5v5 (0.5.2-1) ...
Removing librdf0:amd64 (1.0.17-1.1+b1) ...
Removing librasqal3:amd64 (0.9.32-1+b1) ...
Removing libmhash2:amd64 (0.9.9.9-7+b1) ...
Removing libxslt1-dev:amd64 (1.1.32-2.2~deb10u1) ...
Removing libyajl-dev:amd64 (2.1.0-3) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10) ...
Config is in use.

示例 3 - 在这里没有看到

$ sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.6).
The following packages were automatically installed and are no longer required:
  libcmis-0.5-5v5 libmhash2 librasqal3 librdf0 libxslt1-dev libyajl-dev
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
apt
  • 1 个回答
  • 256 Views
Martin Hope
Elliptical view
Asked: 2020-01-09 23:18:50 +0800 CST

`ln --no-dereference` 应该做什么?

  • 6

我正在刷新我对一些基本 GNU/Linux 命令的理解,我承认在过去的 20 多年里我从未真正完全理解过这些命令。

$ man ln部分说:

-n, --no-dereference
          treat LINK_NAME as a normal file if it is a symbolic link to a directory

为了更好地理解这一点,我将其分解如下:

$ mkdir dir1
$ ln -vs dir1 dir2
'dir2' -> 'dir1'
$ mkdir dir3; touch dir3/xx

$ tree -F
.  
├── dir1/  
├── dir2 -> dir1/  
└── dir3/  
    └── xx  

# Now to test -n, first as a hard link
$ ln -vn dir3/xx dir2
ln: failed to create hard link 'dir2': File exists

# and second as a symbolic link
$ ln -vsn dir3/xx dir2
ln: failed to create symbolic link 'dir2': File exists

# ??? why do these both fail ???

只有 SYNOPSIS 中的第一个命令形式调用了“LINK_NAME”,语法如下:

   ln [OPTION]... [-T] TARGET LINK_NAME

所以这表示-nand--no-dereference选项仅与 , 的第一个命令形式有关ln(而不是其他三种命令形式)。

在我的例子中:

TARGET是,dir3/xxLINK_NAME
是( 'a symbolic link to a directory') 。dir2

手册说如果 LINK_NAME(即记住这是我们应该创建的链接的名称)是“指向目录的符号链接”......

...那么我们应该将此符号链接视为“普通文件”。

我错过了什么?

ln
  • 1 个回答
  • 3584 Views
Martin Hope
Elliptical view
Asked: 2019-08-19 08:16:51 +0800 CST

Google 地球:Unix 电子邮件

  • 0

mailto: .. attach= 不适用于 firefox 或 chrome,因此无法通过电子邮件从 Google 地球发送 .klm 文件?

我喜欢在 Debian 上使用 Google 地球,但是当我尝试使用电子邮件发送.klm视图文件时File| Email| Email view... 并选择web browser mailto: handler:

在此处输入图像描述

我收到以下错误消息:

在此处输入图像描述

我在 Windows 10 中没有看到此错误消息。相反,它会按预期创建带有附件的电子邮件。

这是我已经尝试解决的问题:

1)修复环境(确定几个地方):

# cat /etc/environment 
BROWSER=/opt/firefox/firefox

和

# tail  -2 /etc/.bash.shared 
export BROWSER="/opt/firefox/firefox"

现在,当我打开终端时,我得到了这个:

$ env | grep BROWSER
BROWSER=/opt/firefox/firefox

2)我还测试了 Firefox 和 Chrome 以查看是否attach=在mailto:URL 中工作,但到目前为止我似乎无法正常工作。我正在尝试浏览到类似这样的 URL:

mailto:[email protected]?subject=xx&body=yy&attach=%22%2fhome%2fhoward%2fDesktop%2fphpmyadmin.pdf%22

(其中 URL 编码为 %22 用于双引号 ("),%2f 用于斜杠 (/))。

我也尝试过@attachment=而不是@attach=.

Thunderbird 和 Chrome 都会打开一个新的电子邮件窗口,主题和正文按预期工作,但附件不存在。


所以首先,我认为我需要开始@attach=使用 Firefox(或 Chrome),但是如何?


我在用着:

  • Debian 9.9 (x86-64) (Linux 内核 4.9.0-9-amd64)
  • 肉桂 3.2.7 与
  • 谷歌地球 7.1.4.1529
  • Firefox Quantum 68.0.2(64 位)/Chrome 76.0.3809.100(64 位)

debian email
  • 1 个回答
  • 130 Views
Martin Hope
Elliptical view
Asked: 2019-02-20 12:49:18 +0800 CST

bash 历史命令中的 -p 选项?

  • 2

从man bash,

历史-p arg [arg ...]

...

-p

对以下参数执行历史替换并将结果显示在标准输出上。

这里的“历史替代”是什么意思?你能提供一个使用它的例子吗?

谢谢。


我了解命令行历史替换,并且已经尝试过这样的事情:

history -p "!23:1"

但这不依赖于-p,xx "!23:1"同样的事情也是如此。

bash history-expansion
  • 1 个回答
  • 1240 Views
Martin Hope
Elliptical view
Asked: 2019-02-01 16:06:12 +0800 CST

在“apt update”的输出中,“InRelease”和“Release”指的是什么?

  • 10

这是一个显示“ InRelease ”和“ Release ”行后缀的示例:

# apt update
Hit:1 http://security.debian.org stretch/updates InRelease
Ign:2 http://dl.google.com/linux/chrome/deb stable InRelease                                                                                                                                                                                 
Hit:3 http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.2/debian stretch InRelease                                                                                                                                                        
Hit:4 http://mirrors.ocf.berkeley.edu/debian stretch-updates InRelease                                                                                                                                                                       
Ign:5 http://dl.google.com/linux/earth/deb stable InRelease                                                                                                                        
Ign:6 http://ftp.uk.debian.org/debian stretch InRelease                                                                         
Hit:7 http://dl.google.com/linux/chrome/deb stable Release               
Hit:8 http://ftp.debian.org/debian stretch-backports InRelease           
Hit:9 http://dl.google.com/linux/earth/deb stable Release                
...

我知道什么是发布。尽管对 InRelease 的网络搜索并没有出现太多。

debian apt
  • 2 个回答
  • 11495 Views
Martin Hope
Elliptical view
Asked: 2018-07-22 12:09:02 +0800 CST

肉桂,系统设置,Windows:右侧标题栏按钮:“粘滞”?

  • 1

在 Cinnamon 桌面中,如果您打开System Settings> Windows,您可以设置

Right side title bar buttons


每个按钮有 6 个选项:

  • 菜单 - 显示下拉菜单
  • Close - 关闭 并退出窗口
  • 最小化 - 关闭寡妇,但在面板中保持打开
  • 最大化 - 在全屏和部分屏幕之间切换窗口
  • 粘 -?
  • 阴影 - 在正常和折叠之间切换窗口,仅显示标题栏

粘性是做什么的?


粘性按钮图标(配置为左下角第 4 个)切换。

在被点击之前看起来像这样

在此处输入图像描述

并在被点击后:

在此处输入图像描述


提示:

  • 并非所有System Settings> Themes>Window borders设置的所有按钮都显示(可见)。但是,如果您将 设置Window borders为Bluebird您可以看到所有按钮图标,例如 2 个左按钮和 4 个右按钮。(事实上​​,Bluebird似乎是唯一Window borders显示所有按钮图标的设置。 (但是,其他一些设置显示了菜单按钮的自定义图标,这很好,并且可以很好地做其他事情,这也可能吸引您。对于我更喜欢获取所有按钮。GreenLaguna 和 BlackMATE 也显示所有按钮,但不显示图标,而是当您将鼠标悬停在它们上方时,它们具有不同的颜色,整洁,但我认为令人困惑。)

  • 即使某些按钮是不可见的(例如,因为主题设置为 Bluebird 以外的其他内容),但在盲目单击时它们似乎仍然起作用。


我正在运行:Cinnamon 版本 3.2.7,在 Debian 9.5 上

cinnamon theme
  • 1 个回答
  • 1239 Views
Martin Hope
Elliptical view
Asked: 2018-03-24 17:49:03 +0800 CST

在用户和 root 之间共享一些 .bashrc 源的最佳、安全的方法是什么?

  • 1

/root/.bashrc拥有和/home/user/.bashrc包含公共.bash.shared文件 的最佳、安全方式是什么?

换句话说,像这样:

/root/.bashrc --sources--> .bash.shared <-- sources-- /home/user/.bashrc

如果我.bash.shared输入/root,那么由于缺乏权限,我无法在家中阅读它,因为在 Debian /root 上默认设置为 drwx------。

我不知道放松对 /root 的限制的安全后果。这一定是有原因的。 (换句话说,我必须给 /root drwx-----x)。

我认为一种可能的解决方法是放入.bash.sharedroot和用户都可以读取的其他root拥有的文件夹,但我想知道是否有更简单的方法可以做到这一点,或者放松/root的权限是否安全?


(出于恐惧,并且由于我一直在学习 linux,我保留了两个单独的相同文件:/root/.bash.shared并且/home/user/.bash.shared,我认为在某些时候我会偶然发现一个很好的解决方案。记住总是更新另一个是很痛苦的当我编辑它时。所以我想以一种或另一种方式解决这个问题,但没有安全漏洞。)

谢谢!

users root
  • 1 个回答
  • 643 Views

Sidebar

Stats

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

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve