Linux learning -04-file and directory management-1

Source: Internet
Author: User

Absolute path: The path is written "must be from the root directory/write", for example:/usr/share/doc this directory.

Relative path: The path is written "not by/written", for example, by/usr/share/doc to the bottom of/usr/share/man: CD. /man

The absolute path is used: The correct degree is higher, and the absolute path is recommended when writing a program management system.

The use of relative road strength: It is convenient to switch long directories.


Operation Commands for Directories:

CD Change Directory switch directories

PWD Print working directory displays the current directory-p displays the actual path

mkdir make directory-m set directory permissions directly mkdir-m 711 Test2

Create a new directory-p recursively create a directory mkdir-p Test1/test2/test3/test4

RmDir Delete an empty directory-P together with the upper "empty" directory also deleted

Rmdir-p Test1/test2/test3/test4

-R Delete all contents of the directory Rm-r test

. Represents the current directory

.. Represents a previous level directory

-Represents a previous working directory

~ Represents the home directory where the "current user" resides

~account represents the user's home directory (account is a name)

The variable that executes the file path $path

See what directories are defined? Echo $PATH

LS Viewing files and directories

-A All files include hidden files

-l List Detailed properties Ls-l = ll

Ls-al list the properties of all files in the directory including hidden files


CP Copy Copy

CP Source File Destination file

-I if the target file exists asking whether to overwrite

-a The copied file is exactly the same as the source file properties =pdr

RM Remove to delete a file or directory

-F force forcibly removed without prompting

-R Delete all content in the directory

MV Move moves files or directories or renames

-F force forcibly moved without prompting

-U target exists and the source file is newer before it is updated

Get the file name Basename/etc/sysconfig/network

Get Directory name Dirname/etc/sysconfig/network

View Archive Contents

Cat starts with the first line

TAC starts with the last line

NL Show and lose travel number

More rows in a row display

Less row display, and can page forward

Head's just a few lines.

Tail only look at the tail a few lines

OD binary mode read data


Linux learning -04-file and directory management-1

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.