Chapter Bash and basic commands 2nd day July 8

  • Bash and the interactive interface to the kernel interface.
    • Linux command taken to adjust to the vertical direction performed by the keys;
    • Command or parameter before it can enter only a few use the Tab key completion
    • It has a powerful batch script;
    • Practical environment variable function.
  • Utility Command general format "command name" "command parameters" "Command object"
  • Man used to query the use of all commands
    •    

  • Common work order system
    • echo echo string or variable ($ SHELL)
    • The time or date date display command and set the system in the format of "date [option] [+ format specified format designated]"
    • reboot reboot
    • poweroff shutdown
    • wget command to download a file in a network terminal, the format of "wget ​​[parameters] Download."
    • ps (process snapshot) to view process status: There are a lot of parameter values, and is used to link the pipe symbol values ​​of the parameters to pass to.
    • Five types of processes
      •    

      •    

      •    

    • top command is used to dynamically monitor the process alive and system load
      •    

    • PID value format pidof command queries a specified service process is "pidof [parameters] [service name]"
    • Service process kill command terminates a specified PID, the format is "kill [parameters] [process PID]"
    • Service killall command is used to terminate a specified name corresponding to the entire process, the format is: "killall [parameters] [Service Name Service Name]."
  • System state detection command
    • I fconfig (config Network interface) card command for acquiring network configuration and status information, the format of the ifconfig [Network Device] [parameter] "
    • uname command is used to view the system kernel and version information in the format of "uname [-a]"
    • uptime for viewing system load information in the format of uptime.
    • f ree(amount of free and used memory in the system)用于显示当前系统中内存的使量信息,格式为" free [-h]"。
    • who(show who is logged on)用于查看当前登入主机的户终端信息,格式为" who [参数 ]"man
    • last(show listing of last logged in users)命令用于查看所有系统的登录记,格式为" last [参数 ]"。
    • history命令用于显示历史执行过的,格式为" history [-c]。如果使用 -c参数则会清空所有的命令历史记录。
    • sosreport命令用于收集系统配置及架构信息并输出诊断文档,格式为 sosreport。
  • 工作目录切换命令
    • pwd命令用于显示户当前所处的工作目录,格式为" pwd [选项 ]"
    • cd命令用于切换工作路径,格式为" cd [目录名称 目录名称 ]"
    • ls命令用于显示目录中的文件信息,格式为" ls [选项 ] [文件 ] "
      • 常用 ls -al
  • 文本编辑命令
    • cat命令用于查看纯文本件(内容较少的),格式为" cat [选项 ] [文件 ]" -n可以显示行号
    • more命令用于查看纯文本件(内容较多的)格式为" more [选项 ]文件"。
    • head命令用于查看纯文本档的前N行,格式为" head [选项 ] [文件 ]"
    • tail命令用于查看纯文本档的后N行或持续刷新内容,格式为" tail [选项 ] [文件 ]"。
    • tr(translate or delete characters)命令用于替换文本件中的字符, 格式为 tr [原始字符 ] [目标字符]
    • wc(count word)命令用于统计指定文本的行数、字节,格式为" wc [参数 ] 文本"。
    • stat(display file or file system status)命令用于查看文件的具体存储信息和时间等,格式为" stat 文件名称"。
    • cut命令用于按" 列"提取文本字符,格式为cut [参数 ] 文本"cut -f2 -d: /etc/passwd 取出第二列分隔符为:的列
    • diff命令用于比较多个文本件的差异,格式为" diff [参数 ] 文件"。
      • 使用 diff --brief命令显示比较后的结果,判断文件是否相同
      • 使用带有 -c参数的 diff命令来描述文件内容具体的不同文件目录管理命令
  • 文件目录管理命令
    • touch:change file timestamps 用来创建空白文件
    • mkdir make directory:创建目录
    • cp: copy 文件。命令用于复制文件或目录,格式为" cp [选项 ] 源文件 源文件 目标文件"。
    • mv move:剪切文件或重命名。
      • 会删除源文件,对同一个目录的同一个文件剪切就是重命名。
    • rm remove :删除原文件。
      • 非正常用法 rm -rf 递归强制删除一个文件夹
    • dd :命令用于按照指定大小和个数的据块来复制文件或转换,格式为" dd [参数 ]"
      • /dev/zero可以提供无尽的空间但不占用任何数据。
        • dd if=/dev/zero of=560 _file count=1 bs=560M
    • file : 用于查看文件类型。
  • 打包压缩和搜索命令
    • Tar 命令用于对文件进行打包压缩或解,格式为" tar [选项 ] [文件 ]"
      • tar -czvf etc.tar.gz /etc
      • 要点:-c和-x不能同时使用。
      • -f必须放最后。指定压缩文件名。
    • grep ( print lines matching a pattern)用于在文本内执行关键词搜索。

         

      • grep /sbin/nologin /
    • find命令用于按照指定条件来查找文,格式为" find [查找路径 ] 寻找条件 操作"。
      •    


      •  

Guess you like

Origin www.cnblogs.com/Black-cat0987/p/12046633.html