Linux Basic Instruction II

Source: Internet
Author: User

    1. RM (remove)

      Function: Delete files or directories

      Syntax: RM [-I R F] [file/directory]

      Rm-i: Ask the user whether to confirm the deletion, with Y or N to answer;

      Rm-r: Add this option when deleting a directory, delete files and directories under directories and directories;

      Rm-f: Forced Delete, no confirmation.

    2. MV (move)

Features: Moving files and directories, or renaming files (renaming)

Syntax: MV [-F i u] [source file or directory] [destination file or directory]

Mv-f: If the target file already exists, no direct overwrite is asked;

Mv-i: If the target file already exists, it will ask whether to overwrite;

Mv-u: If the target file already exists and the source file is newer, it will not be updated.

MV [source file or directory] [renamed file or directory]

Example: MV Test test2

3.mkdir (Make directory)

Function: Create an empty directory

Syntax: mkdir [-MP] [directory name]

MKDIR-M: Used to specify the permissions to create a directory, but rarely used, will be used chmod to handle;

Mkdir-p: Create multiple empty directories to recursively create directories.


4.rmdir (remove directory)

Function: Used to delete empty directory

Syntax: rmdir [-P] [directory name]

Rmdir-p: Represents a recursive delete directory. There are no files or directories in the directory. There are files that can only be deleted with Rm-f.


5.touch

Function: Create an empty file, and modify a file date to the current date.

Syntax: Touch [options] [filename]


6.find

Features: The Find command searches for files in the directory structure and can perform operations, and the Find function is powerful, so there are many options.

Syntax: Find [search scope] [match condition]

Example: $find/etc-name init: Find file init in directory/etc;

$find/etc-name init*:* match any character;

$find/etc-name Init??? :? Match the delay character;

$find/etc-iname * *: Search by file name, case-insensitive.

$find/-size +204800: Look for files larger than 100MB in the root directory.

(+n: greater than;-N: less than; N: equals)

$find/home-user Andyzhu: Locate the file with the owner Andyzhu under the root directory.

(-group based on the owning group)

$find etc-cmin-5: Find files and directories with properties modified within 5 minutes under/etc.

(-amin access time access;-cmin file properties change;-mmin file contents Modify)


7.which

Function: View the path where the command is located

Syntax: which [command]

Example: Which ifconfig


8.whereis

Function: Find out which directory a command is in, and display the directory where the system commands and help manuals are located.

Syntax: Whereis [-BMSU] file or directory name

-B: Find only files in binary format

-M: Just find the file under the description file manual path

-S: Find source files only

-U: Find other special files that are not among the above three options

Example: Whereis-m passwd


9.locate

Features: Quickly find files

Syntax: Locate [-I r] Keyword

-I: Ignore case differences

-R: Can be followed by the display of regular expressions

Example: Locate passwd


10.whatis

function: Get a short description of the index

Syntax: Whatis [command]

Example: Whatis ifconfig



This article is from "For Tomorrow" blog, please be sure to keep this source http://andyboge.blog.51cto.com/6809119/1747606

Linux Basic Instruction II

Related Article

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.