At the end of the boot up process, the
init daemon
is started, this can be
init
or
systemd
or
upstart
, etc. OpenWrt currently uses
procd
. Following the boot up scripts located in
/etc/rd.d
,
init
will then start all sorts of programs, amongst them the chosen shell. This listens to keyboard strokes and outputs a more or less colorful command-line interface to the connected display.
中文翻译
:在设备启动流程的最后阶段,启动了
初始化程序
。一般而言,这个初始化程序可以是
init
,或者是
systemd
, 或者是
upstart
,或其他别的什么程序;但OpenWrt目前使用的是
procd
程序。该阶段接下来执行的的启动脚本,就放在系统目录的“/etc/rd.d”目录下,“初始化”进程将执行所有该目录下的脚本,然后运行命令行控制台(shell)。之后就可以输入键盘字符,以及在显示终端里输出彩色的命令行文本信息了。
But most devices you run OpenWrt on, have neither a keyboard nor a display adapter. So we need to access it over the
serial port
(=local) or over the Ethernet port (= over the network).
中文翻译
:但是大部分你用来运行OpenWrt的设备上,既没有集成键盘,也没有显卡。所以,我们需要通过串口
serial port
(通过本机方式访问),或者通过以太网接口(通过网络方式访问)。
Network protocols of choice are
telnet
and
SSH
. Both follow the server ↔ client scheme. On the device running OpenWrt we deploy
telnetd
for the telnet protocol and
dropbear
for for the
SSH
protocol. Try
PuTTY
for the real look-and-feel, but you should definitely also checkout
WinSCP
! The latter won't work quite correctly, however
Konqueror
with
fish://
does! See
FISH (Files transferred over shell protocol)
.
中文翻译
:网络协议可以选用telnet、SSH。这两种协议采用客户端到服务器的通信模式。在运行了OpenWrt的设备商,我们安装“telnetd”软件来提供telnet协议访问,安装“dropbear”软件来提供SSH协议的访问。然后用
PuTTY
软件来连接,你八成也下载了
WinSCP
软件来访问文件,但WinSCP访问不是很正常,因此你最好用
Konqueror
软件,采用“ fish://”来访问文件。详情请参见
FISH (Files transferred over shell protocol)
。
(OpenWrt does also include a
SSH
-client
ssh
and a telnet-client
telnet
, in case you want to login from it to somewhere else.)
中文翻译
:(OpenWrt也包含了SSH-client和telnet-client这样的客户端,如果你想在OpenWrt系统里访问别的地方,你就可以直接用ssh或者telnet命令。)
Note:
Before
walkthrough_login
only
telnetd
will run, and after only
dropbear
.
中文翻译
:
注意:
在你要登录访问时,系统里dropbear软件运行成功的条件是,telnetd先要运行成功。
you change the content of existent variables and can define new ones
你可以修改的现有环境变量,也可以定义新的变量
When in PuTTY, you can mark text content with the mouse and, without pressing any key (like [Ctrl]+[c]), it is being automatically stored. You can then insert it the usual way (with [Ctrl]+[v]) in an other windows, e.g. an open firefox. The other way around, you copy text the usual way [Ctrl]+[c]) and then paste it in PuTTY by pressing the [right mouse button]!
中文翻译
:当你使用PuTTY这个软件的时候,你可以用鼠标来标记显示的文字,然后它们就被自动复制了,甚至不用按Ctrl+C这样的按键。你还可以使用类似于Ctrl+v按键组合来在另外的窗口粘贴这些内容,比如在浏览器里粘贴。其他的方法,如在别的窗口里按Ctrl+c复制,在PuTTY软件里面用鼠标右键来粘贴。
df
disk free
显示当前可用的磁盘空间. 同样详见
flash.layout
理解
/rom
,以及其他内容. 以及参照
df
的帮助文件,查看具体选项. 使用
df -h
获取帮助信息.
free
查看内存的使用情况
uptime
从启动到现在经历的时间长度
dmesg
显示开机信息,或者控制系统内的环状缓冲区(ring buffer)
logread
显示从syslogd服务程序产生的信息 (使用 circular buffer)
cat /proc/version
显示当前系统版本
cat /proc/meminfo
更详细的内存使用信息
cat /proc/cpuinfo
CPU信息
cat /proc/mtd
存储设备(使用内存类似技术)的分局表
cat /proc/partitions
系统分区表
cat /proc/net/nf_conntrack
记录当前系统里存在的网络连接的表
cat /proc/cmdline
cat /proc/modules
显示当前系统已经加载的模块
There is a ton of commands with a ton of options. On a full blown Linux distribution you would issue a
man command
to learn about the command and its options. However OpenWrt is minimalistic and thus does not contain this functionality. So either read the man-pages (manual pages) on another GNU/Linux machine or read them online: e.g. at
https://man.cx/
. Man pages are in the process of being translated.
中文翻译
:系统有巨量的命令还有巨量的选项。在一个完整的Linux发行版本中,你可以使用“man
命令名称
”命令来了解命令和它的选项。OpenWrt最小化配备地风格,以至于就没包含这个功能(译者注:指man帮助功能)。所以,你可以在另外一台包含了帮助文件的Linux机器上,或者在网页上去了解帮助内容:比如通过
https://man.cx/
网站。帮助页面也正在被翻译之中。
Tip
In firefox, you can use
keywords
to simplify the usage. Create a new bookmark, use
https://man.cx/?page=%s
as address and
man
as keyword.
中文翻译
:
提示
在火狐浏览器中,你可以使用
keywords
来简化查找命令帮助流程。标记一个新的书签,使用
https://man.cx/?page=%s
作为网址,以及
man
作为关键字。
The standard text editor included is
vi
. Until you get used to it, vi is neither intuitive nor pretty.
vi
has two modes:
command mode
and
insert mode
.
to enter command mode press [Esc] (escape key)
to enter insert mode press either [i] for
insert
or [a] for
append
vi
starts out in command mode
In order to get out of vi, you have to be in
command mode
. Press [Esc] (the escape key). Then issue one of the following commands:
:w
to write the current file to disc, this will overwrite the old file
:q
to quit without writing
:wq!
to (forcefully) write to disk and then quit vi
:%s/string1/string2/g
replace string1 with string2 in the whole file
If you do not like
vi
, try
joe
,
mg
,
nano
,
vim
,
vim-full
,
vim-help
,
vim-runtime
,
zile
and there may be other text editors available in the OpenWrt repos
when logged in via WinSCP/Konqueror you can also use some Editor on your PC
You may need to restart the system to let vim be installed properly.