我曾经shred
擦拭过我的外部硬盘:
sudo shred -vz /dev/sdb
我还应该补充一点,磁盘有 5 个坏扇区。
我想验证磁盘是否已归零,按照https://superuser.com/questions/1510233/is-there-a-faster-way-to-verify-that-a-drive-has-been-complete-zeroed
我不太熟悉dd
,但我相信这些表明它已被归零:
sudo dd if=/dev/sdb status=progress | hexdump
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
5000916670976 bytes (5.0 TB, 4.5 TiB) copied, 45754 s, 109 MB/s
9767541167+0 records in
9767541167+0 records out
5000981077504 bytes (5.0 TB, 4.5 TiB) copied, 45756.7 s, 109 MB/s
48c61b35e00
Run Code Online (Sandbox Code Playgroud)
sudo dd if=/dev/sdb status=progress | od | head
5000952267264 bytes (5.0 TB, 4.5 TiB) copied, 45739 s, 109 …
Run Code Online (Sandbox Code Playgroud) 对于我所有的服务器PasswordAuthentication
都no
在sshd_config
文件中设置。这意味着只允许密钥验证。
在这种情况下,如果在客户端PasswordAuthentication
设置为,是否有任何风险?yes
ssh_config
使用 Cygwin (W10) 我历来用它来测量脚本中的执行时间:
#!/bin/sh
(time {
sleep 1;
})
Run Code Online (Sandbox Code Playgroud)
我现在已经转移到 Debian(Linux 的 Windows 子系统),同样的脚本给出了这个错误:
Syntax error: "}" unexpected (expecting ")")
Run Code Online (Sandbox Code Playgroud)
我也在这里尝试了两个建议的脚本:https : //askubuntu.com/a/431184但都失败了:
$ foo() {
sleep 1;
echo "Hello World"
}
$ time foo
Hello World
Run Code Online (Sandbox Code Playgroud)
和
$ foo() {
sleep 1;
echo "Hello World"
}
$ export -f foo
$ echo foo | /usr/bin/time /bin/bash
Hello World
Run Code Online (Sandbox Code Playgroud)
具有相同的错误消息:
Syntax error: "(" unexpected
Run Code Online (Sandbox Code Playgroud)
顺便说一下,我已经安装了/usr/bin/time
.
有人可以帮忙吗?
谢谢
编辑:根据要求,脚本很简单:
#!/bin/bash
(time {
sleep 1;
})
Run Code Online (Sandbox Code Playgroud) 我有以下文件,我只想Removed '2022-01-30_01-00-05'
在最后从中提取。
Removing '2022-01-30_01-00-05'...
0.46% complete (00:03:45 remaining)^M 5.49% complete (00:00:17 remaining)^M 24.90% complete (00:00:06 remaining)^M 60.56% complete (00:00:01 remaining)^M 82.12% complete (00:00:00 remaining)^M 82.39% complete (00:00:01 remaining)^M 84.24% complete (00:00:01 remaining)^M 86.48% complete (00:00:01 remaining)^M 88.58% complete (00:00:01 remaining)^M 89.66% complete (00:00:01 remaining)^M101.08% complete (00:00:00 remaining)^M104.62% complete (00:00:00 remaining)^M ^MRemoved '2022-01-30_01-00-05'
Run Code Online (Sandbox Code Playgroud)
我已经尝试过dos2unix
,但没有成功。
我已经尝试了下面的这些变体,但是当我less output
他们要么不删除^M
字符,要么捕获整行:
tr -d $'\r' < /file | grep "Removed" > output
tr -d '^M' < /file | grep …
Run Code Online (Sandbox Code Playgroud)