Environment Variables and File Finder & files are packaged and decompression

Environment variables and file search

Modify environment variables to set environment variables: introduction to learn these skills and use of environment variables and the role of several methods of searching for a file can be efficiently used Linux knowledge

Environment Variables

To explain the environment variables, you must first understand what variables are, it should be accurate to say that Shell variables, the so-called variable is the computer used to record a value (not necessarily a value, it can be a character or string) of symbols, and these symbols for different arithmetic processing, and the value of the variable is generally one to one relationship, it can be read by an expression and a value assigned to the other variables can be specified directly assigned to any variable value. For ease of calculation and processing, most of programming language distinguishes the type of the variable for each record number, characters or strings of data types and the like. Shell variables in basically the same, there are different types (but not specifically designated type name), can participate in operations, there is limited scope.

Simple to understand the concept of variables, it is easy to understand environment variables. Environment Variables scope than the custom variable to be large, such as Shell environment variables acting on its own and its children. In all UNIX and UNIX-like systems, each process has its own environment variable settings, and by default, when a process is created, in addition to the creation process explicitly specified, it will inherit its parent process must most of environment settings. Shell program also runs as a process on top of the operating system, and the way we run most commands in the Shell Shell will have the child process will run.

declare a variable command creates a variable named tmp

Use = number assignment operator, assignment variable tmp

Read the value of a variable, use the echo command and the $ symbol ($ symbol used to represent the reference value of a variable, beginners often forget to enter):

Note: Not all forms of variable names are available, the variable name can only be letters, numbers or underscores, and can not be used as a digital beginning.

We variable type usually involve three ways:

1, the current Shell process private user-defined variables, as described above tmp variable that we created, only valid in the current Shell.

2, Shell built-in variable itself.

3, derived from the custom variable environment variable.

set     显示当前 Shell 所有变量,包括其内建
        环境变量(与 Shell 外观等相关),
        用户自定义变量及导出的环境变量。
env     显示与当前用户相关的环境变量,
        还可以让命令在指定环境中运行。
export  显示从 Shell 中导出成环境变量的变量,
        也能通过它将自定义变量导出为环境变量。
注意:为了与普通变量区分,通常我们习惯将环境变量名设为大写。

$ temp=shiyanlou
$ export temp_env=shiyanlou
$ env|sort>env.txt
$ export|sort>export.txt
$ set|sort>set.txt

$ vimdiff env.txt export.txt set.txt  

Search for files

File packing and decompression

介绍 Linux 上常用的压缩/解压工具,主要讲解 zip,tar 的使用。 知识点zip 命令tar 命令压缩与解压常用组合

概念讲解

在讲 Linux 上的压缩工具之前,有必要先了解一下常见常用的压缩包文件格式。在 Windows 上最常见的不外乎这两种 .zip,.7z 后缀的压缩文件。而在 Linux 上面常见的格式除了以上两种外,还有 .rar,.gz,.xz,.bz2,.tar,.tar.gz,.tar.xz,*.tar.bz2,简单介绍如下:

文件后缀名   说明
*.zip   zip 程序打包压缩的文件
*.rar   rar 程序压缩的文件
*.7z    7zip 程序压缩的文件
*.tar   tar 程序打包,未压缩的文件
*.gz    gzip 程序(GNU zip)压缩的文件
*.xz    xz 程序压缩的文件
*.bz2   bzip2 程序压缩的文件
*.tar.gz    tar 打包,gzip 程序压缩的文件
*.tar.xz    tar 打包,xz 程序压缩的文件
*tar.bz2    tar 打包,bzip2 程序压缩的文件
*.tar.7z    tar 打包,7z 程序压缩的文件

Guess you like

Origin www.cnblogs.com/liugangjiayou/p/11986526.html