Linux Learning Notes (ii) Linux commands

Source: Internet
Author: User

First, command-line syntax:

  command word [options] [parameters]

Note: Thecommands in Linux are case-sensitive.

Second, get command help:

1, help command: Help Xxx,shell internal instructions, used to obtain Linux internal commands. For example: Help and Help.

2, '--help ' option: XXX--help Gets the help information for the command. LS--help.

3, man command: Man xxx to display the Help manual in full-screen mode, press Q to exit. Man ls.

4. Info command: info xxx get help manual by Q exit in more detailed way. Info ls.

Third, file directory operation command:

  1, ls: Display the contents of the directory

Common options:

-L: Displaying files and directories in long format

-A: Displays information for all subdirectories and files

-D: Displays the properties of the directory itself

-r: Displays the specified directory and all subdirectories

Wildcard characters:

?: matches one of the characters in the file.

*: matches any number of characters in the file.

  2. CD: Change working directory

    relative path: The path relative to the current working directory.

A, A. Start: Current path

B, two: Start: Top level Directory

C, one ~ start: Host Directory

D, one/old naughty: root directory

    Absolute Path: The path that starts at the root of the system/home/xxx.

  3. PWD: Show current directory

  4. Du: Statistics Catalogue

-A: Statistics all files that are occupied by disk space.

-H: Statistical results are displayed in a personalized way, showing the file units

-S: Counts the total size of the controls that each parameter occupies.

  5. mkdir: Create a new directory

-P: Creating nested Multi-level catalogs

Mkdir-p AAA/BBB/CCC Create a 3-level directory at a time without the-p error.

  

Iv. File Operation commands

  1. Touch: Create a new file. If the file does not exist, create an empty file and, if the file exists, update the file creation time, you can create multiple files at once.

Example: Touch file1.txt file2.txt//Simultaneous creation of 2 files

  2. CP: Copy files or directories.

Options:

-F: Force replication.

-I: Alert the user to confirm.

-P: Keeps the property intact.

-r: Assigns all files and subdirectories.

Example: Cp-r mydir mydir_back

  3. RM: Delete files or directories.

Options:

-F: Force delete directly.

-I: Alert the user to confirm.

-r: Deletes all files in the entire directory and directory.

By default, RM does not delete the directory. Use the--recursive (-R or-r) option to delete each given directory, along with all of its contents.

  4, MV: Renaming or moving files or directories.

MV file1.txt file_first.txt: rename file1.txt to File_first.txt

MV File1.txt/home/file2.txt: Move file1.txt to/home/file2.txt

  5. Find: Locate the file or directory.

Syntax: Find [Find scope] [find conditional expression]

Search criteria:

-name: Find by name

-size: Find by size

-user: Search by file Owner

-type: Find by File type

  6. Which: Find the location of the command file.

Syntax: which command

Example: Which LS

  7. File: View the type of files.

Syntax: File path

Example: File/usr/bin/ls

  8. LN: Create a shortcut.

Syntax: LN [-S] source file or directory link file or destination directory

Shortcuts are mainly broken down into symbolic links and hard links.

Hard Links: You cannot create hard links to directories or create hard-linked files across partitions.

Symbolic link (soft link): You need ln to add the-s option.

For example: ln-s/home/zhengcheng/mydir/file1.txt/home/zhengcheng/Desktop//For file1.txt create soft links on desktop

  

  

Linux Common Command query:

20 commands for common Linux: http://www.oschina.net/translate/useful-linux-commands-for-newbies

Command query: http://www.jb51.net/linux/

Linux Learning Notes (ii) Linux commands

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.