shine10076的博客

热爱可抵岁月漫长


  • 首页

  • 关于

  • 标签

  • 分类

  • 归档

  • 搜索

Linux系统命令总结--查看文件内容

发表于 2019-09-19 | 分类于 操作系统基础

Linux系统命令总结–查看文件内容

查看文件类型

  1. file命令

    file命令file --help

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    Usage: file [OPTION...] [FILE...]
    Determine type of FILEs.

    --help display this help and exit
    -v, --version output version information and exit
    -m, --magic-file LIST use LIST as a colon-separated list of magic
    number files
    -z, --uncompress try to look inside compressed files
    -Z, --uncompress-noreport only print the contents of compressed files
    -b, --brief do not prepend filenames to output lines
    -c, --checking-printout print the parsed form of the magic file, use in
    conjunction with -m to debug a new magic file
    before installing it
    -e, --exclude TEST exclude TEST from the list of test to be
    performed for file. Valid tests are:
    apptype, ascii, cdf, compress, elf, encoding,
    soft, tar, text, tokens
    -f, --files-from FILE read the filenames to be examined from FILE
    -F, --separator STRING use string as separator instead of `:'
    -i, --mime output MIME type strings (--mime-type and
    --mime-encoding)
    --apple output the Apple CREATOR/TYPE
    --extension output a slash-separated list of extensions
    --mime-type output the MIME type
    --mime-encoding output the MIME encoding
    -k, --keep-going don't stop at the first match
    -l, --list list magic strength
    -L, --dereference follow symlinks (default if POSIXLY_CORRECT is set)
    -h, --no-dereference don't follow symlinks (default if POSIXLY_CORRECT is not set) (default)
    -n, --no-buffer do not buffer output
    -N, --no-pad do not pad output
    -0, --print0 terminate filenames with ASCII NUL
    -p, --preserve-date preserve access times on files
    -P, --parameter set file engine parameter limits
    indir 15 recursion limit for indirection
    name 30 use limit for name/use magic
    elf_notes 256 max ELF notes processed
    elf_phnum 128 max ELF prog sections processed
    elf_shnum 32768 max ELF sections processed
    -r, --raw don't translate unprintable chars to \ooo
    -s, --special-files treat special (block/char devices) files as
    ordinary ones
    -C, --compile compile file specified by -m
    -d, --debug print debugging messages

    file命令主要用来查看文件的类型。

    阅读全文 »

Linux硬链接和软链接

发表于 2019-08-30 | 分类于 操作系统基础

Linux连接概念

linux的链接分为两种,一种被称为硬链接(Hard Linx),另一种被称为符号链接(Symbolic Link)。默认情况下,ln命令产生硬链接。

什么是链接

链接简单说是一种文件共享的方式,是POSIX中的概念,主流文件系统都支持连接文件。

链接的作用

链接可以简单的理解为windows中常见的快捷方式,

Linux中常用它来解决一些库版本的问题,通常也会将一些目录层次较深的文件链接到一个更加容易访问的目录中。在这些用途上,我们通常会使用软链接(也成为符号链接)。

阅读全文 »

TCP可靠传输和拥塞控制

发表于 2019-08-19 | 分类于 网络基础

TCP可靠传输和拥塞控制机制

TCP可靠传输

数据流传输方式

TCP数据一般分为:交互数据和成块数据,交互数据一般比较小,比如发送一个字节的交互数据,加上TCP数据段首部以及IP数据包首部,至少需要41个字节。

交互数据流传输

互联网早期通信链路并不可靠,因此在链路层传输数据的时候要采取可靠的传输协议。其中最简单的为停止等待协议。传输层并不使用停止等待协议,但是传输交互数据流传输时采用nagle算法和该协议原理很类似。

  1. 停止等待协议

    每一次发送完一个分组就停止发送,等待对方确认。

    停止等待协议

    发送放发送数据分组A,接收方接收到A后,向发送方确认数据,发送方收到A确认后继续发送数据分组B。

    数组分组在传输过程中发生错误时有两种情况:

    1. 接收方收到错误数据直接丢弃
    2. 数据分组在传输过程中丢失

    这两种情况接收方都不会发送任何信息。发送方在一定时间内没有收到确认就会重传,这种叫超时重传。

    阅读全文 »

深入理解Java的多态机制

发表于 2019-07-13 | 分类于 面向对象基础

Java多态原理和使用

多态的概念

面向对象有三大特性,继承,封装,多态。

多态表示指在编程中不能确定引用对象指向的具体类型或是方法调用,而要在程序运行时才能确定。

该引用变量的方法调用到底是那个类实现的方法,必须在程序运行期间才能确定,这样不用修改程序源码就可以让引用变量动态的绑定到不同的类实现上从而导致该引用调用的方法随之改变。

不修改程序代码就可以改变程序运行时绑定的具体代码,程序可以选择多个运行状态,这就是面向对象语言的多态性。

多态主要分为编译时的多态和运行时的多态。

阅读全文 »

浏览器输入URL到获取网页的过程

发表于 2019-07-11 | 分类于 网络基础

浏览器输入URL到获取网页的过程

上面这张图大致描述了浏览器输入URL之后发生了什么。下面梳理一下详细的流程。

在条件是:

  • 一个Chrome浏览器
  • 一台Linux服务器
  • 发起HTML请求
  • 不考虑缓存和优化
  • 采用HTTP/1.1+TLS/1.2+TCP协议
阅读全文 »
123…6
Shine10076

Shine10076

28 日志
11 分类
24 标签
GitHub E-Mail
Links
  • 力扣
  • stack-overflow
  • GitHub
© 2020 Shine10076
|