Shell Common Command Summary

Source: Internet
Author: User
Tags touch command

Shell Common Command Summary

1 ls command: List files

Ls-la list all files and folders in the current directory

LS A * lists all files starting with the A letter in the current directory

Ls-l *.txt lists all files with the suffix txt in the current directory

2 CP command: Copy

CP a.txt b.txt: Copy the contents of file A to file B

CP a.txt./test: Copy file A to the text directory

CP-A test test2: Recursively copy all Files under directory test (including hidden files) to the new directory Test2

3 Cat command: View combined files

Cat a.txt: Viewing the contents of a file

Cat A.txt >> b.txt: Combine the contents of a file to the end of the content of file B

Cat-n a.txt: Viewing the file and marking the file with an uplink number

4 Touch Command: Create a file

Touch a.txt: Create a txt type file named a

5 RM command: Delete files

RM-RF a.txt: Forcibly deleting files a.txt

Tm-i a.txt: Before deleting a file, you will be prompted to confirm the deletion of the file

6 mkdir command: Create a directory

mkdir test: Create a directory named Test

7 rmdir command: Delete directory

Tmdir Test: Delete a directory

8 Echo, cat commands: adding content

echo "Hello world!" >> a.txt: Add content to file a inside

Cat <<EOF>> A.txt: You can add multiple lines of statements to the end of the contents of the file itself

Cat <<EOF> a.txt: Add content to a file and overwrite to the original content

9 MV Command: Move rename file

MV A.txt b.txt: File a renamed to B

MV A.txt./test: Move files to a directory

cd command: Change directory

CD ~: Switch to User directory

Cd.. : Return to the previous level directory

Cd.. /.. : Return to the top two-level directory

One-by-one grep command: Search for files

Ls-la | grep a.txt: Searching for a.txt files

The Find command: Finding files and directories

Find filename: Finds the file/directory under the current directory

RZ sz command: Upload and download files

The head command: Displays the first 10 lines of the file

Tail Command: Displays the last 10 lines of the file

Summarize:

Some time ago to learn the next shell commonly used file processing commands, these are just a small part of the shell command, Shell command has a very strong and fast processing power, to our usual learning and work tasks to provide a lot of convenience. Furthermore, for the above 15 commands alone, the function is much more than the one or two commands listed, so you can see the use of the command using LS--help (and so on).

Shell Common Command Summary

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.