Translate

The <command>editor</command> command starts a text editor (such as <command>vi</command> or <command>nano</command>) and allows creating, modifying and reading text files. The simplest files can sometimes be created directly from the command interpreter thanks to redirection: <command>echo "<replaceable>text</replaceable>" &gt;<replaceable>file</replaceable></command> creates a file named <replaceable>file</replaceable> with “<replaceable>text</replaceable>” as its contents. Adding a line at the end of this file is possible too, with a command such as <command>echo "<replaceable>moretext</replaceable>" &gt;&gt;<replaceable>file</replaceable></command>. Note the <literal>&gt;&gt;</literal> in this example.
SourceTranslationState
16

<computeroutput>$ </computeroutput><userinput>pwd</userinput>
<computeroutput>/home/rhertzog
$ </computeroutput><userinput>cd Desktop</userinput>
<computeroutput>$ </computeroutput><userinput>pwd</userinput>
<computeroutput>/home/rhertzog/Desktop
$ </computeroutput><userinput>cd .</userinput>
<computeroutput>$ </computeroutput><userinput>pwd</userinput>
<computeroutput>/home/rhertzog/Desktop
$ </computeroutput><userinput>cd ..</userinput>
<computeroutput>$ </computeroutput><userinput>pwd</userinput>
<computeroutput>/home/rhertzog
$ </computeroutput><userinput>ls</userinput>
<computeroutput>Desktop Downloads Pictures Templates
Documents Music Public Videos</computeroutput>

<computeroutput>$ </computeroutput><userinput>pwd</userinput>
<computeroutput>/home/rhertzog
$ </computeroutput><userinput>cd 桌面</userinput>
<computeroutput>$ </computeroutput><userinput>pwd</userinput>
<computeroutput>/home/rhertzog/桌面
$ </computeroutput><userinput>cd .</userinput>
<computeroutput>$ </computeroutput><userinput>pwd</userinput>
<computeroutput>/home/rhertzog/桌面
$ </computeroutput><userinput>cd ..</userinput>
<computeroutput>$ </computeroutput><userinput>pwd</userinput>
<computeroutput>/home/rhertzog
$ </computeroutput><userinput>ls</userinput>
<computeroutput>桌面 下载 图片 模板 文档 音乐 公共 视频</computeroutput>
17
A new directory can be created with <command>mkdir <replaceable>directory</replaceable></command>, and an existing (empty) directory can be removed with <command>rmdir <replaceable>directory</replaceable></command>. The <command>mv</command> command allows <emphasis>moving</emphasis> and/or renaming files and directories; <emphasis>removing</emphasis> a file is achieved with <command>rm <replaceable>file</replaceable></command>.
您可以使用 <command>mkdir <replaceable>目录名</replaceable></command> 命令创建一个新的目录,且可以使用 <command>rmdir <replaceable>目录名</replaceable></command> 命令删除一个已存在的(空的)目录。<command>mv</command> 命令可以<emphasis>移动</emphasis>和/或重命名文件和目录;<emphasis>删除</emphasis>一个文件可以使用 <command>rm <replaceable>文件名</replaceable></command> 命令来完成。
18

<computeroutput>$ </computeroutput><userinput>mkdir test</userinput>
<computeroutput>$ </computeroutput><userinput>ls</userinput>
<computeroutput>Desktop Downloads Pictures Templates Videos
Documents Music Public test
$ </computeroutput><userinput>mv test new</userinput>
<computeroutput>$ </computeroutput><userinput>ls</userinput>
<computeroutput>Desktop Downloads new Public Videos
Documents Music Pictures Templates
$ </computeroutput><userinput>rmdir new</userinput>
<computeroutput>$ </computeroutput><userinput>ls</userinput>
<computeroutput>Desktop Downloads Pictures Templates Videos
Documents Music Public</computeroutput>

<computeroutput>$ </computeroutput><userinput>mkdir test</userinput>
<computeroutput>$ </computeroutput><userinput>ls</userinput>
<computeroutput>桌面 下载 图片 模板 视频
文档 音乐 公共 test
$ </computeroutput><userinput>mv test new</userinput>
<computeroutput>$ </computeroutput><userinput>ls</userinput>
<computeroutput>桌面 下载 new 公共 视频
文档 音乐 图片 模板
$ </computeroutput><userinput>rmdir new</userinput>
<computeroutput>$ </computeroutput><userinput>ls</userinput>
<computeroutput>桌面 下载 图片 模板 视频
文档 音乐 公共</computeroutput>
19
Displaying and Modifying Text Files
显示和修改文本文件
20
The <command>cat <replaceable>file</replaceable></command> command (intended to <emphasis>concatenate</emphasis> files to the standard output device) reads a file and displays its contents on the terminal. If the file is too big to fit on a screen, use a pager such as <command>less</command> (or <command>more</command>) to display it page by page.
<command>cat <replaceable>文件名</replaceable></command>命令(用于<emphasis>连接(concatenate)</emphasis>文件并将内容送至标准输出设备)读取文件并将其内容显示在终端上。如果文件过大而不适合屏幕显示的话,可以使用一个分页器进行辅助,例如<command>less</command>(或者<command>more</command>)以按页在屏幕上显示内容。
21
The <command>editor</command> command starts a text editor (such as <command>vi</command> or <command>nano</command>) and allows creating, modifying and reading text files. The simplest files can sometimes be created directly from the command interpreter thanks to redirection: <command>echo "<replaceable>text</replaceable>" &gt;<replaceable>file</replaceable></command> creates a file named <replaceable>file</replaceable> with “<replaceable>text</replaceable>” as its contents. Adding a line at the end of this file is possible too, with a command such as <command>echo "<replaceable>moretext</replaceable>" &gt;&gt;<replaceable>file</replaceable></command>. Note the <literal>&gt;&gt;</literal> in this example.
22
Searching for Files and within Files
搜索文件和在文件中搜索
23
The <command>find <replaceable>directory</replaceable> <replaceable>criteria</replaceable></command> command looks for files in the hierarchy under <replaceable>directory</replaceable> according to several criteria. The most commonly used criterion is <literal>-name <replaceable>name</replaceable></literal>: that allows looking for a file by its name.
24
The <command>grep <replaceable>expression</replaceable> <replaceable>files</replaceable></command> command searches the contents of the files and extracts the lines matching the regular expression (see sidebar <xref linkend="sidebar.regexp" />). Adding the <literal>-r</literal> option enables a recursive search on all files contained in the directory passed as a parameter. This allows looking for a file when only a part of the contents are known.
25
Managing Processes
管理进程
26
The <command>ps aux</command> command lists the processes currently running and helps identifying them by showing their <emphasis>pid</emphasis> (process id). Once the <emphasis>pid</emphasis> of a process is known, the <command>kill -<replaceable>signal</replaceable> <replaceable>pid</replaceable></command> command allows sending it a signal (if the process belongs to the current user). Several signals exist; most commonly used are <literal>TERM</literal> (a request to terminate gracefully) and <literal>KILL</literal> (a forced kill).

Loading…

Loading…

Glossary

Source Translation
and
BACK TO BASICS 基本知识
collection of tools 工具集
device file 设备文件
files 文件
IN PRACTICE 实践
named pipe 命名管道
NOTE 笔记

Source information

Flags
xml-text
Source string age
3 years ago
Translation file
zh-CN/​92_short-remedial-course.po, string 21
String priority
Medium