27期第一周学习小结

第一周

1. 描述计算机的组成及其功能。

计算机主要组成部分以下五种:运算器,控制器,存储器,输入设备,输出设备。

  • 运算器的功能是对数据进行算术运算与逻辑运算,就是对数据进行加工处理。

  • 控制器的功能是调度二进制程序,数据,内存寻址,以及协调计算机输入设备和输出设备等各计算机部件之间的正常工作。

  • 存储器的功能是存储二进制指令和数据。存储器是编址存储单元。

  • 输入设备的功能是将程序,文字,图片,映像等输入到计算机。常见的输入设备有键盘,鼠标,磁带机,光驱等。

  • 输出设备的功能是把计算机处理指令和数据的结果输出显示器,打印机,绘图仪等外设设备。

2. 按系列罗列linux的发行版,并描述不同发行版之间的联系与区别。

Linux目前主流的发行版如下: Debian,Ubuntu,Knopix,RedHat,Fedora,CentOS,Slackware,SUSE,OpenSUSE,Archlinux,Mandriva,Gentoo等。

  • Debian于1993年创建,遵循GUN规范的Linux系统。Debian系统分为三个版本分支Stable,Testing和Unstable。Ubuntu和Knoppix是Unstable分支的Debian二次发行版。

  • 1994年RedHat公司在美国创立。2002年RedHat公司推出了企业版(RHEL)。Fedora是RHEL的社区版。CentOS是RHEL的克隆版本,CentOS将RHEL发行的源代码从新编译,形成可使用的二进制版本。

  • SUSE Linux原是以Slackware为基础二次开发的版本。SUSE Linux也提供了一个企业服务器版本,名为SUSE Linux Enterprise Server(SLES)OpenSUSE是SUSE Linux的社区版。

  • Archlinux是基于Linux From Scratch开发的版本。Gentoo和Mandriva是基于GUN/Linux开发的版本。

3. 描述Linux的哲学思想,并按照自己的理解对其进行解释性描述。

Linux的哲学思想与解释性描述如下:

  • 一切皆文件。普通文件,目录,块设备文件,字符设备文件,socket等,都是以文件形式呈现。

  • 有众多功能单一的程序组成,组合小程序完成复杂任务。众多功能单一的小程序保证Linux高效,快速运转。每个小程序只做一件事,并做好。众多功能单一的小程序完成复杂任务,避免出错率。

  • 尽量避免与用户交互。Linux上支持的编程语言种类丰富,易于以编程的方式实现任务自动化。

  • 使用文本文件保存配置信息。创建,修改配置文件只需文本编辑器即可。简单易用。

4. 说明Linux系统上命令的使用格式;详细介绍ifconfig,echo,tty,startx,export,pwd,history,shutdown,poweroff,reboot,hwclock,date命令的使用,并配合相应的示例来阐述。

Linux系统上的命令使用格式:COMMAND OPTIONS… ARGUMENTS…
       1. COMMAND:命令本身是一个可执行二进制程序文件,多数命令都存放在/bin;/sbin;/usr/bin;/usr/sbin;/usr/local/bin;/usr/local/sbin。命令分内置命令和外置命令。

       2. OPTIONS:指定命令的运行特性。OPTIONS有短,长选项之分。
              []:可选内容
              <>:必须给的内容
              a|b|c:多选一,a,b,c中只能选一个
              …:同类内容可出现多个

       3. ARGUMENTS:指命令的作用对象。

  • ifconfig – configure a network interface 配置一个网络借口
    语法:ifconfig [interface] or ifconfig interface [aftype] options | address …
    up 开启以太网端口
    down 关闭以太网端口

[root@node1 ~]#ifconfig eth0 down 关闭eth0以太网端口

  • echo – display a line of text 显示一行文本
    语法:echo [SHORT-OPTION]… [STRING]… 
    -n 输出不换行
    -e 启用反斜杠逃逸符解释
    -E 不启动反斜杠逃逸符解释
    \n 换行
    \t 横向制表符
    \v 纵向制表符
    \b 删除前一个字符

[root@node1 ~]# echo GNU/Linux 
GNU/Linux 显示GNU/Linux
[root@node1 ~]# echo -e “GNU/Linux \tUNIX” 转义字符必须与-e选项连用
GNU/Linux UNIX

  • tty – print the file name of the terminal connected to standard input 显示标准输入的终端的文件名
    语法:tty [OPTION]…

[root@node1 ~]# tty
/dev/pts/0 显示当前终端

  • startx – initiate window terminal 启动图形终端

[root@node1 ~]# startx & 此命令前提是Linux系统已安装KDE或Gnome图形终端程序

  • export – Set export attribute for shell variables 为shell变量设置导出属性或显示所有变量
    语法:export [-fn] [name[=value] …] or export -p

[root@node1 ~]# export CentOS=GNU/Linux 设置变量名为CentOS的值为GNU/Linux 
[root@node1 ~]# echo $CentOS 用echo命令显示变量CentOS
GNU/Linux 显示值GNU/Linux

  • pwd – print name of current/working directory 显示完整文件名或当前工作目录的名字
    语法:pwd [OPTION]…
    -L 显示包含逻辑链接
    -P 避免所有的逻辑链接

[root@node1 sysconfig]# pwd
/etc/sysconfig 显示当前所在目录

  • history – Display or manipulate the history list 显示或使用命令历史列表
    语法: history [-c] [-d offset] [n]
    -c 清空所有历史记录条目
    -d 删除单条或多条历史命令记录
    -w 把当前历史记录写入历史记录文件,覆盖历史记录文件的内容

[root@node1 sysconfig]# cd /etc/
[root@node1 etc]# history 显示历史命令 1 history
2 cd /etc/
3 history
[root@node1 ~]# cd /var/log/
[root@node1 log]# history
1 cd /var/log/
2 history
[root@node1 log]# history -d 1 执行删除历史命令列表中第一条命令
[root@node1 log]# history
1 history
2 history -d 1
3 history

  • shutdown – bring the system down 关机,重启命令
    语法:shutdown [OPTION]… TIME [MESSAGE]
           -r reboot 重启
           -h halt/power off 关机 
           -c cancel 取消关机 
           -k 发送提醒信息,但实际不会关机

[root@node1 etc]# shutdown -h 30 “This service will be shutdown in 30 mins.”
The system is going down for halt in 30 minutes! This service will be shutdown in 30 mins.

  • poweroff – stop the system 关机命令
    语法:poweroff [OPTION]… 
           -f 强制关机,不调用shutdown命令。

[root@node1 etc]#poweroff -f

  • reboot – reboot the system 重启系统 语法:reboot [OPTION]… 
           -f 强制重启,不调用shutdown指令。 
           -w 在/var/log/wtmp写入关机记录,但不重启动。

[root@node1 etc]#reboot 
在调用reboot命令前,关机时间记录会先被写入/var/log/wtmp。如果加-f选项,关机时间则不会写入/var/log/wtmp

  • hwclock – query and set the hardware clock (RTC) 显示和设置硬件时钟 
    语法:hwclock [functions] [options]
           -r 读取硬件时钟并在标准输出显示时间
           -s –hctosys 设置系统时间为硬件时钟时间 
           -w –systohc 设置硬件时钟时间为系统时间

[root@node1 ~]# hwclock -r
Fri 14 Jul 2017 08:46:45 PM CST -0.719736 seconds

  • date – print or set the system date and time 显示和设置系统的日期和时间
    语法:date [OPTION]… [+FORMAT] or date [MMDDhhmm[[CC]YY][.ss]]
           %c 显示当前日期和时间
           %F 同%Y-%m-%d 显示年月日
           %D 同%m/%d/%y 显示月日年
           %T 同%H:%M:%S 显示小时,分钟,秒
           %s 显示从1970年1月1日零点零分零秒至今走过的秒数

[root@node1 ~]# date “+%D %T”
07/14/17 20:57:55 显示当前日期和时间
[root@node1 ~]# date 080808082008.08
Fri Aug 8 08:08:08 CST 2008 修改系统时间为2008年8月8日8点08分08秒

5. 如何在Linux系统上获取命令的帮助信息,请详细列出,并描述man文档的章节是如何划分的。

命令分两类,第一类是系统内置命令另一类是外部命令

获取内置命令的帮忙信息格式为help COMMAND

[root@node1 ~]# help cd
cd: cd [-L|-P] [dir] Change the shell working directory.

Change the current directory to DIR.  The default DIR is the value of the
HOME shell variable.

The variable CDPATH defines the search path for the directory containing
DIR.  Alternative directory names in CDPATH are separated by a colon (:).
A null directory name is the same as the current directory.  If DIR begins
with a slash (/), then CDPATH is not used.

If the directory is not found, and the shell option `cdable_vars' is set,
the word is assumed to be  a variable name.  If that variable has a value,
its value is used for DIR.

Options:
    -L  force symbolic links to be followed
    -P  use the physical directory structure without following symbolic
    links

The default is to follow symbolic links, as if `-L' were specified.

Exit Status:
Returns 0 if the directory is changed; non-zero otherwise.

获取此外部命令的方式有如下几种
a, COMMAND –help

[root@node1 ~]# mkdir –help

Usage: mkdir [OPTION]... DIRECTORY...  
Create the DIRECTORY(ies), if they do not already exist.

Mandatory arguments to long options are mandatory for short options too.  
  -m, --mode=MODE   set file mode (as in chmod), not a=rwx - umask  
  -p, --parents     no error if existing, make parent directories as needed  
  -v, --verbose     print a message for each created directory  
  -Z, --context=CTX  set the SELinux security context of each created

b, man COMMAND

[root@node1 ~]# man basename

BASENAME(1)              User Commands                     BASENAME(1)

NAME
   basename - strip directory and suffix from filenames

SYNOPSIS
   basename NAME [SUFFIX]
   basename OPTION

DESCRIPTION
   Print  NAME with any leading directory components removed.  If
   specified, also remove a trailing SUFFIX.

   --help display this help and exit

   --version
          output version information and exit

EXAMPLES
   basename /usr/bin/sort
          Output "sort".

   basename include/stdio.h .h
          Output "stdio".
AUTHOR
   Written by David MacKenzie.

REPORTING BUGS
   Report basename bugs to bug-coreutils@gnu.org
   GNU coreutils  home  page:  <http://www.gnu.org/software/core-
   utils/>
   General help using GNU software: <http://www.gnu.org/gethelp/>
   Report basename translation  bugs  to  <http://translationpro-
   ject.org/team/>

COPYRIGHT
   Copyright  ©  2010  Free  Software  Foundation,  Inc.  License
   GPLv3+:     GNU     GPL      version      3      or      later
   <http://gnu.org/licenses/gpl.html>.
   This is free software: you are free to change and redistribute
   it.  There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
   dirname(1), readlink(1)

   The full documentation for basename is maintained as a Texinfo
   manual.   If  the  info  and  basename  programs  are properly
   installed at your site, the command

          info coreutils 'basename invocation'

   should give you access to the complete manual.

GNU coreutils 8.4            October 2014                BASENAME(1)

c, info COMMAND 获取命令的在线文档

d, 大多数应用程序自带帮助文件在/usr/share/doc目录下

e, 登录官网查找Linux发行版或程序的官方文档

f, 使用搜索引擎 如google

man帮助文档共有8个章节
1. user commands 用户命令
2. system calls 系统调用
3. C Library Functions C库功能
4. Devices and Sepcial Files 设备文件和特殊文件
5. File Formats and Conventions 文件格式和协定
6. Games 游戏
7. Miscellanea 杂项
8. System Administration tools and Deamons 系统管理工具与守护进程

如不知道命令有哪些章节可用whatis COMMAND查看

[root@node1 doc]# whatis passwd
sslpasswd (1ssl)     – compute password hashes
passwd (1)             – update user’s authentication tokens

6. 请罗列Linux发行版的基础目录名称命名法则及功用规定

Linux发行版的基础目录如下:
/:根 /bin:普通用户和root都可使用的命令
/boot:系统启动目录,如内核文件,引导文件,boot loader,grub,开机配置文件 
/dev:设备文件
/etc:配置文件
/home:普通用户家目录
/lib:32位库文件
/lib64:64位库文件
/lost+found:丢失文件找回
/media:挂载点
/mnt:挂载点
/opt:第三方软件安装目录
/proc:虚拟文件系统,存放进程信息
/root:root的家目录
/sbin:系统管理命令目录,仅root可用
/selinux:强制访问控制系统 /srv:系统提供服务的数据
/sys:虚拟文件系统,内核与驱动的信息
/tmp:临时文件目录
/usr:Unix System Resource,存放各种程序和数据
       /usr/local/bin 普通用户应用程序命令
       /usr/local/sbin 管理员应用程序命令
/var:存放日志文件,登录文件等常态性变动的文件

原创文章,作者:ZhengBin,如若转载,请注明出处:http://www.178linux.com/80659

(0)
ZhengBinZhengBin
上一篇 2017-07-15 09:56
下一篇 2017-07-15 10:30

相关推荐

  • nginx负载均衡搭建

    组 网络拓扑图 nginx负载均衡服务器搭建 首先准备三台机器 主机A(nginx负载均衡器) 主机B 主机C 主机A需两块网卡(一块外网,一块内网) 主机B和主机C各一块 (各一块内网的IP,如果主机B C和主机A内网网卡在一个网段就不需要配置网关地址了。 规划好网络后,nginx负载主机分别ping下各rs主机是否可通 主机A打开核心转发功能 #echo…

    Linux干货 2017-05-17
  • ngx_http_proxy_module

    ngx_http_proxy_module 1.proxy_pass Syntax: proxy_pass URL; Context: location, if in location, limit_except 这条指令将来是用的相当多的指令。 v  附加1:proxy_pass后面的路径不带uri时,其会将loca…

    2016-10-30
  • 管道和用户管理权限

           一周的时间又过去了,感觉过得太快了,但是过得很充实,这就够啦!把在平时的学习中觉得重要有意义的地方记录下来,希望可以对自己以后的学习有所帮助! 1.把/etc/issue转化为大写,并重定向到issue.out. 管道的作用很强大,|将正确的结果重定向给下一条命令;连接命令;一页一页地…

    2017-07-22
  • Codis集群3.03安装配置基础

    Codis基础 01.codis是一个分布式的Redis解决方案,对于上层的应用来说,连接Codis Proxy和连接原生的Redis Server没有明显的区别。 codis底层会处理请求的转发,不停机的数据迁移等工作,所有后边的一切事情,对于前面客户端来说是透明的,可以简单的认为后边连接是一个内存无限大的Redis服务。 codis架构图如下: 02.c…

    Linux干货 2016-09-26
  • redis简介

    redis是一种非关系性数据库,单进程工作模型,通常用来做KV存储,同memcached一样,所有数据加载至内存工作因此工作效率非常快,但他会将内存中的数据同步至磁盘当中,使得数据不会像memcached的一样,断电后丢失数据。 自身支持多种数据结构(此处列出常用数据结构) string:单一的kv存储 hash:支持hash计算后的存储 list:列表存储…

    2017-03-17
  • 理解基本权限以及特殊权限:Suid 、Sgid、Sticky以及acl

    理解基本权限以及特殊权限:Suid 、Sgid、Sticky以及acl 在Linux中特殊权限是什么?为什么要设定特殊权限?回答这个问题前,我们不妨思考为什么要设定权限? 大家知道Linux中一切皆文件。不论你是什么,在linux系统中都会被当做一个文件来看待。无论你是文本或目录,硬件或软件,图片或视频等等,统统都被当做文件来看待。所以,在linux中,文件…

    Linux干货 2017-04-08

评论列表(1条)

  • 马哥教育
    马哥教育 2017-07-22 21:34

    整理的很细致,很赞。