Linux Common Commands 2

Source: Internet
Author: User

Before reading this article, you can first read this article, the Linux Novice very useful 20 commands, this article is written in the previous article did not have, are I used at present.

This article is only convenient for my own system to see the Linux related commands , for each command is not very detailed introduction, if you want to see more detailed, can Baidu.

I will continue to add Linux commands on a rolling.

1.rm Command

RM is the removal (remove) file meaning.

If you are removing a file, simply rm-f the filename

If you are removing a directory, you need to rm-rf the directory name


-R is recursive down, no matter how many levels of directory, delete
-F is directly forcibly deleted, without any hint of meaning



2.source command

Usage: source file name

is to read and execute the commands in the file

Note: This command can also be used with the "." To replace

So you see source. BASHRC and. . BASHRC is an effect of



3.LN command

Usage is ln-s source file destination file

LN is to create a synchronized link for a file in another location, the most commonly used parameter is-s, to create a soft link (symbolic symbolic)

When we need to use the same file in different directories, we do not need to put a file in every required directory, we just put it in a fixed directory, and then use the LN command to link it in other directories without having to use disk space repeatedly.

As an example, we link the workspace/test to the file

Ln-s/home/lgx/workspace/tset/home/lgx/file

So under the/home/lgx/file, you'll see



4.grep command


Usage: grep [options] ... PATTERN [FILE] ...

The grep command in a Linux system 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.

Use this command to search for the corresponding files in the Android source code

Note: It is best to enter the directory you want to search, if you want to search a lot of files, will wait a while

such as GREP-RNSW "extends Packagemanager" *

-R Loop Recursion

-N Prints the line number at the same time

-S does not display error messages

-W mandatory PATTERN only matches words exactly

"The pattern is inside."

x all files under this directory

I was searching for some results under the Android source code:




5.unrar command


Note: The Unrar command default system is not available, you must add the Unrar program, with the sudo apt-get install Unrar method installed Unrar program.

For unrar files, we see still a lot of, but Linux does not have its own program to process RAR compressed files, so it is important to master this method.
Usage:   unrar  e  file name.  rar Extract the full file path to the current directory

Note: The Unrar command is special, the parameter cannot be added before-


6.cat command

Usage: cat [options] [file] ...

Cat is a shorthand for concatenate (link, make chain)

The purpose of the cat command is to connect files or standard input and print. This command is commonly used to display the contents of a file, or to connect several files to display, or to read from a standard input and display it, often in conjunction with redirection symbols.


-B,--number-nonblank number of non-null output lines
-N,--number all line numbers for the output, numbering the number of rows for all outputs starting from 1


Here's an example:

: ~/file$ cat-b Test 1 This was content of test 2 This is content of test: ~/file$ cat-n Test 1 This is content of the test 2 3 4 This is content of test 5: ~/file$ cat Test this Is content of test the is content of test


Cat >>file is continuing to add content in file files Cat >file re-edit the file contents

Linux Common Commands 2

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.