Linux Basic Operations 02 (11-15)

<11> Create link files: ln

Linux-linked files like shortcuts under Windows.

Link file is divided into soft links and hard links.

Soft links: soft links do not take up disk space, delete the source file is a soft link failure.

Hard links: hard link can only link a regular file, directory can not be linked.

Using the format:

  ln source file link file

  ln -s file link source file

If the option represents establish a hard link file, two files occupy the same space the size of the hard drive, even if you delete the source files, link files still exist, so the -s option is the more common form.没有-s

Note: If the soft link files and source files are not in the same directory as the source file using the absolute path, you can not use relative paths.

 

 

 About gedit

 

About hard links, soft links problem.

<12> to view or merge file contents: cat

 

 

<13> Text Search: grep

Linux systems grep command is a powerful text search tools, grep mode allows text files to find. If a matching pattern is found, grep prints all lines containing pattern.

grep general format is:

  grep [- options] 'content search string' filename

When the input string grep command parameters, it is preferred or double quotation marks. For example: grep 'a' 1.txt

Common options Description:

 

 grep searches can be a regular expression.

A regular expression is a logical formula of string operations, is to use certain pre-defined characters, and a combination consisting of a particular string ,, "rule string", this "rule string" used to express kind of string filter logic.

grep commonly used regular expressions:

 

 

 

 Practice.

<14> Find File: find

The find command is powerful, usually used to search for eligible files in a particular directory, it can also be used to search for specific user owner of the file.

Common methods:

 

 

<15> copies of documents: cp

Cp command function is to copy the given file or directory to another file or directory corresponding to the copy command in DOS.

Common options Description:

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/yase/p/11528329.html