当我用来set -x调试命令时,它会输出一些额外的行。
% set -x
+precmd_update_git_vars:1> [ -n '' ']'
+precmd_update_git_vars:1> [ '!' -n '' ']'
+precmd_update_git_vars:2> update_current_git_vars
+update_current_git_vars:1> unset __CURRENT_GIT_STATUS
+update_current_git_vars:3> [[ python == python ]]
+update_current_git_vars:4> _GIT_STATUS=+update_current_git_vars:4> python /home/ismail/zshfiles/gitstatus.py
+update_current_git_vars:4> _GIT_STATUS=''
+update_current_git_vars:6> __CURRENT_GIT_STATUS=( '' )
+update_current_git_vars:7> GIT_BRANCH=''
+update_current_git_vars:8> GIT_AHEAD=''
+update_current_git_vars:9> GIT_BEHIND=''
+update_current_git_vars:10> GIT_STAGED=''
+update_current_git_vars:11> GIT_CONFLICTS=''
+update_current_git_vars:12> GIT_CHANGED=''
+update_current_git_vars:13> GIT_UNTRACKED=''
+precmd_update_git_vars:3> unset __EXECUTED_GIT_COMMAND
Run Code Online (Sandbox Code Playgroud)
由于这些输出,我无法调试我的命令。
为什么set -x调试我的.zshrc?我set -x只想调试 后面的行set -x。
我在用rofi 1.5.4
假设我运行命令
echo -e "Option #1\nOption #2\nOption #3" | rofi -dmenu -multi-select | xargs -I{} echo {}
Run Code Online (Sandbox Code Playgroud)
我应该使用什么键来选择多个菜单项?
早些时候我使用 fsarchiver 创建压缩分区映像。由于一些奇怪的行为,我选择用dd.
所以,我学习了,
这些基本上说的是,我必须使用以下命令进行备份
dd if=/dev/sda2 status=progress | gzip -c > /media/mint/Data/_Fsarchiver/MintV1.img.gz
Run Code Online (Sandbox Code Playgroud)
和以下命令来恢复
gunzip -c /media/mint/Data/_Fsarchiver/MintV1.img.gz | dd of=/dev/sda2 status=progress
Run Code Online (Sandbox Code Playgroud)
现在我想更换gzip -c及gunzip -c与zstd&zstd -d
我想出的命令是
压缩
sudo dd if=/dev/sda2 status=progress | zstd -16vT6 > /media/mint/Data/_Fsarchiver/MintV1.zst
Run Code Online (Sandbox Code Playgroud)
解压
zstd -vdcfT6 /media/mint/Data/_Fsarchiver/MintV1.zst | dd of=/dev/sda2 status=progress
Run Code Online (Sandbox Code Playgroud)
尝试这些命令是否安全,还是我做错了什么?
我已经读了一段时间了。
我的理解是:
请告知我上述说法是否正确或错误。如果错误的话请给我正确的说法。
我正在使用 Linux Mint 20。
我正在使用带有终止开关 ( protonvpn-cli ks --on)的 vpn 。
因此,如果 vpn 连接由于某种原因断开,网络将断开连接。
当网络断开连接时,我的youtube-dl下载永久停止并出现错误
ERROR: Unable to download JSON metadata: <urlopen error [Errno -2] Name or service not known> (caused by URLError(gaierror(-2, 'Name or service not known')))
Run Code Online (Sandbox Code Playgroud)
问题是,我想youtube-dl暂停而不是关闭,并在连接恢复时恢复。
我检查了连接断开连接不起作用时的重试,但我认为这与我的问题无关。
我的配置文件看起来像
--abort-on-error
--no-warnings
--console-title
--batch-file='batch-file.txt'
--socket-timeout 10
--retries 10
--continue
--fragment-retries 10
Run Code Online (Sandbox Code Playgroud)
当我使用批处理文件时,我不想从头开始这个过程。我只想暂停该youtube-dl过程,直到我再次连接,然后继续该过程。
我怎样才能做到这一点?
更新 1:
到目前为止,我发现的是,要暂停一个过程,我们可以执行以下操作:
$ kill -STOP 16143
Run Code Online (Sandbox Code Playgroud)
要恢复流程,我们可以执行以下操作:
$ kill -CONT 16143
Run Code Online (Sandbox Code Playgroud)
我想在命令完成后得到如下报告:
Start Time: 02/01/21 01:27pm
End Time: 02/01/21 02:29pm
Total Duration: 01 Hour 02 Minutes
Run Code Online (Sandbox Code Playgroud)
我发现我可以使用date +"%d/%m/%y %I:%M%P".
例如,
start=$(date +"%d/%m/%y %I:%M%P")
start_duration=$(date +%s)
youtube-dl
end=$(date +"%d/%m/%y %I:%M%P")
end_duration=$(date +%s)
runtime=$((end_duration-start_duration))
echo "Start Time: ${start}"
echo "End Time: ${end}"
Run Code Online (Sandbox Code Playgroud)
几个问题。
Total Duration: 01 Hour 02 Minutesyoutube-dl在这个脚本中。我试过:
#! /bin/bash
Before=$(date +%s)
echo "$Before"
exec "$@"
ret=$?
After=$(date +%s)
echo "$After"
let Duration=After-Before
echo "$Duration"
if [[ $ret -eq 0 ]]
then
echo "Start Time: …Run Code Online (Sandbox Code Playgroud) 在我的机器上,我有多个 xdg-desktop-portal 实例:
$ ls -la /usr/share/xdg-desktop-portal/portals
.rw-r--r-- 100 root 23 Mar 14:48 gnome-keyring.portal
.rw-r--r-- 99 root 20 Mar 02:25 gnome-shell.portal
.rw-r--r-- 548 root 18 Oct 2022 gnome.portal
.rw-r--r-- 495 root 29 Nov 2022 gtk.portal
Run Code Online (Sandbox Code Playgroud)
我无法确定当前正在使用哪一个。
我可以使用什么命令来查找我正在使用哪个 xdg-desktop-portal?
我的书单(txt 文件)中有重复项,如下所示 -
The Ideal Team Player
The Ideal Team Player: How to Recognize and Cultivate The Three Essential Virtues
Ideal Team Player: Recognize and Cultivate The Three Essential Virtues
Joy on Demand: The Art of Discovering the Happiness Within
Crucial Conversations Tools for Talking When Stakes Are High
Joy on Demand
Search Inside Yourself: The Unexpected Path to Achieving Success, Happiness
Search Inside Yourself
......
......
......
Run Code Online (Sandbox Code Playgroud)
我需要找到重复的书籍并在检查后手动删除它们。我搜索并发现这些行需要一个模式。
前任。
但就我而言,在线条中找到模式很困难。但是,我在单词序列中找到了一个模式。
我只想将行标记为重复,只有当它们有三个连续的单词(不区分大小写)时。
如果你看到你会发现——
The Ideal …Run Code Online (Sandbox Code Playgroud) 如果我运行(使用 sudo)
\nsudo find / -xdev -type f ! -path '/home/blueray/*' ! -path '/timeshift/*' > log.txt\nRun Code Online (Sandbox Code Playgroud)\n它可以正常工作,没有任何问题。
\n但是,如果我在没有 sudo 的情况下运行相同的命令,我会在控制台中收到一些错误。搜索结果log.txt是正确的(没有问题)。但我不明白错误消息。
% find / -xdev -type f ! -path '/home/blueray/*' ! -path '/timeshift/*' > log.txt\nfind: \xe2\x80\x98/timeshift/snapshots/2022-01-09_22-00-46/localhost/etc/polkit-1/localauthority\xe2\x80\x99: Permission denied\nfind: \xe2\x80\x98/timeshift/snapshots/2022-01-09_22-00-46/localhost/etc/ssl/private\xe2\x80\x99: Permission denied\nfind: \xe2\x80\x98/timeshift/snapshots/2022-01-09_22-00-46/localhost/etc/cups/ssl\xe2\x80\x99: Permission denied\nfind: \xe2\x80\x98/timeshift/snapshots/2022-01-09_22-00-46/localhost/var/log/private\xe2\x80\x99: Permission denied\nfind: \xe2\x80\x98/timeshift/snapshots/2022-01-09_22-00-46/localhost/var/log/speech-dispatcher\xe2\x80\x99: Permission denied\nfind: \xe2\x80\x98/timeshift/snapshots/2022-01-09_22-00-46/localhost/var/spool/rsyslog\xe2\x80\x99: Permission denied\nfind: \xe2\x80\x98/timeshift/snapshots/2022-01-09_22-00-46/localhost/var/spool/cups\xe2\x80\x99: Permission denied\nfind: \xe2\x80\x98/timeshift/snapshots/2022-01-09_22-00-46/localhost/var/spool/cron/crontabs\xe2\x80\x99: Permission denied\nfind: \xe2\x80\x98/timeshift/snapshots/2022-01-09_22-00-46/localhost/var/lib/apt/lists/partial\xe2\x80\x99: Permission denied\nfind: \xe2\x80\x98/timeshift/snapshots/2022-01-09_22-00-46/localhost/var/lib/colord/.cache\xe2\x80\x99: Permission denied\nfind: \xe2\x80\x98/timeshift/snapshots/2022-01-09_22-00-46/localhost/var/lib/AccountsService/users\xe2\x80\x99: Permission denied\nfind: \xe2\x80\x98/timeshift/snapshots/2022-01-09_22-00-46/localhost/var/lib/bluetooth/5C:F3:70:93:BD:85\xe2\x80\x99: Permission denied\nfind: \xe2\x80\x98/timeshift/snapshots/2022-01-09_22-00-46/localhost/var/lib/lightdm-data/lightdm\xe2\x80\x99: Permission denied\nfind: \xe2\x80\x98/timeshift/snapshots/2022-01-09_22-00-46/localhost/var/lib/polkit-1\xe2\x80\x99: …Run Code Online (Sandbox Code Playgroud) bash ×5
command-line ×5
shell-script ×4
zsh ×3
networking ×2
compression ×1
dd ×1
debian ×1
debugging ×1
find ×1
firewall ×1
gnome ×1
iptables ×1
linux-mint ×1
nftables ×1
rofi ×1
search ×1
set ×1
shell ×1
xdg ×1
zstd ×1