github.com/igoogolx/clash@v1.19.8/docs/configuration/getting-started.md (about) 1 --- 2 sidebarTitle: Getting Started 3 sidebarOrder: 2 4 --- 5 6 # Getting Started 7 8 It's recommended that you read the [Introduction](/configuration/introduction) before proceeding. After you have a brief understanding of how Clash works, you can start writing your own configuration. 9 10 ## Configuration Files 11 12 The main configuration file is called `config.yaml`. By default, Clash reads the configuration files at `$HOME/.config/clash`. If it doesn't exist, Clash will generate a minimal configuration file at that location. 13 14 If you want to place your configurations elsewhere (e.g. `/etc/clash`), you can use command-line option `-d` to specify a configuration directory: 15 16 ```shell 17 clash -d . # current directory 18 clash -d /etc/clash 19 ``` 20 21 Or, you can use option `-f` to specify a configuration file: 22 23 ```shell 24 clash -f ./config.yaml 25 clash -f /etc/clash/config.yaml 26 ``` 27 28 ## Special Syntaxes 29 30 There are some special syntaxes in Clash configuration files, of which you might want to be aware: 31 32 ### IPv6 Addresses 33 34 You should wrap IPv6 addresses in square brackets, for example: 35 36 ```txt 37 [aaaa::a8aa:ff:fe09:57d8] 38 ``` 39 40 ### DNS Wildcard Domain Matching 41 42 In some cases, you will need to match against wildcard domains. For example, when you're setting up [Clash DNS](/configuration/dns), you might want to match against all subdomains of `localdomain`. 43 44 Clash do offer support on matching different levels of wildcard domains in the DNS configuration, while the syntaxes defined below: 45 46 ::: tip 47 Any domain with these characters should be wrapped with single quotes (`'`). For example, `'*.google.com'`. 48 Static domain has a higher priority than wildcard domain (foo.example.com > *.example.com > .example.com). 49 ::: 50 51 Use an asterisk (`*`) to match against a single-level wildcard subdomain. 52 53 | Expression | Matches | Does Not Match | 54 | ---------- | ------- | -------------- | 55 | `*.google.com` | `www.google.com` | `google.com` | 56 | `*.bar.google.com` | `foo.bar.google.com` | `bar.google.com` | 57 | `*.*.google.com` | `thoughtful.sandbox.google.com` | `one.two.three.google.com` | 58 59 Use a dot sign (`.`) to match against multi-level wildcard subdomains. 60 61 | Expression | Matches | Does Not Match | 62 | ---------- | ------- | -------------- | 63 | `.google.com` | `www.google.com` | `google.com` | 64 | `.google.com` | `thoughtful.sandbox.google.com` | `google.com` | 65 | `.google.com` | `one.two.three.google.com` | `google.com` | 66 67 Use a plus sign (`+`) to match against multi-level wildcard subdomains. 68 69 `+` wildcard works like DOMAIN-SUFFIX, you can quickly match multi level at a time. 70 71 | Expression | Matches | 72 | ---------- | ------- | 73 | `+.google.com` | `google.com` | 74 | `+.google.com` | `www.google.com` | 75 | `+.google.com` | `thoughtful.sandbox.google.com` | 76 | `+.google.com` | `one.two.three.google.com` |