在Linux 系统中,一切皆设备
Linux系统中使用文件来描述各种硬件,设备资源等
例如:以前学过的硬盘和分区,光盘等设备文件
sda1   sr0
============================================

1、Linux中的重定向的作用
重定向的含义:
在实际的Linux维护中,可以改变输入输出内容的方向.
不使用默认的标准输入输出设备,即重定向.

当我们在调试或安装时,希望将一些不必要的信息不显示出来,
或者是需要将调试信息保存下来时,我们可以使用重点向
  >(覆盖输出),>>(追加输出),<(输入)  符号,
将需要的信息打印到对应的文件中
============================================

2、文件描述符 0、1、2
文件描述符是一个简单的整数,
用以标明每一个被进程所打开的文件
第一个打开的文件是0,第二个是1,以此类推

先查看LINUX默认的文件描述符:# ulimit -n
[root@xiaogan ~]# ulimit -n
1024
用户通过操作系统处理信息的过程中,使用的交互设备文件

在Linux系统中,在一个程序运行时,会打开很多文件,
其中默认打开前三个文件,
以此为标准输入文件、标准输出文件、标准错误文件
标准输入文件   STDIN    文件描述符为0    默认为键盘
标准输出文件  STDOUT 文件描述符为1    默认为显示器
标准错误文件  STDERR  文件描述符为2    默认为显示器

STDIN  标准输入  默认的设备是键盘  文件编号为:0 
命令将从标准输入文件中  读取  在执行过程中的 需要的  输入数据.
数据来源于文件

STDOUT 标准输出  默认的设备是 显示器  文件编号为:1
命令执行后的输出结果,发送到标准输出文件.
结果输出到文件

STDERR 标准错误  默认的设备是显示器  文件编号为:2
命令将执行期间的各种错误信息发送到标准错误文件.
错误信息发送到文件

标准输入,标准输出和标准错误默认使用键盘和显示器作为关联设备
与操作系统进行交互完成最基本的输入,输出操作.
============================================

3、输入输出重定向,管道使用的方式

输入输出重点向可使用重定向符号 >、>>、<符号来实现
> 以覆盖的方式将输出重定向到文件
>> 以追加的方式将输出重定向到文件
<输入重定向到文件
注:若重定向的输出的文件不存在,则会新建这个文件
当使用覆盖重定向时,文件中原本的内容将丢失

重定向输出就将结果输出到文件中

实验:
查看当前主机的CPU的类型保存到kernel.txt文件中(而不是直接显示到屏幕上)
uname -p 查看cpu类型信息
将内核 的版本信息追加到kernel.txt
uname -r  查看内核版本信息

  1. [root@xiaogan ~]# uname -p #查看CPU类型
  2. x86_64
  3. [root@xiaogan ~]# uname -p >kernel.txt #将cpu类型信息保存到kernel.txt文件中
  4. [root@xiaogan ~]# ls
  5. Desktop Documents Downloads kernel.txt Music Pictures Public Templates Videos
  6. [root@xiaogan ~]# cat kernel.txt #查看kernel.txt信息
  7. x86_64
  8. [root@xiaogan ~]# uname -r >>kernel.txt #将内核版本信息追加保存到kernel.txt文件中
  9. [root@xiaogan ~]# cat kernel.txt
  10. x86_64
  11. 3.10.-.el7.x86_64
  12. [root@xiaogan ~]# uname -r > kernel.txt
  13. [root@xiaogan ~]# cat kernel.txt
  14. 3.10.-.el7.x86_64
  15. [root@xiaogan ~]#

重定向输入

将命令中接收输入的途径由默认的键盘改为其他文件.
而不是等待从键盘输入
从文件读取数据

操作符: “<”

通过重定向输入可以
使一些交互式操作过程能够通过读取文件来完成

例如:使用passwd 设置密码时.每次都根据提示输入密码比较烦琐

改用重定向输入将可以忽略交互式的过程.而自动完成密码设置
(结合--stdin 选项来识别标准的输入)

通过文件中的内容作为输入的数据

实验:使用非交互式的去执行设置密码

  1. [root@xiaogan ~]# echo "" > passwd.txt #将密码输出到文件
  2. [root@xiaogan ~]# cat passwd.txt #查看密码文件
  3.  
  4. [root@xiaogan ~]# tail - /etc/passwd
  5. apache:x:::Apache:/usr/share/httpd:/sbin/nologin
  6. [root@xiaogan ~]# tail - /etc/passwd
  7. gan:x:::Gan:/home/gan:/bin/bash
  8. nginx:x::::/home/nginx:/sbin/nologin
  9. apache:x:::Apache:/usr/share/httpd:/sbin/nologin
  10. [root@xiaogan ~]# useradd xiaogan #新建用户
  11. [root@xiaogan ~]# passwd xiaogan --stdin <passwd.txt #使用无交互式执行设置密码
  12. Changing password for user xiaogan.
  13. passwd: all authentication tokens updated successfully.
  14. [root@xiaogan ~]#

执行成功!!!

错误重定向:
将命令执行过程中出现的错误信息 (选项或参数错误) 保存到指定的文件,而不是直接显示到显示器

错误信息保存到文件

操作符: 使用2>

2指的是错误文件的编号
 (在使用标准的输入和输出省略了1 0 编号)

在实际应用中.
错误重定向可以用来收集执行的错误信息.为排错提供依据;
对于shell脚本还可以将无关紧要的错误信息重定向到空文件/dev/null中
以保持脚本输出的简洁

使用”2>”操作符时,会想使用”>”一样覆盖目标文件的内容,
若追加而不覆盖文件的内容即可使用”2>>”操作符

例如: 使用tar命令进行备份的时候出新的错误信息保存到err.log文件中

  1. [root@xiaogan ~]# tar -cf asdf.tar /asdf
  2. tar: Removing leading `/' from member names
  3. tar: /asdf: Cannot stat: No such file or directory
  4. tar: Exiting with failure status due to previous errors
  5. [root@xiaogan ~]# tar -cf asdf.tar /asdf >err.log #将错误信息输出到err.log文件
  6. [root@xiaogan ~]# cat err.log
  7. tar: Removing leading `/' from member names
  8. tar: /asdf: Cannot stat: No such file or directory
  9. tar: Exiting with failure status due to previous errors
  10. [root@xiaogan ~]#

把/dev/null看作"黑洞".
它等价于一个只写文件. 所有写入它的内容都会永远丢失.
 而尝试从它那儿读取内容则什么也读不到.
 然而, /dev/null对命令行和脚本都非常的有用.
可使用
echo $?
命令,查看上一条命令的执行结果,0为执行成功

  1. [root@xiaogan ~]# tar -cf asdf.tar /asdf >/dev/null
  2. [root@xiaogan ~]# cat /dev/null
  3. [root@xiaogan ~]# tar -cf asdf.tar /asdf >/dev/null
  4. [root@xiaogan ~]# echo $?
  5.  
  6. [root@xiaogan ~]# cat /dev/null
  7. [root@xiaogan ~]# echo $?
  8.  
  9. [root@xiaogan ~]#

& 表示等同于的意思
正确的写到一个文件,错误的在写到一个文件
[root@xuegod63 ~]# ls /tmp/ /nginx  1> a.txt 2>b.txt
当我们希望将标准输出,与标准错误文件混合输出是可以使用如下命令:
[root@xiaogan ~]# ls /tmp /asdf 1>a.txt 2>&1

&> 混合输出
不分正确的还是错误的
[root@xiaogan ~]# ls /tmp /asdf &>a.txt

管道的作用:
前面的输出作为后面的输入
(可以将两条命令连接起来)

4、常用文件查找命令简介
             tee which whereis locate find grep
4.1 tee命令
详解
功能:读取标准输入的数据,并将其内容输出成文件。
语法:tee [-a][--help][--version][文件...]
tee指令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件。
参  数:
 -a或  --append  追加
    -i 无视中断信号
 --help  在线帮助。
 --version  显示版本信息

  1. [root@xiaogan ~]# who
  2. root : -- : (:)
  3. root pts/ -- : (:)
  4. [root@xiaogan ~]# who | tee who.txt
  5. root : -- : (:)
  6. root pts/ -- : (:)
  7. [root@xiaogan ~]# cat who.txt
  8. root : -- : (:)
  9. root pts/ -- : (:)
  10. [root@xiaogan ~]# who -uH | tee -a who.txt
  11. NAME LINE TIME IDLE PID COMMENT
  12. root : -- : ? (:)
  13. root pts/ -- : . (:)
  14. [root@xiaogan ~]# cat who.txt
  15. root : -- : (:)
  16. root pts/ -- : (:)
  17. NAME LINE TIME IDLE PID COMMENT
  18. root : -- : ? (:)
  19. root pts/ -- : . (:)
  20. [root@xiaogan ~]#

which命令  查找二进制可执行文件的绝对路径
whereis命令  查找本地二进制可执行文件、源码及帮助的路径

  1. [root@xiaogan ~]# whereis --help #whereis命令帮助信息
  2.  
  3. Usage:
  4. whereis [options] file
  5.  
  6. Options:
  7. -b search only for binaries
  8. -B <dirs> define binaries lookup path
  9. -m search only for manuals
  10. -M <dirs> define man lookup path
  11. -s search only for sources
  12. -S <dirs> define sources lookup path
  13. -f terminate <dirs> argument list
  14. -u search for unusual entries
  15. -l output effective lookup paths
  16.  
  17. =========================================================
  18. [root@xiaogan ~]# which --help #which命令帮助信息
  19. Usage: /usr/bin/which [options] [--] COMMAND [...]
  20. Write the full path of COMMAND(s) to standard output.
  21.  
  22. --version, -[vV] Print version and exit successfully.
  23. --help, Print this help and exit successfully.
  24. --skip-dot Skip directories in PATH that start with a dot.
  25. --skip-tilde Skip directories in PATH that start with a tilde.
  26. --show-dot Don't expand a dot to current directory in output.
  27. --show-tilde Output a tilde for HOME directory for non-root.
  28. --tty-only Stop processing options on the right if not on tty.
  29. --all, -a Print all matches in PATH, not just the first
  30. --read-alias, -i Read list of aliases from stdin.
  31. --skip-alias Ignore option --read-alias; don't read stdin.
  32. --read-functions Read shell functions from stdin.
  33. --skip-functions Ignore option --read-functions; don't read stdin.
  34.  
  35. Recommended use is to write the output of (alias; declare -f) to standard
  36. input, so that which can show aliases and shell functions. See which() for
  37. examples.
  38.  
  39. If the options --read-alias and/or --read-functions are specified then the
  40. output can be a full alias or function definition, optionally followed by
  41. the full path of each command used inside of those.
  42.  
  43. Report bugs to <which-bugs@gnu.org>.

locate #结合本地数据库,查找文件

  1. [root@xiaogan ~]# locate --help
  2. Usage: locate [OPTION]... [PATTERN]...
  3. Search for entries in a mlocate database.
  4.  
  5. -A, --all only print entries that match all patterns
  6. -b, --basename match only the base name of path names
  7. -c, --count only print number of found entries
  8. -d, --database DBPATH use DBPATH instead of default database (which is
  9. /var/lib/mlocate/mlocate.db)
  10. -e, --existing only print entries for currently existing files
  11. -L, --follow follow trailing symbolic links when checking file
  12. existence (default)
  13. -h, --help print this help
  14. -i, --ignore-case ignore case distinctions when matching patterns
  15. -l, --limit, -n LIMIT limit output (or counting) to LIMIT entries
  16. -m, --mmap ignored, for backward compatibility
  17. -P, --nofollow, -H don't follow trailing symbolic links when checking file
  18. existence
  19. -, --null separate entries with NUL on output
  20. -S, --statistics don't search for entries, print statistics about each
  21. used database
  22. -q, --quiet report no error messages about reading databases
  23. -r, --regexp REGEXP search for basic regexp REGEXP instead of patterns
  24. --regex patterns are extended regexps
  25. -s, --stdio ignored, for backward compatibility
  26. -V, --version print version information
  27. -w, --wholename match whole path name (default)
  28.  
  29. Report bugs to mitr@redhat.com.

在使用本地数据库查找新建文件时,是查找不到的,这是需要使用命令:
updatedb #更新数据库

grep #过滤信息
-v  反转 
-i  忽略大小写
^#以#开头
#$ 以#结尾
^$ 空行

  1. [root@xiaogan ~]# cat test.txt
  2.  
  3. aaaaaaaaaaaaaaaaa
  4. BBBBBBBBBBBBBBBBBBB
  5. AAAAAAAAAAAAAAAAAA
  6. bbbbbbbbbbbbbbbbbb
  7. [root@xiaogan ~]# cat test.txt |grep #查找文档中有2的行
  8.  
  9. [root@xiaogan ~]# cat test.txt | grep -v #过滤掉文档中的2那一行
  10.  
  11. aaaaaaaaaaaaaaaaa
  12. BBBBBBBBBBBBBBBBBBB
  13. AAAAAAAAAAAAAAAAAA
  14. bbbbbbbbbbbbbbbbbb
  15. [root@xiaogan ~]# cat test.txt | grep -i a #-i 忽略大小写
  16. aaaaaaaaaaaaaaaaa
  17. AAAAAAAAAAAAAAAAAA
  18. [root@xiaogan ~]# cat test.txt | grep ^a #以a开头的行
  19. aaaaaaaaaaaaaaaaa
  20. [root@xiaogan ~]# cat test.txt | grep ^B #以B开头的行
  21. BBBBBBBBBBBBBBBBBBB
  22. [root@xiaogan ~]# cat test.txt | grep B$ #以B结尾的行
  23. BBBBBBBBBBBBBBBBBBB
  24. [root@xiaogan ~]# cat test.txt | grep a$ #以a结尾的行
  25. aaaaaaaaaaaaaaaaa
  26. [root@xiaogan ~]# cat test.txt | grep ^$ #空行
  27.  
  28. [root@xiaogan ~]# cat test.txt | grep -v ^$ #过滤掉空行
  29.  
  30. aaaaaaaaaaaaaaaaa
  31. BBBBBBBBBBBBBBBBBBB
  32. AAAAAAAAAAAAAAAAAA
  33. bbbbbbbbbbbbbbbbbb
  34. [root@xiaogan ~]#
  1. [root@xiaogan ~]# grep --help
  2. Usage: grep [OPTION]... PATTERN [FILE]...
  3. Search for PATTERN in each FILE or standard input.
  4. PATTERN is, by default, a basic regular expression (BRE).
  5. Example: grep -i 'hello world' menu.h main.c
  6.  
  7. Regexp selection and interpretation:
  8. -E, --extended-regexp PATTERN is an extended regular expression (ERE)
  9. -F, --fixed-strings PATTERN is a set of newline-separated fixed strings
  10. -G, --basic-regexp PATTERN is a basic regular expression (BRE)
  11. -P, --perl-regexp PATTERN is a Perl regular expression
  12. -e, --regexp=PATTERN use PATTERN for matching
  13. -f, --file=FILE obtain PATTERN from FILE
  14. -i, --ignore-case ignore case distinctions
  15. -w, --word-regexp force PATTERN to match only whole words
  16. -x, --line-regexp force PATTERN to match only whole lines
  17. -z, --null-data a data line ends in byte, not newline
  18.  
  19. Miscellaneous:
  20. -s, --no-messages suppress error messages
  21. -v, --invert-match select non-matching lines
  22. -V, --version display version information and exit
  23. --help display this help text and exit
  24.  
  25. Output control:
  26. -m, --max-count=NUM stop after NUM matches
  27. -b, --byte-offset print the byte offset with output lines
  28. -n, --line-number print line number with output lines
  29. --line-buffered flush output on every line
  30. -H, --with-filename print the file name for each match
  31. -h, --no-filename suppress the file name prefix on output
  32. --label=LABEL use LABEL as the standard input file name prefix
  33. -o, --only-matching show only the part of a line matching PATTERN
  34. -q, --quiet, --silent suppress all normal output
  35. --binary-files=TYPE assume that binary files are TYPE;
  36. TYPE is 'binary', 'text', or 'without-match'
  37. -a, --text equivalent to --binary-files=text
  38. -I equivalent to --binary-files=without-match
  39. -d, --directories=ACTION how to handle directories;
  40. ACTION is 'read', 'recurse', or 'skip'
  41. -D, --devices=ACTION how to handle devices, FIFOs and sockets;
  42. ACTION is 'read' or 'skip'
  43. -r, --recursive like --directories=recurse
  44. -R, --dereference-recursive
  45. likewise, but follow all symlinks
  46. --include=FILE_PATTERN
  47. search only files that match FILE_PATTERN
  48. --exclude=FILE_PATTERN
  49. skip files and directories matching FILE_PATTERN
  50. --exclude-from=FILE skip files matching any file pattern from FILE
  51. --exclude-dir=PATTERN directories that match PATTERN will be skipped.
  52. -L, --files-without-match print only names of FILEs containing no match
  53. -l, --files-with-matches print only names of FILEs containing matches
  54. -c, --count print only a count of matching lines per FILE
  55. -T, --initial-tab make tabs line up (if needed)
  56. -Z, --null print byte after FILE name
  57.  
  58. Context control:
  59. -B, --before-context=NUM print NUM lines of leading context
  60. -A, --after-context=NUM print NUM lines of trailing context
  61. -C, --context=NUM print NUM lines of output context
  62. -NUM same as --context=NUM
  63. --group-separator=SEP use SEP as a group separator
  64. --no-group-separator use empty string as a group separator
  65. --color[=WHEN],
  66. --colour[=WHEN] use markers to highlight the matching strings;
  67. WHEN is 'always', 'never', or 'auto'
  68. -U, --binary do not strip CR characters at EOL (MSDOS/Windows)
  69. -u, --unix-byte-offsets report offsets as if CRs were not there
  70. (MSDOS/Windows)
  71.  
  72. 'egrep' means 'grep -E'. 'fgrep' means 'grep -F'.
  73. Direct invocation as either 'egrep' or 'fgrep' is deprecated.
  74. When FILE is -, read standard input. With no FILE, read . if a command-line
  75. -r is given, - otherwise. If fewer than two FILEs are given, assume -h.
  76. Exit status is if any line is selected, otherwise;
  77. if any error occurs and -q is not given, the exit status is .
  78.  
  79. Report bugs to: bug-grep@gnu.org
  80. GNU Grep home page: <http://www.gnu.org/software/grep/>
  81. General help using GNU software: <http://www.gnu.org/gethelp/>

find命令:通过硬盘查询文件名称

  1. [root@xiaogan ~]# man find
  2. [root@xiaogan ~]# ls
  3. append.txt a.txt Documents err.log Music Pictures Templates usr who.txt
  4. asdf.tar Desktop Downloads kernel.txt passwd.txt Public test.txt Videos
  5. [root@xiaogan ~]# ls /opt
  6. abcde.txt rh
  7. [root@xiaogan ~]# find / -name abcde.txt
  8. /opt/abcde.txt
  9. [root@xiaogan ~]# find asdf.tar
  10. asdf.tar
  11. [root@xiaogan ~]#
  12.  
  13. #help命令帮助信息
  14. [root@xiaogan ~]# find --help
  15. Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
  16.  
  17. default path is the current directory; default expression is -print
  18. expression may consist of: operators, options, tests, and actions:
  19.  
  20. operators (decreasing precedence; -and is implicit where no others are given):
  21. ( EXPR ) ! EXPR -not EXPR EXPR1 -a EXPR2 EXPR1 -and EXPR2
  22. EXPR1 -o EXPR2 EXPR1 -or EXPR2 EXPR1 , EXPR2
  23.  
  24. positional options (always true): -daystart -follow -regextype
  25.  
  26. normal options (always true, specified before other expressions):
  27. -depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf
  28. --version -xautofs -xdev -ignore_readdir_race -noignore_readdir_race
  29.  
  30. tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N
  31. -cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
  32. -ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN
  33. -links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
  34. -nouser -nogroup -path PATTERN -perm [-/]MODE -regex PATTERN
  35. -readable -writable -executable
  36. -wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N
  37. -used N -user NAME -xtype [bcdpfls]
  38. -context CONTEXT
  39.  
  40. actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print
  41. -fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit
  42. -exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;
  43. -execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ;
  44.  
  45. Report (and track progress on fixing) bugs via the findutils bug-reporting
  46. page at http://savannah.gnu.org/ or, if you have no web access, by sending
  47. email to <bug-findutils@gnu.org>.

1-11 RHLE7-重定向和文件查找的更多相关文章

  1. Linux输入输出重定向和文件查找值grep命令

    Linux输入输出重定向和文件查找值grep命令 一.文件描述符Linux 的shell命令,可以通过文件描述符来引用一些文件,通常使用到的文件描述符为0,1,2.Linux系统实际上有12个文件描述 ...

  2. <实训|第十一天>学习一下linux中的进程,文件查找,文件压缩与IO重定向

    [root@localhost~]#序言 在今后的工作中,运维工程师每天的例行事务就是使用free -m,top,uptime,df -h...每天都要检查一下服务器,看看是否出现异常.那么今天我们就 ...

  3. 分享一个文件查找、替换制定的字符或数字之CS程序、附带源码

    首先就上操作流程图: 图--登陆界面.登陆密码:alidoing.com 图--界面说明(一看就懂) 图--文件查找到再替换 图--文件替换成功 图--替换后的文件 代码开始: 登陆的代码就非常简单. ...

  4. Linux正则表达式、shell基础、文件查找及打包压缩

    Linux正则表达式.shell基础.文件查找及打包压缩 一.正则表达式 Linux正则表达式分为2类: 1.基本正则表达式(BRE) 2.扩展正则表达式(ERE) 两者的区别: 1.使用扩展正则表达 ...

  5. Linux操作系统的文件查找工具locate和find命令常用参数介绍

    Linux操作系统的文件查找工具locate和find命令常用参数介绍 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.非实时查找(数据库查找)locate工具  locate命 ...

  6. Linux文件查找工具之find “大宝剑”--转载

    原文地址:http://xinzong.blog.51cto.com/10018904/1749465 一.文件查找工具常用软件 locate: locate命令其实是find -name的另一种写法 ...

  7. find——文件查找命令 linux一些常用命令

    find 命令eg: 一般文件查找方法: 1.  find /home -name file  ,  在/home目录下查找文件名为file的文件2.  find /home -name '*file ...

  8. 【C语言】重定向和文件

    重定向和文件 一.相关基础知识 重定向:在计算机领域,重定向是大多数命令行解释器所具有的功能,包括各种可以将标准流重定向用户规定地点的Unix shells. 输入重定向:可以使程序能够使用文件代替键 ...

  9. (大数据工程师学习路径)第一步 Linux 基础入门----环境变量与文件查找

    环境变量与文件查找 本节介绍环境变量的作用与用法,及几种搜索文件的方法.学会这些技巧高效地使用 Linux. 一.环境变量 1.变量 要解释环境变量,得先明白变量是什么,准确的说应该是 Shell 变 ...

  10. linux下文件查找工具--find

    常用的文件查找命令有:which,locate,find 1.which命令 查找二进制数或二进制命令,由PATH给出 2.loacte 特点: 1.非实时,每天在系统上生成数据库,通过数据库查询 2 ...

随机推荐

  1. 【转】js获取当前日期时间“yyyy-MM-dd HH:MM:SS”

    获取当前的日期时间 格式“yyyy-MM-dd HH:MM:SS”   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 function getNowFormatD ...

  2. Java 对比Hashtable、Hashmap、Treemap有什么不同?

    ①基本理解 Hashtable.Hashmap.Treemap都是最常见的一些Map实现,是以键值对的形式存储和操作数据的容器类型. Hashtable是Java类库提供的一个哈希实现,本身是同步的, ...

  3. win 7 64 安装 MondgoDB 3.4

    https://jingyan.baidu.com/article/f3e34a12ac10cef5eb653583.html mongod --dbpath "D:\Program Fil ...

  4. 通过Java编码获取String分行字符串的内容

    代码案列: import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException ...

  5. iOS开发之plist文件操作

    之前在想用代码去实现很多界面上能用interface builder可以拖进去的功能,现在想想真是够无知的啊.不仅效率低下,而且对于代码的维护带来不少麻烦,这段时间一直在反思看了design+code ...

  6. java中数组以及集合

    java中数组: 数组在Java里是一种特殊类型,有别于普通的“类的实例”的对象.但实际数组也是一种对象类型,int[]a = new int[5]  a是在java栈中分配的引用变量,类型是int[ ...

  7. GRUB2 分析 (三)

    接上一篇 从地址0x8200开始的是lzma_decompress.img.这是由startup_raw.S编译生成的.这个文件稍微复杂点.首先一开始就是个跳转指令: ljmp $0, $ABS(LO ...

  8. Python面试题之Python中type和object的关系

    知乎上看到的提问: 两个是互为实例的关系,但不是互为子类的关系,只有type是object的子类,反之则不成立. 大牛说两者是蛋生鸡鸡生蛋的关系,但我还是不明白,有懂的麻烦解释一下, 希望不要给出外文 ...

  9. spring手动配置

    本文总结自:https://www.cnblogs.com/V1haoge/p/7183408.html SpringBoot中免除了大部分配置,但是对于一些特定的情况,还是需要我们进行手动配置的. ...

  10. ThinkPHP将上传问件添加到数据库

    <?php namespace Home\Controller; /***************** use Think\Controller; ****命名空间****/ class Mes ...