Linux Basic content

Source: Internet
Author: User

In Linux, there are three basic file types:

1) Common documents

Normal files are data streams in bytes, including text files, source files, executable files, and so on. There is no difference between text and binary for Linux, and the interpretation of ordinary files is done by the application that handles the file.

2) Catalogue

Directories can contain normal files and special files, and directories are equivalent to folders in Windows and Mac OS.

3) device files

Some of the tutorials called special files are a meaning. Linux and external devices (such as optical drives, printers, terminals, modern, etc.) are communicated through a file called a device file. The way the Linux input and output to an external device is the same as the input and output to a file. Before Linux communicates with an external device, the device must first have a device file present.

For example, each terminal has its own device files for Linux to write data (appearing on the terminal screen) and read data (the user enters through the keyboard).

by Ls-l The files listed, each line begins with a, d,-or L, which represent the file type:

prefix Description
- Normal file. such as text files, binary executables, source code, and so on.
B Block device files. The hard disk can use block device files.
C Character device files. The hard disk can also use character device files.
D Catalog files. Directories can contain files and other directories.
L Symbolic links (soft links). You can link any normal file, similar to a shortcut in Windows.
P Named pipes. Pipelines are a communication mechanism between processes.
S A socket for interprocess communication.

Metacharacters is a character that has a special meaning. and? are meta characters:

    • * can match 0 or more of any character;
    • ? Match one character

For example:

$ls Ch*.doc

You can display all files that begin with CH and end with. Doc.

Cat View Content Command View file contents $ cat filename;

WC Statistics Content command statistics file characters and other information $WC filename;

    • First column: Total number of rows in a file
    • Second column: number of words
    • Column three: The number of bytes in a file, that is, the size of the file
    • Fourth column: File name

cp Copy File command $CP source_file destination_file;

mv Rename file command $mv old_file new_file;

mkdir Create directory command: $mkdir dirname

Point number (.)

A point number (.) Represents the current directory, two point numbers (..) Represents an ancestor directory (parent directory).

Linux Basic content

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.