markdown 有用的linux命令

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 有用的linux命令相关的知识,希望对你有一定的参考价值。

#### Use Grep to Find Files Based on Content

The `find` command is only able to filter the directory hierarchy based on a file’s name and meta data. If you need to search based on the content of the file, use a tool like grep. Consider the following example:

```sh
find . -type f -exec grep "example" '{}' \; -print
```

This searches every object in the current directory hierarchy (`.`) that is a file (`-type f`) and then runs the command `grep "example"` 
for every file that satisfies the conditions. The files that match are printed on the screen (`-print`). The curly braces (`{}`) are a 
placeholder for the `find` match results. The `{}` are enclosed in single quotes (`'`) to avoid handing `grep` a malformed file name. 
The `-exec` command is terminated with a semicolon (`;`), which should be escaped (`\;`) to avoid interpretation by the shell.

Before the implementation of the `-exec` option, this kind of command might have used the `xargs` command to generate a similar output:

```sh
find . -type f -print | xargs grep "example"
```

### Remove all files except extension
```sh
/bin/rm -f -- ^*.php
```


### Uninstall nodejs
```
sudo apt-get remove nodejs

sudo apt-get remove npm
```

Then go to `/etc/apt/sources.list.d` and remove any node list if you have. Then do a
```
sudo apt-get update
```

以上是关于markdown 有用的linux命令的主要内容,如果未能解决你的问题,请参考以下文章

markdown 用于处理请求的有用命令

markdown 用于处理请求的有用命令

markdown DOS有用的命令

markdown 用于搜索AMI的有用命令

markdown git有用的命令

markdown 有用的命令