LINUX3 Basic Command Ls,pwd,cat,echo,mv,cp,mkdir,rm,ln

Source: Internet
Author: User

LS lists the file names.

-l lists the long file names.

-rwxr-xr--1 root root 10739 Dec 13:31 Bbscon

(7) (4) (5) (6) (3) (2) (1)

From left to right, it is divided into 7 columns with the following meanings:

(1) The file name, if it is a symbolic link, also displays the linked object after the file name.

(2) The time of the last modification of the document, if the changes made in the last one months, the month, day, hour, and minute are displayed, otherwise, the month, day and year are displayed.

(3) The length of the file (bytes), for the purpose of this special document login (hereafter referred to as the login file), the contents of which it contains files and subdirectories login on the storage medium location, and thus also has a length. The length of the login will vary with the number of documents and subdirectories login.

(4) In the case of a general document, it refers to the number of hard links, that is, how many login the document belongs to at the same time. For the login document, it is the number of sub-login directly contained in the login, plus 2 (essentially two special sub-login-the current target login ". and superior Login ".").

(5) indicates the owner (owner) of the file, and the owner generally has more permissions on the files it owns.

(6) Represents the group owner of the file, where the user who belongs to the group usually has more permissions than the other average user.

(7) Permission string for file

The permission string for the file, a total of 10 characters, is divided into 4 parts:

-Rwx r–x r--

A B C D

A represents the nature of the file, accounting for 1 characters, this character has a variety of options, commonly used are:

-General documentation.

D-Mesh Login file.

L Symbolic link file.

B Block type device file.

C-Character device files.

By identifying the first bit of the file permission string, we can tell whether a name represents a generic file, or a login file, a symbolic link, or other special type of file.

B~D determines the operation permissions of all users within the system on the file.

b represents the permissions that the file's owner has on the file.

C represents the permission for the file's group owner to operate on the file, which belongs to the group's entire user.

D indicates that all other users have permission to manipulate the file.

Permissions usually include R, W, x (read, write, execute) three kinds

LS followed by the path. Lists the files under the path.

Touch to create a file or modify the file information. Create a file named ABC, such as Touch ABC. Touch already has files. Changes the last modified time of an existing file to the current time. Touch-t time (MMDDHHMM) filename such as Touch-t 01021546 ABCD. Modify the modified time of the file for the time set.

Chown Change the owner. such as Chown testuser ABCD. Change the ABCD owner to TestUser

CHGRP Change the group owner. Usage Ibid.

chmod change the permission word.

chmod a+x ABCD. A means all. Add executable permissions to the ABCD file.

chmod a-x ABCD. Subtract executable permissions

Similarly user u+ group g+ other users o+

Octal add or subtract permissions.

Each permission corresponds to a eight import value:

-0
X1
W2
R4 < Eight import of the permission string > each bit of eight import, is the sum of the corresponding permissions:

---0 r--4
--x 1 R-x 5
-w-2 rw-6
-WX 3 rwx 7

such as: chmod 753 ABCD. The user right that represents ABCD is 7 (RWX), the group permission is 5 (r-x), and the other user's permissions are 3 (-WX)

PWD: View current directory

Cat: View the contents of a file

Echo: The string behind the screen output echo. echo ABCD >/root/x2 redirects the ABCD output to the/root/x2 file (meaning: Build/root/x2 file content for ABCD). > is the output redirection character.

MV: renaming or moving.

CP: Copy files.

mkdir: Build directory. Current directory such as: Mkdir-p A/B/C/D the subdirectory of the serial.

RM: Delete file rm-rf a recursive delete. F Force Delete R recursion is equivalent to Rm-r-f A. It is dangerous if it is deleted in the production environment and cannot be recovered.

A wildcard character is a batch operation of a file.

*: Any character any number of characters beginning with a * A;? : Any single character.?? 2 arbitrary characters; [] represents a single character within a range. [A-z] A-z any single character. Any one character between [A2BA] a2ba.

Ls-l a??? List A file with a total of 4 characters at the beginning of a

Rm-f a? Delete a 2-character file that begins with a

Rm-f??? * Delete 3 characters or more than 3 characters of the file.

ln links the file. ln a/test b/Link the test file under the A directory to the hard link

Ln-s Symbolic links. Equivalent to a shortcut. Can point to a directory or point to a file

Recursive operation options:

-R

Ls-r lists all directory files recursively.

LINUX3 Basic Command Ls,pwd,cat,echo,mv,cp,mkdir,rm,ln

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.