Help:Reading (简体中文) - ArchWiki

# Help:Reading (简体中文)

相关文章

- Help:Searching
- Help:Style (简体中文)

翻译状态： 本文是英文页面 Help:Reading (简体中文) 的翻译，最后翻译时间：2015-06-22，点击这里可以查看翻译后英文页面的改动。

本页面需要更新翻译，内容可能已经与英文脱节。要贡献翻译，请访问简体中文翻译组。

附注: 英文页面有更新，需要同步

新用户可能对 ArchWiki 中的操作和术语不是很了解，本文可以减少用户的误解，并减少 ArchWiki 中的重复内容。

## 一般用户还是 root 用户

有些命令是这样的:

    # mkinitcpio -p linux

另外一些命令是这样的：

    $ makepkg -s

井号(`#`)表示命令要以 root 权限执行，而美元符号(`$`)表示命令用一般用户权限执行。

Note: 用 `sudo -i` 可以进入 root 终端，在普通终端中使用`sudo command`也能让`command`以 root 权限执行，但是这个方式不支持 重定向 和 替代。详情参阅sudo.

注意有时候 # 表示文件中的注释，通常包含大写字母的文字都是注释。大部分文章都会知名这一点。

    # This alias makes ls colorize the listing
    alias ls='ls --color=auto'

## 附加、创建、编辑代码

When prompted to append, add, create or edit, consider it an indication for using a text editor, such as nano, in order to make changes to configuration file(s):

    # nano /etc/bash.bashrc

In programs, be it shells or otherwise, sourcing applies settings specified in a file. For Bash, sourcing can be done in a command prompt:

    $ source /etc/bash.bashrc

and it can also happen in a file itself:

    # This line includes settings from another file
    source /etc/bash.bashrc

As a result, sourcing a file after alteration is an implied omission in the case of shell files.

However, not all articles will specify the nature of the changes to be made, nor which file to alter in the first place. This wiki builds on previous knowledge, such as common locations for files that are prone to sporadic editing.

## 安装软件包

绝大部分文章仅是给出软件包的名字，不会列出详细的软件包安装命令。下面介绍一下通用的软件包安装方式。

### 官方软件包

如果软件包位于 官方软件仓库，安装指令是下面这样：

  Install the foobar package.

这意味着需要执行:

    # pacman -S foobar

pacman 包含了 Arch 软件包管理的详细内容。

### Arch 用户仓库(AUR)

如果软件包来自AUR，你会看到下面内容：

  Install the foobarAUR package.

这意味这您需要打开foobarAUR 链接，下载 PKGBUILD，解压，验证内容，然后在文件目录执行:

    $ makepkg -si

Arch User Repository (简体中文) 包含了 AUR 软件包的详细信息。

## 控制 systemd 单元

When an article invites to start, enable, stop or restart some systemd units (e.g. a service), it will not indicate the detailed instructions to do so, but instead you will read something like:

  Start `example.service`.

This means that you have to run:

    # systemctl start example.service

The Start link will lead you to the systemd article, which contains all the detailed explanations to deal with systemd units in Arch Linux proficiently.

## System-wide versus user-specific configuration

It is important to remember that there are two different kinds of configurations on a GNU/Linux system. System-wide configuration affects all users. Since system-wide settings are generally located in the `/etc` directory, root privileges are required in order to alter them. For example, to apply a Bash setting that affects all users, `/etc/bash.bashrc` should be modified.

User-specific configuration affects only a single user. Dotfiles are used for user-specific configuration. For example, the file `~/.bashrc` is the user-specific configuration file. The idea is that each user can define their own settings, such as aliases, functions and other interactive features like the prompt, without affecting other users' preferences.

Note: `~/` and `$HOME` are shortcuts for the user's home directory, usually `/home/username/`.

### Common shell files

For ease of use, here is a selective listing of basic configuration files and their locations.

#### Bash

See also: Bash and `man bash`

Within Bash and other Bourne-compatible shells, such as Zsh, there is even further differentiation in the purposes of the configuration files. Some files only get sourced when Bash is starting as a login shell, whereas other files only do so when Bash is an interactive shell.

When Bash is run in a virtual console, for instance, it is started as a login shell. Bash shells started in a Xorg session, such as those employed by xterm, are interactive shells.

Common files:

- `/etc/bash.bashrc`: System-wide settings; sourced only by a login shell
- `~/.bashrc`: Personal shell settings; sourced only by an interactive shell

#### Zsh

See also: Zsh and `man zsh`

Common files:

- `/etc/zsh/zprofile`: System-wide settings; sourced only by a login shell
- `~/.zshrc`: Personal shell settings; sourced only by an interactive shell

## Pseudo-variables in code examples

Some code blocks may contain so-called pseudo-variables, which, as the name says, are not actual variables used in the code. Instead they are generic placeholders and have to be manually replaced with system-specific configuration items before the code may be run or parsed. In the articles that comply with Help:Style/Formatting and punctuation, pseudo-variables are formatted in italics.

For example:

- Enable the `dhcpcd@interface_name.service` for the network interface identified from the output of the `ip link` command.

In this case interface_name is used as a pseudo-variable placeholder in a systemd template unit. All systemd template units, identifiable by the `@` sign, require a system-specific configuration item as argument. See Systemd#Using units.

- The command `dd if=data_source of=/dev/sd"X" bs=sector_size count=sector_number seek=partitions_start_sector` can be run as root to wipe a partition with the specific parameters.

In this case the pseudo-variables are used to describe the parameters that must be substituted for them. Details on how to gather them are elaborated on in the section Securely wipe disk#Calculate blocks to wipe manually, which features the command.

This article or section needs expansion.

Reason: Mention other examples, ideally from other device categories (e.g. storage), with links to background articles. The examples are meant to avoid duplicating existing explanations in other articles. (Discuss in Help talk:Reading (简体中文)#)

In case of file examples, pasting pseudo-variables in real configuration files might break the programs that use them.

### Ellipses

In most cases ellipses (`...`) are not part of the actual file content or code output, and instead represent omitted or optional text that is not relevant for the discussed subject.

For example `HOOKS="... encrypt ... filesystems ..."` or:

    /etc/X11/xorg.conf.d/50-synaptics.conf

    Section "InputClass"
        ...
        Option      "CircularScrolling"          "on"
        Option      "CircScrollTrigger"          "0"
        ...
    EndSection

Be aware though that, in a few instances, ellipses may be a meaningful part of the code syntax: attentive users will be able to easily recognize these cases by the context.

Category:

- Help (简体中文)

Hidden category:

- Pages or sections flagged with Template:Expansion