小编Cpp*_*ner的帖子

在 df 中可以选择使用 1000 而不是 1024 的幂的理由是什么?

我很好奇df -Hand df -h,然后man df告诉我:

   -h, --human-readable
          print sizes in human readable format (e.g., 1K 234M 2G)

   -H, --si
          likewise, but use powers of 1000 not 1024
Run Code Online (Sandbox Code Playgroud)

那么使用 1000 次幂背后的原理是什么?

也许是一个附带问题(甚至相关):

root@host:~# df
Filesystem     1K-blocks      Used Available Use% Mounted on
Run Code Online (Sandbox Code Playgroud)

K区块是1024 还是 1000?

disk-usage history

8
推荐指数
1
解决办法
1296
查看次数

启动后了解 Systemd basic.target

我在这里的问题是了解basic.target启动我的 CentOS 7 服务器时的情况。

我认为我对 Systemd 的了解是正确的:

  • Requires=unit2意味着有些只有在全部成功的情况unit1下才会被激活unit2

  • Wants=unit2unit1表示无论列出的unit2是否成功,某些都会被激活

  • After=unit2意味着有些unit1只有在unit2激活后才会激活

  • Systemd 中的事物通常是并行开始的

  • .target主要用于“分组”和“排序”(参见systemd.target

  • 实际上,必须在达到(这是服务器的默认运行级别basic.target)之前激活(以及它所需和想要的一切)multi-user.target

好吧,我希望到目前为止我是对的。


现在,寻找basic.target

$ sudo cat /usr/lib/systemd/system/basic.target

[Unit]
Description=Basic System
Documentation=man:systemd.special(7)

Requires=sysinit.target
After=sysinit.target
Wants=sockets.target timers.target paths.target slices.target
After=sockets.target paths.target slices.target
Run Code Online (Sandbox Code Playgroud)

所以现在我的解释是:

  1. basic.target成功 才会激活sysinit.target

  2. 此外,basic.target希望能够sockets.target跑步等

  3. 附加After=手段,好的,请在、、激活basic.target后才激活。失败也没关系。sockets.targetpaths.targetslices.targettimers.target

  4. 那么为什么不将两者合而为一After=呢?为什么不使用Require=代替Wants(除了timers.target …

systemd

5
推荐指数
1
解决办法
3870
查看次数

在 Fedora 16 上安装 virtualenv

我来自 Ubuntu。我知道如何在 Ubuntu 上安装 virtualenv 和配置东西。现在 Fedora 对我来说似乎很奇怪......

遵循这两个指南:

在 Fedora 上设置 virtualenv、pip、virtualenvwrapper 和 IPython
如何在 Fedora 16 / 15 / 14 中安装 Virtualenv

当我尝试设置我的 virtualenv 时,我得到了这个

bash: virtualenv: 命令未找到...

我是在root下安装的。如果我这样做ls

$ su -
[root@localhost ~]# ls
anaconda-ks.cfg  bin  lib
[root@localhost bin]# ls
virtualenv  virtualenvwrapper.sh
[root@localhost bin]# 
[root@localhost bin]# cd
[root@localhost ~]# cd lib
[root@localhost lib]# ls
python2.7
[root@localhost lib]# cd python2.7/
[root@localhost python2.7]# ls
site-packages
[root@localhost python2.7]# cd site-packages/
[root@localhost site-packages]# ls
virtualenv-1.7-py2.7.egg-info  virtualenvwrapper
virtualenv.py                  virtualenvwrapper-2.11-py2.7.egg-info
virtualenv.pyc …
Run Code Online (Sandbox Code Playgroud)

fedora python

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

如何恢复对 shell 变量的更改?

为了实验的目的...

假设我这样做了

bash="unset DISPLAY; export DISPLAY"
Run Code Online (Sandbox Code Playgroud)

所以我可以使DISPLAY未定义。如何恢复原始值集?或者至少知道它是什么?

shell environment-variables

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