github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/docs/cli/alias.md (about) 1 --- 2 layout: post 3 title: ALIAS 4 permalink: /docs/cli/alias 5 redirect_from: 6 - /cli/alias.md/ 7 - /docs/cli/alias.md/ 8 --- 9 10 # CLI Reference for Aliases 11 12 AIS CLI supports user-defined aliases, similar to the Unix `alias` command. Defining your own alias for an existing command can make the AIS CLI more intuitive and efficient to use. 13 14 > [Auto-complete](/docs/cli.md) options also hold for the alias you create! 15 16 ## Table of Contents 17 18 ## Create an Alias 19 20 `ais alias set ALIAS AIS_COMMAND` 21 22 Create an alias "`ALIAS`" for existing `AIS_COMMAND`. 23 24 Note: ALIAS must be a single word, or multiple words connected with - (hyphen) or _ (underscore). The arguments following ALIAS constitute the full `ais` command. 25 The `ais` command can be put inside quotes for readability. 26 27 For example, `ais alias set show-clu show cluster` and `ais alias set show-clu "show cluster"` create the same alias for `show cluster`. 28 29 ### Examples 30 31 ```console 32 $ ais alias sc "show cluster" 33 Aliased "show cluster"="sc" 34 35 $ ais sc 36 PROXY MEM USED % MEM AVAIL UPTIME 37 IWOup8082 0.25% 15.43GiB 24h 38 Kflkp8083 0.25% 15.43GiB 24h 39 xqfwp8081 0.25% 15.43GiB 24h 40 hJzRp8084 0.26% 15.43GiB 24h 41 WSLop8080[P] 0.29% 15.43GiB 24h 42 43 TARGET MEM USED % MEM AVAIL CAP USED % CAP AVAIL CPU USED % REBALANCE UPTIME 44 ejpCt8086 0.38% 15.43GiB 14.00% 1.951TiB 0.12% - 24h 45 CASGt8088 0.35% 15.43GiB 14.00% 1.951TiB 0.11% - 24h 46 xZntt8087 0.36% 15.43GiB 14.00% 1.951TiB 0.11% - 24h 47 Hwbmt8085 0.31% 15.43GiB 14.00% 1.951TiB 0.12% - 24h 48 DMwvt8089 0.37% 15.43GiB 14.00% 1.951TiB 0.11% - 24h 49 50 Summary: 51 Proxies: 5 (0 unelectable) 52 Targets: 5 53 Primary Proxy: WSLop8080 54 Smap Version: 43 55 Deployment: dev 56 57 $ ais sc CASGt8088 58 TARGET MEM USED % MEM AVAIL CAP USED % CAP AVAIL CPU USED % REBALANCE UPTIME DEPLOYMENT STATUS 59 CASGt8088 0.35% 15.43GiB 14.00% 1.951TiB 0.11% - 24h dev online 60 ``` 61 62 ## Remove Alias 63 64 `ais alias rm ALIAS` 65 66 Removes existing alias "`ALIAS`". 67 68 ### Examples 69 70 ```console 71 $ ais alias 72 ALIAS COMMAND 73 get object get 74 ls bucket ls 75 put object put 76 sc show cluster 77 78 $ ais alias rm sc 79 80 $ ais alias 81 ALIAS COMMAND 82 get object get 83 ls bucket ls 84 put object put 85 ``` 86 87 ## List Aliases 88 89 `ais alias show` or `ais alias` 90 91 List all created aliases. 92 `ais alias` with no arguments lists all previously added aliases -- the same behavior you expect from Unix shell `alias`. 93 94 Note that aliases are also shown in the app-level help message (`ais -h`). 95 96 ### Examples 97 98 #### List aliases 99 100 ```console 101 $ ais alias 102 ALIAS COMMAND 103 get object get 104 ls bucket ls 105 put object put 106 107 $ ais alias set sc "show cluster" 108 Aliased "sc"="show cluster" 109 110 $ ais alias 111 ALIAS COMMAND 112 get object get 113 ls bucket ls 114 put object put 115 sc show cluster 116 ``` 117 118 #### View aliases from app-level help 119 120 ```console 121 $ ais -h 122 0.8 (build 30bf97129) 123 124 DESCRIPTION: 125 If [Tab] completion doesn't work: 126 * download https://github.com/NVIDIA/aistore/tree/main/cmd/cli/autocomplete 127 * run 'cmd/cli/autocomplete/install.sh' 128 For more information, please refer to https://github.com/NVIDIA/aistore/blob/main/cmd/cli/README.md 129 130 COMMANDS: 131 bucket create/destroy buckets, list bucket's content, show existing buckets and their properties 132 object put, get, rename, remove, and other operations on objects 133 cluster monitor and manage AIS cluster: add/remove nodes, change primary gateway, etc. 134 config set local/global AIS cluster configurations 135 etl execute custom transformations on objects 136 job query and manage jobs (aka extended actions or xactions) 137 auth add/remove/show users, manage user roles, manage access to remote clusters 138 show show information about buckets, jobs, all other managed entities in the cluster and the cluster itself 139 help show a list of commands; show help for a given command 140 advanced special commands intended for development and advanced usage 141 storage monitor and manage clustered storage 142 archive Create archive and append files to archive 143 log show log 144 rebalance show rebalance details 145 remote-cluster show attached AIS clusters 146 alias manage top-level aliases 147 kubectl show kubernetes pods and services 148 search search ais commands 149 150 ALIASES: 151 get (alias for "object get") get object from the specified bucket 152 put (alias for "object put") put object(s) into the specified bucket 153 ls (alias for "bucket ls") list buckets and their objects 154 155 GLOBAL OPTIONS: 156 --help, -h show help 157 --no-color disable colored output 158 --version, -V print only the version 159 ``` 160 161 ## Reset Aliases 162 163 `ais alias reset` 164 165 Clear all created aliases, and only keep the defaults. 166 167 ### Example 168 169 ```console 170 $ ais alias 171 ALIAS COMMAND 172 get object get 173 ls bucket ls 174 put object put 175 sc show cluster 176 177 $ ais alias reset 178 Aliases reset to default 179 180 $ ais alias 181 ALIAS COMMAND 182 get object get 183 ls bucket ls 184 put object put 185 ``` 186 187 ## Alias Configuration File 188 189 As with other CLI configurations, aliases are stored in the [CLI config file](/docs/cli.md#config). 190 191 All aliases are stored under `"aliases"` as a map of strings (`ALIAS` to `AIS_COMMAND`). 192 193 ```json 194 // cat ~/.config/ais/cli/cli.json 195 { 196 "cluster": { 197 "url": "http://127.0.0.1:8080", 198 "default_ais_host": "http://127.0.0.1:8080", 199 "default_docker_host": "http://172.50.0.2:8080", 200 "skip_verify_crt": false 201 }, 202 "timeout": { 203 "tcp_timeout": "60s", 204 "http_timeout": "0s" 205 }, 206 "auth": { 207 "url": "http://127.0.0.1:52001" 208 }, 209 "aliases": { 210 "sc": "show cluster", 211 "create": "create buckets" 212 } 213 } 214 ``` 215 Users can manually add aliases to the config file, but all commands must follow the rules for [creating an alias](#create-an-alias). 216 E.g., aliases: 217 218 ```json 219 "show clu": "show cluster", 220 "show-clu": "show kluster", 221 ``` 222 are ignored because the name of the first one is not a single (or hyphenated ) word, while the AIS command of the second one does not exist.