Linux Essentials (8-27)

First, the three components

1, the three major components of the computer as CPU, memory, IO (I / O I / O (input / output), and the IO device is divided into two portions IO interface)

2, CPU three elements: computing, controller, memory

3, CPU can only read data from memory, and the memory data is easily lost

4, IO (or bus refers to a hardware device): a control bus, a data bus

Second, the operating system

   (Running applications) under Kai (connecting hardware device) applications on the operating system of a bearing, the operating system is to manage computer hardware and software resources of a computer program, but also the core and the cornerstone of the computer system. The operating system need to be addressed as priorities memory management and configuration, the system determines supply and demand of resources, the control input device and an output device, the basic operation of the network and management of the transaction file system. Operating system also provides a user interface to let users interact with the system.

Third, the operating system interface

1, GUI ----- graphical user interface (GNOME, KDE, XFCE)

  CLI ----- Command Line Interface (shell)

Common shell program: sh ---- bash, csh, tcsh, ksh, zsh

Often see Linux system to support the shell program: cat / etc / shell

3, the system call: system call

Fourth, the operating system of historical knowledge

1, the three revenue system: GNU, Apache, BSD

2, common Linux distributions version: Slackware, Debian, RedHat

Five, Linux basic commands

1, use the command: Command + Option + operation object

2, get help command:

CPU architecture is a ring structure, from ring0 - ring3, built-in command to run on ring0, external command is run on ring3.

Extension: Quasi virtualization of: ring -1 ring0 ring3 hardware assisted virtualization technology (inter vt-x amd)

Built-in commands to get help: help command

External command to get help: command --help / - h

man (manual manual), 1-8 manual is divided into levels, each level corresponding to the content is not the same, and each command may be in one or several of help content.

1: Indicates user commands or parameters ------- use of some form of common user command usage

2: The system calls ------ check the commands associated system call

3: library library calls related ----- command

4: Special format (device file) ----

5: File Format (syntax of the configuration file)

6: Games

7:杂项(Miscellaneous)

8: Managing command (/ sbin, / usr / sbin, / usr / local / sbin) only have permission to use the command as an administrator, because they can modify the hardware parameters Example: man poweroff

man directory:

/ User / share / man .. [help manuals are all compressed files]

whatis command: View command supports the type of man level usage: whatis + command

man View command:

User Commands ---- user command

NAME --- name; generally display this command

SYNOPSIS-- summary; command usage

DESCRIPTION-- Description: the various parameters of the command, and its interpretation

AUTHOR ---- Author

COPYRIGHT ----- copyright; release of information

SEE ALSO ----- view additional information

man calls are more commands for file viewing.

After entering the man to see an interactive interface commands: / + content ---- default look down the specified content 

                    ? / + Content ----- default look up the specified content 

                On a N - n a

View info message: / user / share / doc / ....

3, PATH environment variable: View environment variable: echo $ PATH

4, check the time of the order: data: Check the system time         

          Clock, hwclock view the hardware time

          wclock -s (system clock to synchronize hardware clock, synchronized to the hardware clock)

Extended: ntp server: yum install ntp, to modify /etc/ntp.conf files, to achieve the client and server time synchronization

5, cd pwd: Print Directory

6, ls: it involves a lot of file attribute information: -i (indo) information (file system-related)

                      -l: Long Format View

Example: ls -l / bin / login

-rwxr-xr-x  1  root  root  38096  2008-11-13  14:54  /bin/login

第一个字段的第一个字符表示文件类型

rwxr-xr-x是三组权限位,rwx、r-x、r-x(权限三位为一组)分别表示属主、属组和其他人所拥有的权限。r表示可读取,w表示可写,x表示可执行。如果某个权限被禁用,就用一个短划线“-”代替 

第三个和第四个字段分别表示文件的属主和属组。在这个例子中,login文件的属主是root用户,属组是root组

紧跟着三组权限的数字表示该文件的链接数目。

最后的四个字段分别表示问文件大小,最后的修改日期和时间,以及这个文件的完整路径 

改变文件权限:chown和shgrp

文件类型:-:普通文件

      d:目录

      c:字符设备文件,也叫流设备文件

      b:块设备文件

      s:本地域套接口

      p:有名管道

      l:符号链接(软链接) 

7、file:查看文件的具体文件类型   例:普通的文本文显示ASCII文件

8、stat:查看文件的时间信息  

三种文件时间:ATime:文件的最近访问时间,只要读取(cat)文件,ATime就会改变   

        MTime:文件最近被修改过的时间

       CTime:当文件的目录目录被修改或者文件的所有者,权限等被修时,CTime就会更新

9、touch:可以创建文件,也用来修改时间Mtime、Ctime

10、cat tac :查看文件内容

       cat结合重定向可以多行输入

       cat -n:可以打印行号

       Ssh远程连接centos时使用的是pts接口

11、who、w(可以查看所有的登录用户)、whoami(查看当前登录的用户是谁)

      Whereis:查看命令所在位置

      Whatis:查看命令的绝对路径,查看man的帮助文档的

12、shutdown命令:shutdown now(立即关机)、shutdown -r now(立即重启)、shutdown +5(命令执行后五分钟关机)、shutdown -r 17:00(在17:00点重启)、shutdown 17:00(在17:00点关机)、shutdown -c(取消关机命令)

-c:取消目前已经进行中的关机动作

-r:关机后重新开机(重启)

-h:关机后停机 

Shutdown调用的是poweroff

halt----直接断电

Poweroff---会对进程做检查再断电

13、reboot:重启机器

14、Init 0(关机) init6(重启) init进程是所有进程的父进程

六、Linux的目录结构与目录管理

1、目录创建的规则:*FHS(文件系统层次化标注)指定了Linux操作系统哪些目录是一定要具备的

2、目录的结构为树形结构,从根开始,rootfs为根文件系统(是内核启动时所挂载的第一个文件系统)

   在系统启动后,硬盘需要被使用就需要有驱动程序,驱动程序在grub1.5阶段进行安装(此时/--->ramdisk),完成1.5阶段的磁盘驱动安装后,此时,就可以挂载真正的根文件系统,而这个文件系统,就是我们在系统安装时,指定的根分区,就叫做根文件系统,有了根以后,其他的目录均在根下;这种结构,我们就叫做树形结构。

文件系统与内核是完全独立的两个部分

Ramdisk:是一个虚根文件

3、常见目录:/boot-----存储启动程序,以及系统文件(可以单独分区)【只有少数几个目录可以作单独分区】

       /etc----默认的程序配置文件的目录

       /etc/opt:为安装在/opt目录下的软件程序的配置文件,现在用的不多 

       /etc/x11:在Linux下显示的图形界面C/S架构11是他的版本号X是协议,这是基本的图形显示规范 

       /etc/sgml:网页标签语句 

       /etc/xml:网页标签语句 

       /option----用来存放第三方软件程序(如Windows中的QQ)

       /usr/local----用来存放第三方软件的目录

       /bin   /sbin-----用来存放命令文件

       /sys  /proc-----系统进程文件(伪文件目录,虚拟文件目录) 

       /mnt  /media----/mnt挂载磁盘,长期需要挂载的设备文件挂载这个目录下,/media临时的设备文件就挂载/media目录下 

       /home  /root-----普通文件的家目录,root用户的家目录

       /var-----动态文件的存放的地方(会随时被修改的文件)

       /var/log-----专门用来存放日志

       /tmp----临时目录文件,供所有用户使用【在这个目录下的文件30天不访问就会被自动删除】

       /usr----在Linux系统中另一个独立王国

       /usr/local-----本地层级结构(安装完成后是空目录)取代了早期的/opt目录,第三方的程序都安装在这个目录下

       /lib  /lib64----库文件目录

       /dev----设备文件目录

 4、目录管理

 目录的相关命令:mkdir:创建目录,-pv参数,递归创建目录(即同时创建多级目录)

          rmdir、rm -r:删除目录

         tree -d:仅仅只显示目录文件

         mv:修改和移动目录名称

         cp -R:复制目录文件

Guess you like

Origin www.cnblogs.com/cqyyyyy/p/11416272.html