Common linux commands 2 and common linux commands

Source: Internet
Author: User

Common linux commands 2 and common linux commands

Before reading this article, you can first read this article, which provides 20 commands that are very useful to new Linux beginners. This article is written in what was not found in the previous article and is currently used by me.

This article only allows me to view linux-related commands in my own system. It is not very detailed about each command. If you want to see more details, you can use Baidu.

I will add linux commands.

1. rm command

Rm means to remove (remove) the file.

If a file is removed, only the rm-f file name is required.

To remove a directory, the rm-rf directory name is required.


-R is recursive down. No matter how many levels of directories are there, delete them together.
-F means to delete the file directly without any prompts.



2. source command

Usage: source file name

Is to read and execute commands in the file

Note: This command can also be replaced ".".

So you can see that source. bashrc and. bashrc are effective.



3. ln command

The usage is the target file of the ln-s source file.

Ln is to create a synchronization link (link) for a file in another location. The most common parameter is-s, which creates a soft link (symbolic)

When we need to use the same file in different directories, we do not need to put a file that must be the same under each required directory. We only need to put it in a fixed directory, put the file and use the ln command to link it to other directories without occupying disk space repeatedly.

In the following example, we link workspace/Test to the file.

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

In this way, under/home/lgx/file, you will see



4. grep command


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

In Linux, The grep command is a powerful text search tool that uses regular expressions to search for text and print Matching lines. Grep stands for Global Regular Expression Print, which indicates the Global Regular Expression version. Its permission is granted to all users.

This command is often used to search for the corresponding files in the android source code.

Note: It is best to enter the directory you want to search for. If you want to search for many files, you will wait for a while.

For example, grep-rnsw "extends PackageManager "*

-R: recursive

-N: print the row number at the same time as the output.

-S does not display error messages

-W: Force PATTERN to match only words completely

"" Contains PATTERN.

× All files in this directory

Some results of my searching for android source code:




5. unrar command


Note: The unrar command is not available by default. You must add the unrar program and use the sudo apt-get install unrar method to install the unrar program.

There are still many unrar files, but linux does not have a program for processing rar compressed files. Therefore, it is very important to master this method.
Usage: unrar e file name. rar decompress the file to the current directory in the full path.

Note: The unrar command is special.-Is not allowed before the parameter-


6. cat command

Usage: cat [Option] [file]...

Cat is short for concatenate

The cat command is used to connect files or standard input and print. This command is often used to display the file content, connect several files, or read and display the content from the standard input. It is often used with the redirection symbol.


-B, -- number-nonblank: number of non-empty output rows
-N, -- number indicates the number of all rows output, starting from 1.


Example:

 

:~/file$ cat -b test       1  this is  content of test            2  this is  content of test     :~/file$ cat -n test       1  this is  content of test        2         3         4  this is  content of test        5    :~/file$ cat test  this is  content of test       this is  content of test 


 
Cat> file: add content to the file. cat> file: edit the file content again.

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.