Linux Learning file Operations

Source: Internet
Author: User

Linux, Learning progress together ~

Mkdir

The mkdir command is used to create directories. It works like this:

The mkdir command is used to create a directory, so use:

mkdir directory ...

A Note on notation: When three periods follow an argument in the description of a command (as above), it means that the argument can repeated , thus:

Note notation: When you meet a command that has three dots behind it (as shown above), this means that the parameter can be repeated:

TMP mkdir Max? TMP Lsa.json Max Server.js? TMP mkdir max1 max2 max3? TMP Lsa.json max1 reade_file.jsclone_obj.js max2 server.jsgetIp.js max3

Cp

The CP command copies files or directories. It can be used different ways:

CP command, copy a file or directory, it has two ways to use it:

CP file1 File2

To copy the single file or directory "File1" to file or directory "File2" and:

Copy a single file or directory, and:

CP File ... directory

To copy multiple files (either files or directories) into a direcotory.

Copy multiple files or directories into a directory.

Mv

The MV command performs both file moving and file renaming, depending on what it is used. In Erther case,the original filename No. longer exists after the operation. MV is used in much the same as CP:

The MV command performs both file movement and file rename tasks, depending on how it is used. In either case, the original file will no longer exist under this operation. The MV command is used in the same way as CP:

MV File1 file2mv file1 file2 file3 Code

Rm

The RM command is a used to remove (delete) files and directories:

The RM command is used to delete files or directories:

RM file ...

ln

The ln command is used to create either hard or symbolic links. It is used in one of the ways:

The ln command is used to create a hard link, or you can create a symbolic link. You can use it in one of these ways:

ln file link

To create a hard link, and:

Create hard links, and:

LN-S Item Link

To create a aymbolic link ' item ' is erther a file or a directory.

Create a symbolic link, "item" can be a file or a directory.

Hard link

Hard links is the original Unix creating links, compared to symbolic links, which is more modern. By default, every file have a single hard link that gives the file its name. When we create a hard link, we create the additional directory entry for a file. Hard links has a important limitations:

Hard links are initially a way of linking to UNIX creation, and symbolic links are more modern than symbolic links. In the default way, each file has a hard link, which is the file alias. When we create a hard link, we also create an additional entry for the file. There are two important limitations to hard links:

    1. A hard link cannot reference a file outside its own file system. This means a link could not reference a file which is not on the same dis partition as the link itself.
    2. A hard link is not reference a directory.

    3. A hard link cannot be associated with a file other than the file system it resides in. This means that a link cannot be associated with a file that is not on the same disk partition as the link itself.

    4. A hard link cannot be associated with a directory.

Symbolic link

Symbolic links were created to overcome, the limitations of hard links. Symbolic links work by creating a special type of file, contains a text pointer to the referenced file or directory. In this regard, they operate in much the same as a Windows shortcut though of course, they predate the Windows feature by many years.

Symbolic links are created to overcome the limitations of hard links. Symbolic links work by creating a special file type that contains a text pointer to the associated file or directory. In this regard, they are similar to Windows shortcuts, and of course, symbolic links are older than Windows shortcuts for many years.

A file pointed to by a symbolic link, and the symbolic link itself is largely indistinguishable from one another. For example, if you write some something to symbolic link, the referenced file was also written to. However when you delete a symbolic link, only the link was deleted, not the file itself. If the file is deleted before the symbolic link, the link would continue to exist, but would point to nothing. The link is said to be broken. In many implementations, the LS command would display broken links in a distinguishing color, such as red, to reveal their Presence.

A symbolic link points to a file, and the symbolic link itself is almost indistinguishable from other symbolic links. For example, if you write something to a symbolic link, the associated file is also written. However, when you delete a symbolic link, only the link is deleted and does not affect the file itself. If the file is deleted before the symbolic link, the link will continue to exist, but will not point to anything. In this case, this link is called a bad link. In many implementations, the LS command displays these bad links in a distinguished color, such as red, to show their presence.

To learn more, please async my blog.

Linux Learning file Operations

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.