V. Linux/unix operation Command Accumulation "CP, MV, CAT, grep, PS"

Source: Internet
Author: User
Tags cpu usage

under the use of Linux/unix, often use the text interface to set up the system or operating system, the author himself in the process of work is also constantly in touch with this command, so for This special brewing, preparation, began the writing of this article. This paper mainly records some of their usual linux/unix under the operation of commands, record and collation, one can deepen the image, two can record sharing. I hope you crossing, for inappropriate or ambiguous places, give the specified and explain, in order to learn and improve together.
"Reproduced use, please specify the source: http://blog.csdn.net/mahoking "

017Linux CP Command


1 command format
CP [Options] [file or directory] format CP [option] [File or dir]
2 command functions
The CP instruction is used to copy a file or directory, such as specifying more than two files or directories at the same time, and the final destination is an existing directory, it will copy all the previously specified files or directories into this directory.
3 Common examples
Example 01

Command: CP fileName DirName
Input: [[email protected] root]# cp file.txt./filedir
Note: Copy the file.txt file under this directory to the Filedir directory in the current directory.
Example 02
Command: CP fileName1 fileName2 DirName
Input: [[email protected] root]# CP file1.txt file2.txt./filedir
Description: Copy the file1.txt, file2.txt two files in this directory to the Filedir directory in the current directory.
Example 03
Command: CP fileNames DirName
Input: [[email protected] root]# CP *.txt./filedir
Note: Copy all the. txt files in this directory to the Filedir directory in the current directory.


018Linux MV Command


1 command format
MV [Options] [file or directory] format MV [option] [File or dir]
2 command functions
The MV instruction is used to move files or rename files (rename), which is commonly used in Linux systems to back up files or directories.
3 Common examples
Example 01

Command: MV FileName newfilename
Input: [[email protected] root]# mv File.txt File.log
Description: Change the file.txt file in this directory to a more renamed File.log file.
Example 02
Command: MV FileName dirName
Input: [[email protected] root]# mv File.log./filedir
Note: Move the File.log file under this directory to the Filedir directory in the current directory.

019Linux Cat Command


1 command format
Cat [Options] [file or directory] format cat[option] [file or dir]
2 command functions
Cat Instructions
(1) Display the entire file at once. $ cat FileName
(2) Create a file from the keyboard. $ cat > FileName can only create new files and cannot edit existing files.
(3) Merging several files into one file: $cat file1 file2 > file
3 Common examples
Example 01

Command: Cat FileName
Input: [[email protected] root]# cat file.txt
Description: Displays the contents of the File.txt file in this directory.
Example 02
Command: Cat fileName1 fileName2 > FileName3
Input: [[email protected] root]# cat file.log file.txt file.all.txt
Note: Merge the File.log and file.txt files in this directory into the File.all.txt file.

020Linux grep command


1 command format
grep[option] format grep [option]
2 command functions
The grep command is a powerful text search tool that uses regular expressions to search for text and print matching lines. The grep full name is global Regular expression Print, which represents the globally regular expression version, and its use rights are for all users.

3 Common examples
Example 01

Command: grep string fileName
Input: [[email protected] root]# grep ' test ' file.log
Description
Displays the line that contains the test text information in the File.log file.
Example 02
Command: grep-n string fileName
Input: [[email protected] root]# grep-n ' test ' file.log
Description
Displays the line that contains the test text information in the File.log file.
-N Displays the line number in the article where the search text information is located.

021Linux PS Command


1 command format
ps [option] format PS [option]
2 command functions
The PS command is one of the most basic commands for viewing processes running on a system. It provides details of the current process, such as user id,cpu usage, memory usage, command name, etc., which do not display real-time data, such as top or htop commands. However, even though the functionality and output are simple, it is still a required process management/monitoring tool.

3 Common examples
Example 01

Command: PS-EF
Input:
[Email protected] root]# Ps-ef
Description
Lists all the processes.
-E Show All processes
-F Full Format display

"Reproduced use, please specify the source: http://blog.csdn.net/mahoking "

V. Linux/unix operation Command Accumulation "CP, MV, CAT, grep, PS"

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.