小编Dmi*_*yev的帖子

我可以在没有 sudo 的情况下删除 .bash_history 吗?

我不希望它对我的系统执行此操作,但我想知道是否可以删除.bash_history

如果是,那你能不能再提一次,否则历史就再也没有了?

另外,该history命令是否使用该.bash_history文件?

bash command-history

3
推荐指数
1
解决办法
460
查看次数

GUI 中可识别的文件类型,但命令行上无法识别

我最近意识到fileDebian Bullseye 无法识别我正在处理的某些文件格式,告诉我它们只是 ZIP 文件:

user@host:~ $ file file.docx   # Correct, not a regular ZIP file
file.docx: Microsoft Word 2007+

user@host:~ $ file file.key    # Incorrect, also not a regular ZIP file
file.key: Zip archive data, at least v2.0 to extract
Run Code Online (Sandbox Code Playgroud)

但是,如果我查看带有 的文件pcmanfm,我会发现文件类型被正确识别:

"file.docx" (50.5kB) Word 2007 document
"file.key" (10.4MB) Apple Keynote 5 presentation
Run Code Online (Sandbox Code Playgroud)

是否可以告诉使用file与使用相同的魔术文件pcmanfm,或者以某种方式更新默认值/etc/magicfile了解流行的文档格式?

debian file-types

3
推荐指数
1
解决办法
229
查看次数

dpkg 抱怨缺少已安装的软件包

尝试letsencrypt在 Debian Jessie上安装时,我遇到了以下我不太明白的情况。我已经安装了python-acme

dpkg -l | grep acme
ii  python-acme  0.6.0-1~bpo8+1  all  ACME protocol library for Python 2
Run Code Online (Sandbox Code Playgroud)

现在我正在尝试安装python-letsencrypt

apt-get install python-letsencrypt
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 …
Run Code Online (Sandbox Code Playgroud)

debian dpkg apt dependencies

2
推荐指数
1
解决办法
370
查看次数

如何查找给定字符编码的区域设置名称?

的手册页setlocale似乎说语言代码和字符编码名称足以设置适当的区域设置:

区域设置名称通常采用 language[_territory][.codeset][@modifier] 形式,其中 language 是 ISO 639 语言代码,region 是 ISO 3166 国家/地区代码,codeset 是字符集或编码标识符,例如 ISO- 8859-1 或 UTF-8。

然而,快速测试表明,只有区域设置名称的“修饰符”部分是可选的:

void tryLocale(const char * locid)
{
    char * result = std::setlocale(LC_CTYPE, locid);
    std::cout << locid << " = " << (result ? result : "fail") << std::endl;
}

int main()
{
    tryLocale("de");           // de = fail
    tryLocale("de_DE");        // de_DE = fail
    tryLocale("de_DE.CP1252"); // de_DE.CP1252 = de_DE.CP1252
    tryLocale("de.CP1252");    // de.CP1252 = fail
    tryLocale(".CP1252");      // .CP1252 = fail
}
Run Code Online (Sandbox Code Playgroud)

我的问题是我只知道所需的编码名称(例如ISO-8859-1 …

character-encoding locale

2
推荐指数
1
解决办法
541
查看次数