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

user1046658's questions

Martin Hope
user1046658
Asked: 2020-09-27 12:07:26 +0800 CST

grep 是否区分变量和 $ 正则表达式?

  • 1

我想 grep 查找具有 string 的变量test,但我也想确保它只会找到它test是否是一行中唯一的单词。

所以,我尝试了这个:

string=test
echo "test" | grep "$string$"

我想知道是否grep知道第一部分$string(在 grep " $string $" 中)要求查找字符串test,而最后一部分$(在 grep "$string $ " 中要求查找test,但是行中不应该有任何内容test。grep能够区$string分为变量,并且只能$作为行尾的正则表达式,还是我必须使用某种方式来区分它们?

command-line regex grep
  • 1 个回答
  • 3129 Views
Martin Hope
user1046658
Asked: 2020-08-25 13:35:46 +0800 CST

如何制作 sed 或使用另一个命令重新打印找到的字符串?

  • 1

我有一个像这样的字符串:testfsdfsdftestfsdkflsdtestsdfsdfsdf

我想知道如何分隔字符串,以便testfsdfsdf出现在第一行,testfsdkflsd将出现在第二行等,如下所示:

testfsdfsdf
testfsdkflsd
testsdfsdfsdf

我尝试使用sedfindtest和之后的任何内容,sed 's/test.*/但我想知道如何test.*再次重印。据我所知sed,您可以使用它来查找特定字符串,然后将其替换为其他字符串。所以本质上,我想尝试类似的东西sed 's/test.*/[reprint test.* here]\n/g',但如果我这样做sed 's/test.*/test.*\n/g',它只会输出test.*。有什么办法可以重新打印用 找到的字符串sed,或者可以用另一个命令来完成吗?

我还尝试了 sed 's/\(test.*\)test/\1\ntest/g',如果只有两个实例test[random characters]而不是三个或更多实例,它就可以工作。使用 string testfsdfsdftestfsdkflsdtestsdfsdfsdf,它只打印:

testfsdfsdftestfsdkflsd
testsdfsdfsdf
command-line sed
  • 1 个回答
  • 74 Views
Martin Hope
user1046658
Asked: 2020-08-23 08:30:45 +0800 CST

sysctl [variable=[value]] 和 sysctl -w [variable=[value]] 效果一样吗?

  • 0

我知道sysctl [variable]诸如sysctl vm.swappiness会打印出vm.swappiness. 但是当我尝试sysctl vm.swappiness=10然后输入sysctl vm.swappiness时,它显示vm.swappiness = 10(之前是 60)。我想改变一个sysctl设置,你必须sysctl -w [variable]这样做sysctl -w vm.swappiness=10。

sysctl vm.swappiness=10和有区别sysctl -w vm.swappiness=10吗?

我以为sysctl -w vm.swappiness=10可以直接编辑/etc/sysctl.conf,但似乎不是这样,因为当我输入sysctl -w vm.swappiness=10然后查看时/etc/sysctl.conf,vm.swappiness仍然设置为 60。然后,当我这样做时sysctl -p,vm.swappiness又变成了 60。

另外,是否以任何方式sysctl -w配置?/etc/sysctl.conf

command-line systemd
  • 1 个回答
  • 32 Views
Martin Hope
user1046658
Asked: 2020-08-12 17:15:14 +0800 CST

无法在 gedit 中单击首选项中的复选框

  • 2

当我使用geditinUbuntu 20.04时,每当我单击 中的任何复选框时Preferences,都不会发生任何事情。

喜好

例如,当我单击 时Display line numbers,该复选框仍标记为已选中。出于某种原因,点击Display grid pattern、Enable text wrapping、 和Do not split words over two lines可以,但是当我退出Preferences并重新进入时,它们会回到原来的状态,如图所示。

其他选项卡中的所有其他选项都无法更改。

编辑:作为普通用户使用时显然Preferences有效,而不是root用户。gedit以前,我试图更改Preferences为 root

现在,我想知道为什么 Preferences 不能以 root 身份更改。我注意到,当我gedit以普通用户身份使用时,终端上没有弹出任何内容,但是当我gedit以 root 身份打开时,终端中会显示以下消息:

(gedit:2024): dconf-WARNING **: 21:01:08.260: failed to commit changes to dconf: The connection is closed

(gedit:2024): dconf-WARNING **: 21:01:08.270: failed to commit changes to dconf: The connection is closed
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)
Error creating proxy: The connection is closed (g-io-error-quark, 18)

(gedit:2024): dconf-WARNING **: 21:01:08.509: failed to commit changes to dconf: The connection is closed

(gedit:2024): dconf-WARNING **: 21:01:08.509: failed to commit changes to dconf: The connection is closed

(gedit:2024): dconf-WARNING **: 21:01:08.510: failed to commit changes to dconf: The connection is closed
XDG_RUNTIME_DIR (/run/user/1000) is not owned by us (uid 0), but by uid 1000! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)
XDG_RUNTIME_DIR (/run/user/1000) is not owned by us (uid 0), but by uid 1000! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)

(gedit:2024): dconf-WARNING **: 21:04:00.840: failed to commit changes to dconf: The connection is closed
XDG_RUNTIME_DIR (/run/user/1000) is not owned by us (uid 0), but by uid 1000! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)
XDG_RUNTIME_DIR (/run/user/1000) is not owned by us (uid 0), but by uid 1000! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)
gedit preferences 20.04
  • 1 个回答
  • 261 Views
Martin Hope
user1046658
Asked: 2020-08-10 13:46:02 +0800 CST

如何在文件中搜索单词,但同时显示整个文件以及找到的单词?

  • 2

我正在使用 Ubuntu 16.04。

我想搜索某个单词,但我还希望在终端上输出包含该单词的整个文件,以便我可以看到该单词在文件中的位置。但是,当我使用 时grep,它只会显示包含该单词的特定句子,而不是整个文件。

我可以使用什么命令来搜索一个单词,同时显示整个文件以及单词所在的位置?

command-line bash grep
  • 4 个回答
  • 1553 Views
Martin Hope
user1046658
Asked: 2020-07-01 20:18:13 +0800 CST

SquirrelMail - 错误:IMAP 服务器断开连接

  • 0

我正在尝试在 Ubuntu 16.04 上使用 SquirrelMail。

当我去localhost/squirrelmail/src/login.php登录时,我遇到错误消息:ERROR: Connection dropped by IMAP server.

我在这里尝试了解决方案,它说要添加/etc/dovecot/dovecot.conf:

protocol imap {
mail_location = mbox:~/mail:INBOX=/var/mail/%u
}

但错误仍然存​​在。

此外,我在这里尝试了解决方案,它通知添加/etc/dovecot/dovecot.conf:

namespace inbox {
    inbox = yes
}

但同样,错误仍然存​​在。

我的/etc/dovecot/dovecot.conf文件是:

## Dovecot configuration file
# If you're in a hurry, see http://wiki2.dovecot.org/QuickConfiguration
# "doveconf -n" command gives a clean output of the changed settings. Use it
# instead of copy&pasting files when posting to the Dovecot mailing list.
# '#' character and everything after it is treated as comments. Extra spaces
# and tabs are ignored. If you want to use either of these explicitly, put the
# value inside quotes, eg.: key = "# char and trailing whitespace  "
# Most (but not all) settings can be overridden by different protocols and/or
# source/destination IPs by placing the settings inside sections, for example:
# protocol imap { }, local 127.0.0.1 { }, remote 10.0.0.0/8 { }
# Default values are shown for each setting, it's not required to uncomment
# those. These are exceptions to this though: No sections (e.g. namespace {})
# or plugin settings are added by default, they're listed only as examples.
# Paths are also just examples with the real defaults being based on configure
# options. The paths listed here are for configure --prefix=/usr
# --sysconfdir=/etc --localstatedir=/var
# Enable installed protocols
!include_try /usr/share/dovecot/protocols.d/*.protocol
# A comma separated list of IPs or hosts where to listen in for connections. 
# "*" listens in all IPv4 interfaces, "::" listens in all IPv6 interfaces.
# If you want to specify non-default ports or anything more complex,
# edit conf.d/master.conf.
#listen = *, ::
# Base directory where to store runtime data.
#base_dir = /var/run/dovecot/
# Name of this instance. In multi-instance setup doveadm and other commands
# can use -i <instance_name> to select which instance is used (an alternative
# to -c <config_path>). The instance name is also added to Dovecot processes
# in ps output.
#instance_name = dovecot
# Greeting message for clients.
#login_greeting = Dovecot ready.
# Space separated list of trusted network ranges. Connections from these
# IPs are allowed to override their IP addresses and ports (for logging and
# for authentication checks). disable_plaintext_auth is also ignored for
# these networks. Typically you'd specify your IMAP proxy servers here.
#login_trusted_networks =
# Space separated list of login access check sockets (e.g. tcpwrap)
#login_access_sockets = 
# With proxy_maybe=yes if proxy destination matches any of these IPs, don't do
# proxying. This isn't necessary normally, but may be useful if the destination
# IP is e.g. a load balancer's IP.
#auth_proxy_self =
# Show more verbose process titles (in ps). Currently shows user name and
# IP address. Useful for seeing who are actually using the IMAP processes
# (eg. shared mailboxes or if same uid is used for multiple accounts).
#verbose_proctitle = no
# Should all processes be killed when Dovecot master process shuts down.
# Setting this to "no" means that Dovecot can be upgraded without
# forcing existing client connections to close (although that could also be
# a problem if the upgrade is e.g. because of a security fix).
#shutdown_clients = yes
# If non-zero, run mail commands via this many connections to doveadm server,
# instead of running them directly in the same process.
#doveadm_worker_count = 0
# UNIX socket or host:port used for connecting to doveadm server
#doveadm_socket_path = doveadm-server
# Space separated list of environment variables that are preserved on Dovecot
# startup and passed down to all of its child processes. You can also give
# key=value pairs to always set specific settings.
#import_environment = TZ
##
## Dictionary server settings
##
# Dictionary can be used to store key=value lists. This is used by several
# plugins. The dictionary can be accessed either directly or though a
# dictionary server. The following dict block maps dictionary names to URIs
# when the server is used. These can then be referenced using URIs in format
# "proxy::<name>".
dict {
  #quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
  #expire = sqlite:/etc/dovecot/dovecot-dict-sql.conf.ext
}
# Most of the actual configuration gets included below. The filenames are
# first sorted by their ASCII value and parsed in that order. The 00-prefixes
# in filenames are intended to make it easier to understand the ordering.
!include conf.d/*.conf
# A config file can also tried to be included without giving an error if
# it's not found:
!include_try local.conf

我/etc/postfix/main.cf的是:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file = /etc/postfix/ssl/mailserver.crt
smtpd_tls_key_file = /etc/postfix/ssl/mailserver.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = ubuntu-vm.localdomain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost, ubuntu-vm, localhost.localdomain, localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
smtpd_sasl_local_domain = 
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
smtp_tls_security_level = may
smtpd_tls_security_level = may
smtpd_tls_auth_only = no
smtp_tls_note_starttls_offer = yes
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
localhost = example.com

此外,我去localhost/squirrelmail/src/configtest.php并收到:

SquirrelMail configtest
This script will try to check some aspects of your SquirrelMail configuration and point you to errors whereever it can find them. You need to go run conf.pl in the config/ directory first before you run this script.
SquirrelMail version:   1.4.23 [SVN]
Config file version:    1.4.0
Config file last modified:  01 July 2020 20:51:58
Checking PHP configuration...
    PHP version 7.0.33-0ubuntu0.16.04.15 OK.
    Running as www-data(33) / www-data(33)
    display_errors:
    error_reporting: 22527
    variables_order OK: GPCS.
    PHP extensions OK. Dynamic loading is disabled.
    ERROR: You have configured PHP not to allow short tags (short_open_tag=off). This shouldn't be a problem with SquirrelMail or any plugin coded coded according to the SquirrelMail Coding Guidelines, but if you experience problems with PHP code being displayed in some of the pages and changing setting to "on" solves the problem, please file a bug report against the failing plugin. The correct contact information is most likely to be found in the plugin documentation.
Checking paths...
    Data dir OK.
    Attachment dir OK.
    Plugins OK.
    Themes OK.
    Default language OK.
    Base URL detected as: http://localhost/squirrelmail/src (location base autodetected)
Checking outgoing mail service....
    SMTP server OK (220 ubuntu-vm.localdomain ESMTP Postfix (Ubuntu))
Checking IMAP service....
    IMAP server ready (* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready.)
    Capabilities: * CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN
Checking internationalization (i18n) settings...
     gettext - Gettext functions are available. On some systems you must have appropriate system locales compiled.
     mbstring - Mbstring functions are unavailable. Japanese translation won't work.
     recode - Recode functions are unavailable.
     iconv - Iconv functions are available.
     timezone - Webmail users can change their time zone settings.
Checking database functions...
    not using database functionality.
Congratulations, your SquirrelMail setup looks fine to me!
Login now
postfix dovecot 16.04
  • 1 个回答
  • 2021 Views
Martin Hope
user1046658
Asked: 2020-06-26 12:22:36 +0800 CST

为什么 tr "\oo" " " 不能替换 "\" 字符?

  • 2

我跑了echo "\oo" | tr "\oo" " ",输出是:

\

\o不是特殊字符,比如\n,那为什么 也\没有转换成空格呢?

command-line tr
  • 2 个回答
  • 624 Views
Martin Hope
user1046658
Asked: 2020-06-23 20:16:18 +0800 CST

关于 nc -l 和 nc -lp 的困惑

  • 0

在手册页中nc -l,它说:

It is an error to use this option in conjunction with the -p, -s, or -z options.

但我在网上看到的大多数使用此命令的示例都使用nc -lp [port].

你可以-p用-linnc吗?只是nc -l [port], 是它的正确用法,因为当我在另一个终端上用 连接到它时nc [ip address] [port],它可以工作。此外,当我使用nc -lp [port]并连接到它时nc [ip address] [port],它也可以工作。这两个命令有区别吗?

command-line netcat
  • 2 个回答
  • 903 Views
Martin Hope
user1046658
Asked: 2020-06-22 13:06:30 +0800 CST

systemctl start [service] 和 systemctl start [service].service 有什么区别?

  • 2

使用命令systemctl start apache2和systemctl start apache2.service,它们之间有什么区别吗?

是什么.service意思?它会做任何不做的事情systemctl start apache2吗?

或者apache2只是 的缩短版本apache2.service?

command-line systemd
  • 2 个回答
  • 385 Views
Martin Hope
user1046658
Asked: 2020-06-16 19:58:42 +0800 CST

find -name "*.mp3" 中的星号和句点有什么作用?

  • 19

在find -name "*.mp3".mp3 之前有一个星号。不*匹配它之前的字符多次吗?但是星号前面没有任何东西,那么它是做什么的*呢?还是因为find命令没有使用正则表达式?那么,..mp3 中的是正则表达式字符还是find只是将其解释为要匹配的句点?

command-line find
  • 3 个回答
  • 3498 Views
Martin Hope
user1046658
Asked: 2020-06-13 20:31:46 +0800 CST

什么是 iptables 中的扩展模块?

  • 2

iptables 手册页-m, --match match是:

指定要使用的匹配项,即测试特定属性的扩展模块。这组匹配构成了调用目标的条件。匹配项按照命令行中的指定从头到尾进行评估,并以短路方式工作,即如果一个扩展产生错误,评估将停止。

我不明白这是什么意思,具体来说,扩展模块是什么意思?

另外,与 有何iptables -A INPUT -m tcp ...不同iptables -A INPUT -p tcp ...?

iptables command-line
  • 1 个回答
  • 610 Views
Martin Hope
user1046658
Asked: 2020-06-13 14:03:44 +0800 CST

扩展正则表达式中的分组是什么意思?

  • 2

我读到分组将表达式视为一个单元。这意味着什么?

此外,做什么grep "\(grouping\)" file.txt或grep -E "(grouping)" file.txt做什么?我还读到表达式用括号分组。同样,什么是分组表达式?

当我运行该命令时,它会grouping在文件中突出显示。有什么grep "\(grouping\)"不同grep grouping?

command-line regex grep
  • 1 个回答
  • 209 Views
Martin Hope
user1046658
Asked: 2020-06-10 15:40:38 +0800 CST

iptables-restore < [file] 中的“<”是什么意思?

  • 0

“<”在里面有什么作用iptables-restore < [file]?

另外,这个命令有什么作用?它会改变文件吗?

还有其他使用“<”的命令或方法吗?

command-line
  • 1 个回答
  • 119 Views
Martin Hope
user1046658
Asked: 2020-03-19 11:12:01 +0800 CST

ls -l /boot 和 ls -l /boot/ 的区别

  • 0

我找到了一个解释 ls -l 命令的命令,它给出了一个示例,如ls -l /boot/. 我发现ls -l /boot并ls -l /boot/得到相同的结果。/boot 和 /boot/ 有什么区别吗?/ 启动后 (/boot / ) 与 /boot 没有 / 后启动相比是什么意思?

command-line
  • 1 个回答
  • 638 Views
Martin Hope
user1046658
Asked: 2020-02-23 17:17:42 +0800 CST

usermod -d /home (user) 对用户进行登录循环

  • 0

我正在使用 Ubuntu 16.04

我是root用户并输入命令:

usermod -d /home test

我相信这会将测试主目录的默认位置更改为 /home。但是当我登录用户时,测试,屏幕变黑并返回登录屏幕。

然后我回到我的帐户,并以 root 身份输入命令:

usermod -d /home/test test

/home/test 是测试的原始默认目录。

然后我登录到用户测试,我登录成功。

为什么会这样?我该怎么做才能更改测试的默认目录但不满足登录循环?

command-line login 16.04
  • 1 个回答
  • 594 Views
Martin Hope
user1046658
Asked: 2020-02-22 14:56:45 +0800 CST

如何撤消用户模式 ​​-e?

  • 2

我正在使用 Ubuntu 18.04。

我使用了命令

usermod -e YYYY_MM_DD user

现在,用户的帐户已过期。

我可以使用什么命令来删除用户帐户的到期日期?

command-line
  • 1 个回答
  • 873 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