LINUX samba commands

Source: Internet
Author: User
Tags egrep
For details about the LINUX samba command-Linux Enterprise Application-Linux server application, see the following. Today, I asked my predecessors about LINUX commands. If I want to exclusively occupy the file on the server and find that some users are using the command, I can run the following command:

Smbstatus | grep DEF_M

Shown below

[Albert @ koidemrp ~] $ Smbstatus | grep DEF_M

PID NAME
9844/mnt/home/novellx/KOIDE/MRP/DEF_M.CDX Mon Feb 18 09:45:45 2008
9828/mnt/home/novellx/KOIDE/MRP/DEF_M.CDX Mon Feb 18 09:41:08 2008
9799/mnt/home/novellx/KOIDE/MRP/DEF_M.CDX Mon Feb 18 09:39:57 2008
9844/mnt/home/novellx/KOIDE/MRP/DEF_M.DBF Mon Feb 18 09:45:45 2008
9828/mnt/home/novellx/KOIDE/MRP/DEF_M.DBF Mon Feb 18 09:41:08 2008
9799/mnt/home/novellx/KOIDE/MRP/DEF_M.DBF Mon Feb 18 09:39:57 2008

Input according to PID:

SMB status | grep 9844

[Albert @ koidemrp ~] $ Smbstatus | grep 9844
Novelx 9844 mrp03 Mon Feb 18 07:48:07 2008
Program 9844 mrp03 Mon Feb 18 07:48:06 2008
Exe 9844 mrp03 Mon Feb 18 07:48:08 2008

You will know the files used by mrp03 computers.

Note:

Linux Command excerpt. For future query.

Grep
1. Role
The grep command can specify the file to search for specific content and output the row standard output containing the content. Grep stands for Global Regular Expression Print, which indicates the Global Regular Expression version. Its permission is granted to all users.

2. Format
Grep [options]

3. Main Parameters
[Options] main parameters:
-C: only counts matching rows are output.
-I: case-insensitive (only applicable to single characters ).
-H: When querying multiple files, the file name is not displayed.
-L: When querying multiple files, only names containing matching characters are output.
-N: displays matching rows and row numbers.
-S: the error message that does not exist or does not match the text is not displayed.
-V: displays all rows that do not contain matched text.

Main Parameters of the regular expression pattern:
\: Ignore the original meaning of special characters in regular expressions.
^: Match the start line of the regular expression.
$: Matches the end row of the regular expression.
<: Starts from the row that matches the regular expression.
>: Ends with the row matching the regular expression.
[]: A single character. For example, [A] indicates that A meets the requirements.
[-]: The range, such as [AZ], that is, A, B, C, and Z all comply with the requirements.
. : All single characters.
*: It can contain 0 characters.

Regular Expressions are very important concepts in Linux/Unix systems. A regular expression (also known as "regex" or "regexp") is a Pattern that describes a type of strings ). If a string can be described using a regular expression, we can say that this character matches the regular expression ). In DOS, the wildcard "*" can be used to represent any character. In Linux, regular expressions are usually used to find the text mode and perform the "search-Replace" operation and other functions on the text.

4. Application Instance
Querying DNS is one of the daily tasks. This means that you need to maintain a large number of IP addresses covering different networks. Sometimes the number of IP addresses exceeds 2000. If you want to view the nnn. nnn network address, but forget the rest of the second part, you only know that there are two periods, such as nnn nn... To extract all the nnn. nnn IP addresses, use [0-9] {3}. [0-0. It means that any number appears three times, followed by a sentence, followed by any number three times, followed by a sentence.

$ Grep '[0-9] {3}. [0-0 'ipfile

In addition, the grep family also includes fgrep and egrep. Fgrep is a fix grep that allows you to search for strings rather than a pattern. egrep is an extended grep that supports basic and extended regular expressions, however, it does not support the application of the q mode range and some more standardized models.
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.