00. 目录
01. 概述
我们前面已经开始使用了一些目录相关的命令,其实Linux 中的命令很多,但一般在使用的时候会遵守一定的格式。为了便于使用命令,我们对命令格式进行详细说明。
02. 命令提示符
命令提示符解析:
[deng@localhost ~]$
- 1
下面具体看看上面一句话各个字段的意思。
-
[]:这是提示符的分隔符号,没有特殊含义。
-
deng:显示的是当前的登录用户
-
@:分隔符号,没有特殊含义。
-
localhost:当前系统的简写主机名(完整主机名是 localhost.localdomain)。
-
~:代表用户当前所在的目录,此例中用户当前所在的目录是家目录。
-
#:命令提示符,Linux 用这个符号标识登录的用户权限等级。如果是超级用户,提示符就是 #;如果是普通用户,提示符就是$。
03. 用户家目录
Linux 系统是纯字符界面,用户登录后,要有一个初始登录的位置,这个初始登录位置就称为用户的家:主目录超级用户的家目录:/root。普通用户的家目录:/home/用户名。
用户在自己的家目录中拥有完整权限,所以我们也建议操作实验可以放在家目录中进行。我们切换一下用户所在目录,看看有什么效果。
[deng@localhost ~]$ cd /usr/local/src
[deng@localhost src]$
- 1
- 2
如果切换用户所在目录,那么命令提示符中的会变成用户当前所在目录的最后一个目录(不显示完整的所在目录 /usr/ local/src,只显示最后一个目录 src)。
04. 命令的基本格式
格式:
命令 [选项] [参数]
命令: 可执行文件
选项:用于调整命令的功能。命令不同,选项的个数和内容会有所不同;要实现的命令功能不同,选项的个数和内容也会有所不同。
参数:是命令处理的对象,通常情况可以是文件名、目录、或用户名。
温馨提示:命令格式中的 [] 代表可选项,也就是有些命令可以不写选项或参数,也能执行。
05. 选项的作用
选项的作用就是调整命令的功能。
ls 命令之后不加选项和参数也能执行,不过只能执行最基本的功能,即显示当前目录下的文件名。
[deng@localhost local]$ ls
bin etc games include lib lib64 libexec sbin share src ssl
[deng@localhost local]$
- 1
- 2
- 3
如果加一个"-l"选项,则可以看到显示的内容明显增多了。"-l"是长格式(long list)的意思,也就是显示文件的详细信息。至于 “-l” 选项的具体含义,我们稍后再详细讲解。可以看到选项的作用是调整命令功能。如果没有选项,那么命令只能执行最基本的功能;而一旦有选项,则可以显示更加丰富的数据。
[deng@localhost local]$ ls -l
总用量 0
drwxr-xr-x. 2 root root 92 7月 4 16:19 bin
drwxr-xr-x. 2 root root 6 4月 11 2018 etc
drwxr-xr-x. 2 root root 6 4月 11 2018 games
drwxr-xr-x. 3 root root 33 2月 21 11:36 include
drwxr-xr-x. 2 root root 6 4月 11 2018 lib
drwxr-xr-x. 4 root root 159 7月 4 16:19 lib64
drwxr-xr-x. 2 root root 6 4月 11 2018 libexec
drwxr-xr-x. 2 root root 6 4月 11 2018 sbin
drwxr-xr-x. 6 root root 60 11月 14 2018 share
drwxr-xr-x. 2 root root 6 4月 11 2018 src
drwxr-xr-x 5 root root 140 7月 4 16:19 ssl
[deng@localhost local]$
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
Linux 的选项又分为短格式选项(-l)和长格式选项(–all)。
短格式选项是英文的简写,前面有一个-号。
[deng@localhost local]$ ls -a
. .. bin etc games include lib lib64 libexec sbin share src ssl
[deng@localhost local]$
- 1
- 2
- 3
而长格式选项是英文完整单词,前面用两个-号
[deng@localhost local]$ ls --all
. .. bin etc games include lib lib64 libexec sbin share src ssl
[deng@localhost local]$
- 1
- 2
- 3
一般情况下,短格式选项是长格式选项的缩写,也就是一个短格式选项会有对应的长格式选项。当然也有例外,比如 ls 命令的短格式选项 -l 就没有对应的长格式选项。所以具体的命令选项可以通过后面我们要学习的帮助命令来进行査询。
06. 参数的作用
参数是命令的操作对象,一般文件、目录、用户和进程等可以作为参数被命令操作。
[itcast@localhost ~]$ ls -l /home/itcast/
总用量 0
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 公共
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 模板
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 视频
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 图片
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 文档
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 下载
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 音乐
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 桌面
[itcast@localhost ~]$
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
命令一般都需要加入参数,用于指定命令操作的对象是谁。如果可以省略参数,则一般都有默认参数。
[itcast@localhost ~]$ ls
公共 模板 视频 图片 文档 下载 音乐 桌面
[itcast@localhost ~]$
- 1
- 2
- 3
这个 ls 命令后面没有指定参数,默认参数是当前所在位置,所以会显示当前目录下的文件名。
07. 注意事项
命令、命令选项、命令参数之间用空格隔开。
[itcast@localhost ~]$ ls -a
. .bash_profile .dbus .local 视频 音乐
.. .bashrc .esd_auth .mozilla 图片 桌面
.bash_history .cache .ICEauthority 公共 文档
.bash_logout .config .kshrc 模板 下载
[itcast@localhost ~]$
- 1
- 2
- 3
- 4
- 5
- 6
当有多个命令选项时,可以进行合并。例如,可以将 ls -a /
和 ls -l /
合并为
[itcast@localhost ~]$ ls -l -a
总用量 28
drwx------ 15 itcast itcast 319 7月 12 17:34 .
drwxr-xr-x. 5 root root 46 7月 12 17:32 ..
-rw------- 1 itcast itcast 36 7月 12 17:36 .bash_history
-rw-r--r-- 1 itcast itcast 18 4月 11 2018 .bash_logout
-rw-r--r-- 1 itcast itcast 193 4月 11 2018 .bash_profile
-rw-r--r-- 1 itcast itcast 231 4月 11 2018 .bashrc
drwxrwxr-x 13 itcast itcast 275 7月 12 17:36 .cache
drwxrwxr-x 14 itcast itcast 261 7月 12 17:36 .config
drwx------ 3 itcast itcast 25 7月 12 17:34 .dbus
-rw------- 1 itcast itcast 16 7月 12 17:34 .esd_auth
-rw------- 1 itcast itcast 314 7月 12 17:34 .ICEauthority
-rw-r--r-- 1 itcast itcast 172 4月 11 2018 .kshrc
drwx------ 3 itcast itcast 19 7月 12 17:34 .local
drwxr-xr-x 4 itcast itcast 39 11月 8 2018 .mozilla
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 公共
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 模板
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 视频
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 图片
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 文档
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 下载
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 音乐
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 桌面
[itcast@localhost ~]$ ls -al
总用量 28
drwx------ 15 itcast itcast 319 7月 12 17:34 .
drwxr-xr-x. 5 root root 46 7月 12 17:32 ..
-rw------- 1 itcast itcast 36 7月 12 17:36 .bash_history
-rw-r--r-- 1 itcast itcast 18 4月 11 2018 .bash_logout
-rw-r--r-- 1 itcast itcast 193 4月 11 2018 .bash_profile
-rw-r--r-- 1 itcast itcast 231 4月 11 2018 .bashrc
drwxrwxr-x 13 itcast itcast 275 7月 12 17:36 .cache
drwxrwxr-x 14 itcast itcast 261 7月 12 17:36 .config
drwx------ 3 itcast itcast 25 7月 12 17:34 .dbus
-rw------- 1 itcast itcast 16 7月 12 17:34 .esd_auth
-rw------- 1 itcast itcast 314 7月 12 17:34 .ICEauthority
-rw-r--r-- 1 itcast itcast 172 4月 11 2018 .kshrc
drwx------ 3 itcast itcast 19 7月 12 17:34 .local
drwxr-xr-x 4 itcast itcast 39 11月 8 2018 .mozilla
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 公共
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 模板
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 视频
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 图片
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 文档
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 下载
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 音乐
drwxr-xr-x 2 itcast itcast 6 7月 12 17:34 桌面
[itcast@localhost ~]$
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
08. 参考
移植验证
OpenHarmony芯片移植完成后,需要开展OpenHarmony兼容性测试以及芯片SDK功能性测试。除可获得测试认证之外,还可以在开发阶段提前发现缺陷,大幅提高代码质量。
OpenHarmony兼容性测试
OpenHarmony兼容性测试是XTS(OpenHarmony生态认证测试套件)之一,详见 OpenHarmony兼容性测试。
- 添加test子系统以及xts_acts部件。 在“vendor/xxx/xxx/config.json”文件中,添加如下代码:
{
"subsystem": "test",
"components": [
{ "component": "xts_acts", "features":[] },
{ "component": "xts_tools", "features":[] }
]
}
class="hljs-button signin active" data-title="登录复制" data-report-click="{"spm":"1001.2101.3001.4334"}">
评论记录:
回复评论: