第四章第五章 环境搭建和24个命令总结

GUN 和 GPL

GUN‘s not Unix 递归写法,简写也是GUN

1. GUN 是84年自由软件资金会牵头弄的一个类unix操作系统,但是因为它不实用,而且总是跳票,所以并没有流行起来。

2. 但是它里面的很多软件是很好的,比如bash,这些都被用在了linux系统上

GPL

general public license

通用公共许可

84年Richeal Stallman 发起了自由软件运动后不久,在其他人的协作下,创立了GPL

Preamble
The GNU General Public License is a free, copyleft license for software and
 other kinds of works.
#官网的解释,GPL 是自由的,公共版权(copyleft)的,软件和其他的作品。

For example, if you distribute copies of such a program, 
whether gratis or for a fee, you must pass on to the recipients the same 
freedoms that you received. You must make sure that they, too, receive 
or can get the source code. And you must show them these terms so they
 know their rights.
#不管你的软件是免费还是收费,你都传递相同的自由给其他人。你必须要他们也获得了源代码。并且让
他们知道他们的权利。

Developers that use the GNU GPL protect your rights with two steps: 
(1) assert copyright on the software, and 
(2) offer you this License giving you legal permission to copy, distribute 
and/or modify it.
#开发者用两步保护你的权利:
   1. 确保软件的版权(是开发者的)
   2. 给你复制,传播,修改这个软件的权利

For the developers‘ and authors‘ protection, the GPL clearly explains that 
there is no warranty for this free software. 
For both users‘ and authors‘ sake, the GPL requires that modified versions 
be marked as changed, so that their problems will not be attributed 
erroneously to authors of previous versions.
#为了保护开发者,GPL明确了这些免费软件是没有保修的(质保?咋翻译呢)。
#任何修改过的软件都要注明修改版本,免得以后出问题责任归咎到前面版本的开发者。

Finally, every program is threatened constantly by software patents. 
States should not allow patents to restrict development and use of 
software on general-purpose computers, but in those that do, 
we wish to avoid the special danger that patents applied to a free
 program could make it effectively proprietary. 
 To prevent this, the GPL assures that patents cannot be used to render 
 the program non-free.
#这一段说的是专利法也不能用来限制软件的自由传播。有些州用专利法限制软件的传播,这些GPL是不
承认的。

linux内核是基于gun通用公共许可的,但是linux不是gun计划的一部分

24命令总结

命令总结

  1. mkdir 创建目录 -p 递归创建
  2. touch 创建文件
  3. ls 列表目录
  4. cd 切换目录
  5. echo 打印
  6. cp 拷贝目录文件  -r递归  -a(dpr)
  7. vi 记事本编辑
  8. head 查看前n行
  9. rm rm -f -r 目录 练!
  10. cat 查看文件内容
  11. rmdir 删除空目录
  12. grep -v 后面要排除的内容
    1. -B before 出了显示
    2. -A after
    3. -C context 前后
  13. find 目录  -type f 
        -name "名字" -mtime +7, 7, -7

    1. [[email protected] test]# find . -type f -name "*" -mtime +12
      ./space.txt
      ./awk.txt
      ./rex.txt
      ./tab.txt
      ./recode.txt
      ./root.txt
    1. eg
  14. sed 增删改查 -i 修改  -n 取消默认输出  -e多项编辑
    1. p s g
  15. alias 修改和设置别名,查看
  16. unalias 取消别名
  17. xargs 从标准输入读入创建执行命令 -n 1分组
    1. 记住从标准输入读入
    2. [[email protected] test]# find . -type f -name "*" -mtime -10 | xargs
      ./dtest_link.txt ./test1/jacob ./oldboy.txt ./dtest.txt
    3. [[email protected] test]# find . -type f -name "*" -mtime -10 | xargs -n 1
      ./dtest_link.txt
      ./test1/jacob
      ./oldboy.txt
      ./dtest.txt
    4. [[email protected] test]# find . -type f -name "*.txt" -mtime -10 | cat
      ./dtest_link.txt
      ./oldboy.txt
      ./dtest.txt
      [[email protected] test]# find . -type f -name "*.txt" -mtime -10 | xargs cat
      -->6)target is a good market
      -->1)target is a good market
      -->10)target is a good market
      -->3)tj_max is a good market
      -->9)target is a good market
      -->8)target is a good market
      -->13)target is a good market
      -->5)target is a good market
      -->2)walmart is a good market
  18. awk -F 指定分隔符 NR 行号 {print $1 $2}
  19. seq 打印序列
    1. 1 2 3 4 5 6 7 8 9 10

    1. seq
             -s " " 10 横着打印


      -s指定分隔符

    2. seq -s " " 10
  20. pwd 打印当前目录
  21. tree 打印目录结构 目录树
    1. yum
           install tree -y
  22. tr 截取 替换
  23. tail 尾巴 默认后10行, -n
        数字
  24. vim
        复杂编辑器 写 shell,python
  25. mv 移动 相当于改名
    1. [[email protected] test]# mv dtest.txt dtestchanged.txt
      [[email protected] test]# ls
      a                 dtest_link.txt  rex.txt             stu_nihao00_1.jpg
      aaaaaa.txt        dtest_soft.txt  riqi2017-07-22.txt  tab.txt
      awk.txt           md5.log         root.txt            test1
      b                 mod.txt         space.txt           today.txt
      c                 nihao.sh        sshd                umasktest1.txt
      ceshi.txt         oldboy.txt      stu_100_3.jpg       umasktest.txt
      checklog.sh       person.txt      stu_100_4.jpg
      dtestchanged.txt  recode.txt      stu_100_5.jpg
      [[email protected] test]# cat dtestchanged.txt
      -->6)target is a good market
      -->1)target is a good market
      -->10)target is a good market
    1. 移动到当前目录,相当于改名了
  26. date -s 改时间
    1. date -s
           "05/10/2009 10:18:00"

重点研究了cp这个命令


cp


默认复制是符号链接也就是软连接的


比如

[[email protected] test]# ln -s today.txt todaysoft.txt
[[email protected] test]# ln -s today.txt todaysoft1.txt
[[email protected] test]# cp todaysoft1.txt todaysoft3.txt
lrwxrwxrwx 1 root  root       9 Aug  3 23:44 todaysoft1.txt -> today.txt
-rwxr-xr-x 1 root  root      23 Aug  3 23:45 todaysoft3.txt
lrwxrwxrwx 1 root  root       9 Aug  3 23:44 todaysoft.txt -> today.txt

修改源复制的文件不会对源文件造成影响


    cp test2.sh
     test1.sh 这条命令不会把test1.sh的软连接也copy过去,这就是cp命令的默认设置。-d就关闭了这个称为derefrence(解除绑定)的默认选项

    eg:

    [[email protected] test]# cp -d todaysoft1.txt todaysoft4.txt
    lrwxrwxrwx 1 root  root       9 Aug  3 23:44 todaysoft1.txt -> today.txt
    -rwxr-xr-x 1 root  root      23 Aug  3 23:45 todaysoft3.txt
    lrwxrwxrwx 1 root  root       9 Aug  3 23:44 todaysoft4.txt -> today.txt
    lrwxrwxrwx 1 root  root       9 Aug  3 23:44 todaysoft.txt -> today.txt

      cp -d test2.sh
       test1.sh 就会保留这个链接


        -r 是递归复制,


          -a 包含了-d -p -r  -p是指包含一切诸如属组,修改时间等信息


            综上所述,-a是完全一样的复制
             但是这是对于除了硬链接以外的文件


              笔者尝试了cp
               一个硬链接,但是产生了一个与源文件inode不相同的文件,也就是说,cp 对硬链接的默认复制就是复制了一个源文件,并且是inode不同的源文件

              也就是相当于cp了源文件


                cp
                 为我们提供了一个专门创建硬链接的选项 -l


                  值得一提的是 ln这个命令的默认顺序是
                   要复制的在前面,硬链接的结果在后面

                  NAME
                         ln - make links between files
                  
                  SYNOPSIS
                         ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)
                         ln [OPTION]... TARGET                  (2nd form)
                         ln [OPTION]... TARGET... DIRECTORY     (3rd form)
                         ln [OPTION]... -t DIRECTORY TARGET...  (4th form)

                  [ ]
                   里面是可选的选项,就是说,默认情况下,目标在前,链接后的名字在后

                  最后一个 -t
                   选项, 可是更改过来,但是是对目录建立硬链接

                  若干特殊符号

                  >or1>输出重定向

                  >>or1>>

                  <or
                  <0 从文件里出来

                  <<or<<0

                  { }生成序列

                  echo
                  {1..10}

                  echo {a..z} 跟seq不一样

                  {a,b}/txt

                  时间: 2024-08-29 16:38:14

                  第四章第五章 环境搭建和24个命令总结的相关文章

                  Mysql集群讲解(四) 一主多从环境搭建

                  Mysql集群讲解(四) 一主多从环境搭建: A:环境配置(#号后内容记得删除) 配置主从MySQL配置文件my.cnf 主(3307)里面加入 log-bin=mysql-bin     #表示启用二进制日志 server-id=3307        #表示server编号,编号要唯一 从(3308)里面加入 server-id=3308        #表示server编号,编号要唯一 从(3309)里面加入 server-id=3309        #表示server编号,编号要唯一

                  CSS3秘笈复习:十三章&amp;十四章&amp;十五章&amp;十六章&amp;十七章

                  第十三章 1.在使用浮动时,源代码的顺序非常重要.浮动元素的HTML必须处在要包围它的元素的HTML之前. 2.清楚浮动: (1).在外围div的底部添加一个清除元素:clear属性可以防止元素包围浮动元素.关键字:left.right或both. (2).浮动外围元素:让包含浮动元素的<div>也浮动.选择这种方法一定要在浮动容器后面的任何元素中添加一个clear属性,确保浮动元素落到容器的下方. (3).利用overflow : hidden.另一种常见的方法是在外围的样式中添加以下属性:

                  构建之法第四、第五章读后感

                  第四第五章着重讲了合作的重要性,从两人合作到团队合作,编程开发都不是一件容易的事情,要注意许多要点. 代码书写的规范. 你写的代码不仅仅是给机器看的,给你看的,也是给其他人看的,是给合作的队友看的,在写的过程中要注意规范,要注意缩进.行宽.对齐等格式. 代码设计的规范. 函数中,你就只实现函数的具体功能,如构造函数,简单初始化所有数据成员即可. 代码复审. 找出代码的编辑错误.逻辑错误.算法错误跟潜在错误. 合作需要讲究技巧,要运用合理的方式影响合作的对方,尽量运用逻辑加感情,使对方能快速地接受

                  提供跟老男孩学Linux运维Shell编程实战的第四、第五章源代码

                  第四章是讲Shell变量知识进阶与实践: 第五章是讲变量的数值计算实践: 附件中包括源码,请下载. 该两章在学习时要注意相关事项: 1.注意标点符号的使用:例如,单引号,反引号,双引号等: 2.注意该要留空格的留空格: 3.注意特殊变量的作用: 4.内置变量的使用: 5.算术运算任的使用.

                  Storm 系列(四)—— Storm 集群环境搭建

                  一.集群规划 这里搭建一个 3 节点的 Storm 集群:三台主机上均部署 Supervisor 和 LogViewer 服务.同时为了保证高可用,除了在 hadoop001 上部署主 Nimbus 服务外,还在 hadoop002 上部署备用的 Nimbus 服务.Nimbus 服务由 Zookeeper 集群进行协调管理,如果主 Nimbus 不可用,则备用 Nimbus 会成为新的主 Nimbus. 二.前置条件 Storm 运行依赖于 Java 7+ 和 Python 2.6.6 +,所

                  html (第四本书第五章参考)

                  上机1 <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>百度音乐标签页面</title> <link href="css/上机练习1.css" rel="stylesheet" type="text/css"/> </head&

                  软件构造 第四章第五章 复习重点

                  (一)LSP 子类型多态:客户端可以用统一的方法处理不同类型的对象 子类:更强的不变量,更弱的前置条件,更强的后置条件 1)子类可以增加方法.但不可删 2)子类型需要实现抽象类型中的所有未实现方法 3)子类型中重写的方法必须有相同或子类型的返回值 4)子类型中重写的方法必须使用同样类型的参数 5)子类型中重写的方法不能抛弃新的异常 LSP:前置条件不能强化.后置条件不能弱化.不变量要保持.子类型方法要保持.子类型方法参数:逆变:子类型返回值:协变:异常类型:协变. (二)协变.反协变 协变:父类

                  Java编程思想第四版 *第五章 个人练习

                  练习3:(1)创建一个带默认构造器(即无參构造器)的类.在构造器中打印一条消息.为这个类创建一个对象.P116 public class Test{ public Test(){ System.out.println("Hello Word"); } public static void main(String[] args) { new Test(); } /** * 执行结果 Hello Word */ } 练习4:(1)为前一个练习中的类加入一个重载构造器,令其接受一个字符參数.

                  spring实战第四版第五章pom.xml

                  <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion&