(一)Linux基本描述,基本命令以及环境变量
1 Linux 发行版
Linux 发行版(英语:Linux distribution,也被叫做GNU/Linux 发行版),为一般用户预先集成好的Linux操作系统及各种应用软件。一般用户不需要重新编译,在直接安装之后,只需要小幅度更改设置就可以使用,通常以软件包管理系统来进行应用软件的管理。现在有超过300个Linux发行版(Linux发行版列表)。大部分都正处于活跃的开发中,不断地改进。
由于大多数软件包是自由软件和开源软件,所以Linux发行版的形式多种多样--从功能齐全的桌面系统以及服务器系统到小型系统(通常在嵌入式设备,或者启动软盘)。除了一些定制软件(如安装和配置工具),发行版通常只是将特定的应用软件安装在一堆函数库和内核上,以满足特定用户的需求。
流行的发行版
基于Dpkg (Debian系)
商业发行版
Ubuntu,一个非常流行的桌面发行版,由Canonical维护 社群发行版 Debian,一个强烈信奉自由软件,并由志愿者维护的系统 Kubuntu, 使用KDE桌面的Ubuntu Linux Mint,从Ubuntu派生并与Ubuntu兼容的系统 Knoppix,第一个Live CD发行版,可以从可移动介质运行,Debian的派生版 OpenGEU,Ubuntu的派生版 Elementary OS:基于Ubuntu,接口酷似Mac OS X gOS和其他上网本用的系统基于RPM (Red Hat系)
商业发行版
Red Hat Enterprise Linux,Fedora的商业版,由Red Hat维护和提供技术支持 openSUSE,最初由Slackware分离出来,现在由Novell维护社群发行版
Fedora,是Red Hat的社区版,会经常引入新特性进行测试 PCLinuxOS,Mandriva的派生版本,由社区维护的非常流行的发行版 CentOS,从Red Hat发展而来的发行版,由志愿者维护,旨在提供开源的,并与Red Hat 100%兼容的系统 Mageia,从Mandriva发展而来的发行版基于其他包格式
ArchLinux,一个基于KISS(Keep It Simple and Stupid)的滚动更新的操作系统 Chakra,一个从ArchLinux派生出来,只使用KDE桌面的半滚动更新发行版 Gentoo,一个面向高级用户的发行版,所有软件的源代码需要自行编译 Slackware,最早的发行版之一,1993年创建,由Patrick J. Volkerding维护2 Linux常用命令格式
Linux系统常用命令格式:
command[选项] [参数]其中选项以-开始,多个选项可用一个-连起来,如ls -l -a与ls -la。根据命令的不同,参数分为可选的或必须的。
使用linux命令最主要的是要会使用命令帮助,常见的命令帮助有:
1.man command(系统手册中的命令帮助)
2.info command(超级详细的命令帮助)
3.command --help(shell内部的命令帮助)
4.whatis(简短的命令说明)
5.apropos(联机模糊搜索)
Linux命令格式实例
cat
[root@svr-75# cat --helpUsage: cat [OPTION]... [FILE]...Concatenate FILE(s), or standard input, to standard output. -A, --show-all equivalent to -vET -b, --number-nonblank number nonempty output lines, overrides -n -e equivalent to -vE -E, --show-ends display $ at end of each line -n, --number number all output lines -s, --squeeze-blank suppress repeated empty output lines -t equivalent to -vT -T, --show-tabs display TAB characters as ^I -u (ignored) -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB --help display this help and exit --version output version information and exitWith no FILE, or when FILE is -, read standard input.Examples: cat f - g Output f's contents, then standard input, then g's contents. cat Copy standard input to standard output.GNU coreutils online help: For complete documentation, run: info coreutils 'cat invocation'cat 命令用于连接文件并打印到标准输出设备上。使用--help查询cat命令的用法。(介于文档都是英文的,学好英语很重要)
一个实例,使用cat -n显示出每个line属于哪一行
[root@ansible-svr data]# cat welcomeThis is a test file.Welcome to the Linux World.Hope you have a amazing journey with me.[root@ansible-svr data]# cat -n welcome 1 This is a test file. 2 Welcome to the Linux World. 3 Hope you have a amazing journey with me.history
linux的history命令的作用是,记录执行过的命令。
用法:
* history [n] n为数字,列出最近的n条命令* -c 将目前shell中的所有history命令消除* -a 将目前新增的命令写入histfiles, 默认写入~/.bash_history* -r 将histfiles内容读入到目前shell的history记忆中* -w 将目前history记忆的内容写入到histfileshistory命令可以修改输出格式,下面是正常的输出格式:
[root@ansible-svr ~]# history 1 history数字代表第一条历史记录,如果现在我们想更改输出格式,使之可以显示出时间,我们则可以用以下命令:
HISTTIMEFORMAT="%F %T "我们再来看看history的输出"
[root@ansible-svr ~]# history 1 2019-11-01 01:32:24 history 2 2019-11-01 01:34:24 HISTTIMEFORMAT="%F %T " 3 2019-11-01 01:34:27 history但是使用这段命令并不能永久保存,退出环境下次就不能生效,如何使之永久生效呢。这时候得配置永久的环境变量。
3 环境变量
上例代表临时更改环境变量,那么如何永久更变环境变量呢。
profile文件:
修 改/etc/profile(对所有用户都是有效的)#vi /etc/profile在里面加入:export PATH="$PATH:/home/xyz/Tesseract/bin"bashrc文件:
修改~/.bashrc文件。 (每个用户目录下都有,ls -all,单独用户有效)cd ~vi .bashrc在里面加入:export PATH="$PATH:/opt/au1200_rm/build_tools/bin"永久设置方法一般需要重新注销系统才能生效