[Programmer technical skills] familiar with Unix/Linux Shell and common command line (I) file system structure and basic operations,

Source: Internet
Author: User

[Programmer technical skills] familiar with Unix/Linux Shell and common command line (I) file system structure and basic operations,

As a programmer, it is essential to be familiar with some unix/linux Command lines, because the servers used to deploy services are basically unix/linux systems, and services are rarely deployed on windows. Today, we will introduce some file system structures and basic operation commands on linux.

Command:Ls/chmod/chown/rm/find/ln/cat/mount/mkdir/tar/gzip

Okay. Let's get started.

1. ls command

Ls = list: lists information about a specified directory or file based on different options. It is one of the most common commands in Unix/Linux, cd to a directory and then run the first command.

Ls Command Format: ls [OPTION]... [FILE]...

List file information (the default is the current directory ).

LsNo parameter: displays the files and directories in the current directory (excluding hidden files ). Ls-

-Option a is the same as ls, But it lists all the files in the current directory or specified directory, including the files starting with dot (.),. directory, and. directory.

Ls-

-Option A is the same as ls, but lists all files in the current directory or specified directory, including files starting with dot (.), but not the. Directory and. directory.

Ls-l

The-l option ls command lists the details of files or subdirectories in the current directory or specified directory.

The ls-l information contains seven tabs:

  • First field: the first character specifies the file type
    • -: Common File;
    • D: directory file;
    • L: Symbolic Link;
    • S: socket file;
    • B: Block devices;
    • C: character device;
    • P: MPS queue file.

    The following nine characters indicate the object access permissions. Each three characters indicate the permissions of a class of users, including the file owner, users in the same group, and other users. The permissions are divided into read (r), write (w), execute (x ).

  • Second domain: number of links. The normal file must be at least 1, and the directory must be at least 2 (... and ..);
  • Third domain: file owner;
  • Domain 4: User Group;
  • Field 5: file size. The directory size is usually an integer multiple of the block size;
  • Sixth domain: the last modification date and time of the file. Modifying the file means adding and modifying the files or subdirectories in the file;
  • Domain 7: File Name
Ls-t

List objects based on the file modification time. The last modification is before.

Ls-1

List objects in a single row.

Ls-lat combination options, that is, each option can be used in combination, except for mutually exclusive options, such as-a and-, the preceding combination is ls-l, ls-a, and ls-t.

Combination options.-h indicates that the file size is represented in human nature, and the file size will be viewed in K, M, and G units.

Fuzzy list: where * represents any character (including 0 ),? Represents a character. Ls/etc/a * e

List the directories and files starting with a and ending with e in the/etc/directory.

Ls/bin/l?

List the directories and files starting with the letter l under the/bin/directory, and the directory name or file name length is 2.

2. Chmod

Change the permissions of a file or directory.

Note: In the UNIX system family, file or directory permissions are controlled to read, write, and execute three general permissions. This command can be used in two ways. One is the text setting method that contains letters and operator expressions, and the other is the number setting method that contains numbers.

Example: Add read/write permissions to a user:

Chmod u + rw test.txt or chmod 644 test.txt (assuming the default group and other permissions are read permissions)

 

Due to space issues, we will first introduce the introduction of ls and chmod...

 

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.