File: faq.html

package info (click to toggle)
fish 4.2.1-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,980 kB
  • sloc: python: 6,972; javascript: 1,407; sh: 1,009; xml: 411; ansic: 230; objc: 78; makefile: 20
file content (535 lines) | stat: -rw-r--r-- 55,332 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
<!DOCTYPE html>

<html lang="en" data-content_root="./">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />

    <title>Frequently asked questions &#8212; fish-shell 4.2.1 documentation</title>
    <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=4da8bbd6" />
    <link rel="stylesheet" type="text/css" href="_static/pydoctheme.css?v=f89b4716" />
    <script src="_static/documentation_options.js?v=6fb65176"></script>
    <script src="_static/doctools.js?v=9bcbadda"></script>
    <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Interactive use" href="interactive.html" />
    <link rel="prev" title="Introduction" href="index.html" />
    <link rel="shortcut icon" type="image/png" href="_static/fish.png" />
     

  </head><body><div id="fmain">  
    <div class="related" role="navigation" aria-label="Related">
      <h3>Navigation</h3>
      <ul>
    <li><img src="_static/fish.png" alt=""
             style="width: 80px; height: 80px; vertical-align: middle; margin-top: -1px"/></li>
    <li><a href="https://fishshell.com/">fish-shell</a> &#187;</li>
    
    <a href="index.html">fish-shell 4.2.1 documentation</a> &#187;
    

        <li class="nav-item nav-item-this"><a href="">Frequently asked questions</a></li>
    <li class="right">
        

    <div class="inline-search" role="search">
        <form class="inline-search" action="search.html" method="get">
          <input placeholder="Quick search" type="text" name="q" />
          <input type="submit" value="Go" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    </li>
    
    <div id="old-docs-notice" style="display: none">
        This documents an old version of fish.
        <a href="../current/">See the latest release.</a>
    </div>

      </ul>
    </div>    

    <div class="document">
      <div class="sphinxsidebar" role="navigation" aria-label="Main">
        <div class="sphinxsidebarwrapper">
<div>
<h3><a href="index.html">Documents</a></h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="index.html">Introduction</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Frequently asked questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="interactive.html">Interactive use</a></li>
<li class="toctree-l1"><a class="reference internal" href="language.html">The fish language</a></li>
<li class="toctree-l1"><a class="reference internal" href="commands.html">Commands</a></li>
<li class="toctree-l1"><a class="reference internal" href="fish_for_bash_users.html">Fish for bash users</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial.html">Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="completions.html">Writing your own completions</a></li>
<li class="toctree-l1"><a class="reference internal" href="prompt.html">Writing your own prompt</a></li>
<li class="toctree-l1"><a class="reference internal" href="design.html">Design</a></li>
<li class="toctree-l1"><a class="reference internal" href="relnotes.html">Release notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="terminal-compatibility.html">Terminal Compatibility</a></li>
<li class="toctree-l1"><a class="reference internal" href="contributing.html">Contributing To Fish</a></li>
<li class="toctree-l1"><a class="reference internal" href="license.html">License</a></li>
</ul>

</div>
<search id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<div>
<h4><a href="index.html">Sections</a></h4>
<ul>
<li><a class="reference internal" href="#">Frequently asked questions</a><ul>
<li><a class="reference internal" href="#what-is-the-equivalent-to-this-thing-from-bash-or-other-shells">What is the equivalent to this thing from bash (or other shells)?</a></li>
<li><a class="reference internal" href="#how-do-i-set-or-clear-an-environment-variable">How do I set or clear an environment variable?</a></li>
<li><a class="reference internal" href="#how-do-i-check-whether-a-variable-is-defined">How do I check whether a variable is defined?</a></li>
<li><a class="reference internal" href="#how-do-i-check-whether-a-variable-is-not-empty">How do I check whether a variable is not empty?</a></li>
<li><a class="reference internal" href="#why-doesn-t-set-ux-exported-universal-variables-seem-to-work">Why doesn’t <code class="docutils literal notranslate"><span class="pre">set</span> <span class="pre">-Ux</span></code> (exported universal variables) seem to work?</a></li>
<li><a class="reference internal" href="#how-do-i-run-a-command-every-login-what-s-fish-s-equivalent-to-bashrc-or-profile">How do I run a command every login? What’s fish’s equivalent to .bashrc or .profile?</a></li>
<li><a class="reference internal" href="#how-do-i-set-my-prompt">How do I set my prompt?</a></li>
<li><a class="reference internal" href="#why-does-my-prompt-show-a-i">Why does my prompt show a <code class="docutils literal notranslate"><span class="pre">[I]</span></code>?</a></li>
<li><a class="reference internal" href="#how-do-i-customize-my-syntax-highlighting-colors">How do I customize my syntax highlighting colors?</a></li>
<li><a class="reference internal" href="#how-do-i-change-the-greeting-message">How do I change the greeting message?</a></li>
<li><a class="reference internal" href="#how-do-i-run-a-command-from-history">How do I run a command from history?</a></li>
<li><a class="reference internal" href="#why-doesn-t-history-substitution-etc-work">Why doesn’t history substitution (“!$” etc.) work?</a></li>
<li><a class="reference internal" href="#how-do-i-run-a-subcommand-the-backtick-doesn-t-work">How do I run a subcommand? The backtick doesn’t work!</a></li>
<li><a class="reference internal" href="#my-command-pkg-config-gives-its-output-as-a-single-long-string">My command (pkg-config) gives its output as a single long string?</a></li>
<li><a class="reference internal" href="#how-do-i-get-the-exit-status-of-a-command">How do I get the exit status of a command?</a></li>
<li><a class="reference internal" href="#my-command-prints-no-matches-for-wildcard-but-works-in-bash">My command prints “No matches for wildcard” but works in bash</a></li>
<li><a class="reference internal" href="#why-won-t-ssh-scp-rsync-connect-properly-when-fish-is-my-login-shell">Why won’t SSH/SCP/rsync connect properly when fish is my login shell?</a></li>
<li><a class="reference internal" href="#i-m-getting-weird-graphical-glitches-a-staircase-effect-ghost-characters-cursor-in-the-wrong-position">I’m getting weird graphical glitches (a staircase effect, ghost characters, cursor in the wrong position,…)?</a></li>
<li><a class="reference internal" href="#fish-does-not-work-in-a-specific-terminal">fish does not work in a specific terminal</a></li>
<li><a class="reference internal" href="#uninstalling-fish">Uninstalling fish</a></li>
</ul>
</li>
</ul>

</div>
        </div>
      </div>
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="frequently-asked-questions">
<h1>Frequently asked questions<a class="headerlink" href="#frequently-asked-questions" title="Link to this heading">¶</a></h1>
<section id="what-is-the-equivalent-to-this-thing-from-bash-or-other-shells">
<h2>What is the equivalent to this thing from bash (or other shells)?<a class="headerlink" href="#what-is-the-equivalent-to-this-thing-from-bash-or-other-shells" title="Link to this heading">¶</a></h2>
<p>See <a class="reference internal" href="fish_for_bash_users.html"><span class="doc">Fish for bash users</span></a></p>
</section>
<section id="how-do-i-set-or-clear-an-environment-variable">
<h2>How do I set or clear an environment variable?<a class="headerlink" href="#how-do-i-set-or-clear-an-environment-variable" title="Link to this heading">¶</a></h2>
<p>Use the <a class="reference internal" href="cmds/set.html"><span class="doc">set</span></a> command:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">set</span><span class="w"> </span><span class="no">-x</span><span class="w"> </span><span class="no">key</span><span class="w"> </span><span class="no">value</span><span class="w"> </span><span class="c"># typically set -gx key value</span>
<span class="nf">set</span><span class="w"> </span><span class="no">-e</span><span class="w"> </span><span class="no">key</span>
</pre></div>
</div>
<p>Since fish 3.1 you can set an environment variable for one command using the <code class="docutils literal notranslate"><span class="pre">key=value</span> <span class="pre">some</span> <span class="pre">command</span></code> syntax, like in other shells.  The two lines below behave identically - unlike other shells, fish will output <code class="docutils literal notranslate"><span class="pre">value</span></code> both times:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="no">key</span><span class="o">=</span><span class="no">value</span><span class="w"> </span><span class="nf">echo</span><span class="w"> </span><span class="o">$key</span>
<span class="nf">begin</span><span class="p">;</span><span class="w"> </span><span class="nf">set</span><span class="w"> </span><span class="no">-lx</span><span class="w"> </span><span class="no">key</span><span class="w"> </span><span class="no">value</span><span class="p">;</span><span class="w"> </span><span class="nf">echo</span><span class="w"> </span><span class="o">$key</span><span class="p">;</span><span class="w"> </span><span class="nf">end</span>
</pre></div>
</div>
<p>Note that “exported” is not a <a class="reference internal" href="language.html#variables-scope"><span class="std std-ref">scope</span></a>, but an additional bit of state. A variable can be global and exported or local and exported or even universal and exported. Typically it makes sense to make an exported variable global.</p>
</section>
<section id="how-do-i-check-whether-a-variable-is-defined">
<h2>How do I check whether a variable is defined?<a class="headerlink" href="#how-do-i-check-whether-a-variable-is-defined" title="Link to this heading">¶</a></h2>
<p>Use <code class="docutils literal notranslate"><span class="pre">set</span> <span class="pre">-q</span> <span class="pre">var</span></code>.  For example, <code class="docutils literal notranslate"><span class="pre">if</span> <span class="pre">set</span> <span class="pre">-q</span> <span class="pre">var;</span> <span class="pre">echo</span> <span class="pre">variable</span> <span class="pre">defined;</span> <span class="pre">end</span></code>.  To check multiple variables you can combine with <code class="docutils literal notranslate"><span class="pre">and</span></code> and <code class="docutils literal notranslate"><span class="pre">or</span></code> like so:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">if</span><span class="w"> </span><span class="nf">set</span><span class="w"> </span><span class="no">-q</span><span class="w"> </span><span class="no">var1</span><span class="p">;</span><span class="w"> </span><span class="o">or</span><span class="w"> </span><span class="nf">set</span><span class="w"> </span><span class="no">-q</span><span class="w"> </span><span class="no">var2</span>
<span class="w">    </span><span class="nf">echo</span><span class="w"> </span><span class="no">either</span><span class="w"> </span><span class="no">variable</span><span class="w"> </span><span class="no">defined</span>
<span class="nf">end</span>
</pre></div>
</div>
<p>Keep in mind that a defined variable could also be empty, either by having no elements (if set like <code class="docutils literal notranslate"><span class="pre">set</span> <span class="pre">var</span></code>) or only empty elements (if set like <code class="docutils literal notranslate"><span class="pre">set</span> <span class="pre">var</span> <span class="pre">&quot;&quot;</span></code>). Read on for how to deal with those.</p>
</section>
<section id="how-do-i-check-whether-a-variable-is-not-empty">
<h2>How do I check whether a variable is not empty?<a class="headerlink" href="#how-do-i-check-whether-a-variable-is-not-empty" title="Link to this heading">¶</a></h2>
<p>Use <code class="docutils literal notranslate"><span class="pre">string</span> <span class="pre">length</span> <span class="pre">-q</span> <span class="pre">--</span> <span class="pre">$var</span></code>.  For example, <code class="docutils literal notranslate"><span class="pre">if</span> <span class="pre">string</span> <span class="pre">length</span> <span class="pre">-q</span> <span class="pre">--</span> <span class="pre">$var;</span> <span class="pre">echo</span> <span class="pre">not</span> <span class="pre">empty;</span> <span class="pre">end</span></code>.  Note that <code class="docutils literal notranslate"><span class="pre">string</span> <span class="pre">length</span></code> will interpret a list of multiple variables as a disjunction (meaning any/or):</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">if</span><span class="w"> </span><span class="nf">string</span><span class="w"> </span><span class="no">length</span><span class="w"> </span><span class="no">-q</span><span class="w"> </span><span class="no">--</span><span class="w"> </span><span class="o">$var1</span><span class="w"> </span><span class="o">$var2</span><span class="w"> </span><span class="o">$var3</span>
<span class="w">    </span><span class="nf">echo</span><span class="w"> </span><span class="no">at</span><span class="w"> </span><span class="no">least</span><span class="w"> </span><span class="no">one</span><span class="w"> </span><span class="no">of</span><span class="w"> </span><span class="no">these</span><span class="w"> </span><span class="no">variables</span><span class="w"> </span><span class="no">is</span><span class="w"> </span><span class="no">not</span><span class="w"> </span><span class="no">empty</span>
<span class="nf">end</span>
</pre></div>
</div>
<p>Alternatively, use <code class="docutils literal notranslate"><span class="pre">test</span> <span class="pre">-n</span> <span class="pre">&quot;$var&quot;</span></code>, but remember that <strong>the variable must be double-quoted</strong>.  For example, <code class="docutils literal notranslate"><span class="pre">if</span> <span class="pre">test</span> <span class="pre">-n</span> <span class="pre">&quot;$var&quot;;</span> <span class="pre">echo</span> <span class="pre">not</span> <span class="pre">empty;</span> <span class="pre">end</span></code>. The <code class="docutils literal notranslate"><span class="pre">test</span></code> command provides its own and (-a) and or (-o):</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">if</span><span class="w"> </span><span class="nf">test</span><span class="w"> </span><span class="no">-n</span><span class="w"> </span><span class="s2">&quot;</span><span class="o">$var1</span><span class="s2">&quot;</span><span class="w"> </span><span class="no">-o</span><span class="w"> </span><span class="no">-n</span><span class="w"> </span><span class="s2">&quot;</span><span class="o">$var2</span><span class="s2">&quot;</span><span class="w"> </span><span class="no">-o</span><span class="w"> </span><span class="no">-n</span><span class="w"> </span><span class="s2">&quot;</span><span class="o">$var3</span><span class="s2">&quot;</span>
<span class="w">    </span><span class="nf">echo</span><span class="w"> </span><span class="no">at</span><span class="w"> </span><span class="no">least</span><span class="w"> </span><span class="no">one</span><span class="w"> </span><span class="no">of</span><span class="w"> </span><span class="no">these</span><span class="w"> </span><span class="no">variables</span><span class="w"> </span><span class="no">is</span><span class="w"> </span><span class="no">not</span><span class="w"> </span><span class="no">empty</span>
<span class="nf">end</span>
</pre></div>
</div>
<p>If you want to know if a variable has <em>no elements</em>, use <code class="docutils literal notranslate"><span class="pre">set</span> <span class="pre">-q</span> <span class="pre">var[1]</span></code>.</p>
</section>
<section id="why-doesn-t-set-ux-exported-universal-variables-seem-to-work">
<h2>Why doesn’t <code class="docutils literal notranslate"><span class="pre">set</span> <span class="pre">-Ux</span></code> (exported universal variables) seem to work?<a class="headerlink" href="#why-doesn-t-set-ux-exported-universal-variables-seem-to-work" title="Link to this heading">¶</a></h2>
<p>A global variable of the same name already exists.</p>
<p>Environment variables such as <code class="docutils literal notranslate"><span class="pre">EDITOR</span></code> or <code class="docutils literal notranslate"><span class="pre">TZ</span></code> can be set universally using <code class="docutils literal notranslate"><span class="pre">set</span> <span class="pre">-Ux</span></code>.  However, if
there is an environment variable already set before fish starts (such as by login scripts or system
administrators), it is imported into fish as a global variable. The <a class="reference internal" href="language.html#variables-scope"><span class="std std-ref">variable scopes</span></a> are searched from the “inside out”, which
means that local variables are checked first, followed by global variables, and finally universal
variables.</p>
<p>This means that the global value takes precedence over the universal value.</p>
<p>To avoid this problem, consider changing the setting which fish inherits. If this is not possible,
add a statement to your <a class="reference internal" href="language.html#configuration"><span class="std std-ref">configuration file</span></a> (usually
<code class="docutils literal notranslate"><span class="pre">~/.config/fish/config.fish</span></code>):</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">set</span><span class="w"> </span><span class="no">-gx</span><span class="w"> </span><span class="no">EDITOR</span><span class="w"> </span><span class="no">vim</span>
</pre></div>
</div>
</section>
<section id="how-do-i-run-a-command-every-login-what-s-fish-s-equivalent-to-bashrc-or-profile">
<h2>How do I run a command every login? What’s fish’s equivalent to .bashrc or .profile?<a class="headerlink" href="#how-do-i-run-a-command-every-login-what-s-fish-s-equivalent-to-bashrc-or-profile" title="Link to this heading">¶</a></h2>
<p>Edit the file <code class="docutils literal notranslate"><span class="pre">~/.config/fish/config.fish</span></code> <a class="footnote-reference brackets" href="#id2" id="id1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a>, creating it if it does not exist (Note the leading period).</p>
<p>Unlike .bashrc and .profile, this file is always read, even in non-interactive or login shells.</p>
<p>To do something only in interactive shells, check <code class="docutils literal notranslate"><span class="pre">status</span> <span class="pre">is-interactive</span></code> like:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">if</span><span class="w"> </span><span class="nf">status</span><span class="w"> </span><span class="no">is-interactive</span>
<span class="w">    </span><span class="c"># use the coolbeans theme</span>
<span class="w">    </span><span class="nf">fish_config</span><span class="w"> </span><span class="no">theme</span><span class="w"> </span><span class="no">choose</span><span class="w"> </span><span class="no">coolbeans</span>
<span class="nf">end</span>
</pre></div>
</div>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="id2" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id1">1</a><span class="fn-bracket">]</span></span>
<p>The “~/.config” part of this can be set via $XDG_CONFIG_HOME, that’s just the default.</p>
</aside>
</aside>
</section>
<section id="how-do-i-set-my-prompt">
<h2>How do I set my prompt?<a class="headerlink" href="#how-do-i-set-my-prompt" title="Link to this heading">¶</a></h2>
<p>The prompt is the output of the <code class="docutils literal notranslate"><span class="pre">fish_prompt</span></code> function. Put it in <code class="docutils literal notranslate"><span class="pre">~/.config/fish/functions/fish_prompt.fish</span></code>. For example, a simple prompt is:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">function</span><span class="w"> </span><span class="no">fish_prompt</span>
<span class="w">    </span><span class="nf">set_color</span><span class="w"> </span><span class="o">$fish_color_cwd</span>
<span class="w">    </span><span class="nf">echo</span><span class="w"> </span><span class="no">-n</span><span class="w"> </span><span class="o">(</span><span class="nf">prompt_pwd</span><span class="o">)</span>
<span class="w">    </span><span class="nf">set_color</span><span class="w"> </span><span class="no">normal</span>
<span class="w">    </span><span class="nf">echo</span><span class="w"> </span><span class="no">-n</span><span class="w"> </span><span class="s1">&#39; &gt; &#39;</span>
<span class="nf">end</span>
</pre></div>
</div>
<p>You can also use the Web configuration tool, <a class="reference internal" href="cmds/fish_config.html"><span class="doc">fish_config</span></a>, to preview and choose from a gallery of sample prompts.</p>
<p>Or you can use fish_config from the commandline:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt; </span><span class="nf">fish_config</span><span class="w"> </span><span class="no">prompt</span><span class="w"> </span><span class="no">show</span>
<span class="go"># displays all the prompts fish ships with</span>
<span class="gp">&gt; </span><span class="nf">fish_config</span><span class="w"> </span><span class="no">prompt</span><span class="w"> </span><span class="no">choose</span><span class="w"> </span><span class="no">disco</span>
<span class="go"># loads the disco prompt in the current shell</span>
<span class="gp">&gt; </span><span class="nf">fish_config</span><span class="w"> </span><span class="no">prompt</span><span class="w"> </span><span class="no">save</span>
<span class="go"># makes the change permanent</span>
</pre></div>
</div>
<p>If you want to modify your existing prompt, you can use <a class="reference internal" href="cmds/funced.html"><span class="doc">funced</span></a> and <a class="reference internal" href="cmds/funcsave.html"><span class="doc">funcsave</span></a> like:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;_ </span><span class="nf">funced</span><span class="w"> </span><span class="no">fish_prompt</span>
<span class="go"># This opens up your editor (set in $EDITOR).</span>
<span class="go"># Modify the function,</span>
<span class="go"># save the file and repeat to your liking.</span>
<span class="go"># Once you are happy with it:</span>
<span class="gp">&gt;_ </span><span class="nf">funcsave</span><span class="w"> </span><span class="no">fish_prompt</span>
</pre></div>
</div>
<p>This also applies to <a class="reference internal" href="cmds/fish_right_prompt.html"><span class="doc">fish_right_prompt</span></a> and <a class="reference internal" href="cmds/fish_mode_prompt.html"><span class="doc">fish_mode_prompt</span></a>.</p>
</section>
<section id="why-does-my-prompt-show-a-i">
<h2>Why does my prompt show a <code class="docutils literal notranslate"><span class="pre">[I]</span></code>?<a class="headerlink" href="#why-does-my-prompt-show-a-i" title="Link to this heading">¶</a></h2>
<p>That’s the <a class="reference internal" href="cmds/fish_mode_prompt.html"><span class="doc">fish_mode_prompt</span></a>. It is displayed by default when you’ve activated vi mode using <code class="docutils literal notranslate"><span class="pre">fish_vi_key_bindings</span></code>.</p>
<p>If you haven’t activated vi mode on purpose, you might have installed a third-party theme or plugin that does it.</p>
<p>If you want to change or disable this display, modify the <code class="docutils literal notranslate"><span class="pre">fish_mode_prompt</span></code> function, for instance via <a class="reference internal" href="cmds/funced.html"><span class="doc">funced</span></a>.</p>
</section>
<section id="how-do-i-customize-my-syntax-highlighting-colors">
<h2>How do I customize my syntax highlighting colors?<a class="headerlink" href="#how-do-i-customize-my-syntax-highlighting-colors" title="Link to this heading">¶</a></h2>
<p>Use the web configuration tool, <a class="reference internal" href="cmds/fish_config.html"><span class="doc">fish_config</span></a>, or alter the <a class="reference internal" href="interactive.html#variables-color"><span class="std std-ref">fish_color family of environment variables</span></a>.</p>
<p>You can also use <code class="docutils literal notranslate"><span class="pre">fish_config</span></code> on the commandline, like:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt; </span><span class="nf">fish_config</span><span class="w"> </span><span class="no">theme</span><span class="w"> </span><span class="no">show</span>
<span class="go"># to demonstrate all the colorschemes</span>
<span class="gp">&gt; </span><span class="nf">fish_config</span><span class="w"> </span><span class="no">theme</span><span class="w"> </span><span class="no">choose</span><span class="w"> </span><span class="no">coolbeans</span>
<span class="go"># to load the &quot;coolbeans&quot; theme</span>
<span class="gp">&gt; </span><span class="nf">fish_config</span><span class="w"> </span><span class="no">theme</span><span class="w"> </span><span class="no">save</span>
<span class="go"># to make the change permanent</span>
</pre></div>
</div>
</section>
<section id="how-do-i-change-the-greeting-message">
<h2>How do I change the greeting message?<a class="headerlink" href="#how-do-i-change-the-greeting-message" title="Link to this heading">¶</a></h2>
<p>Change the value of the variable <code class="docutils literal notranslate"><span class="pre">fish_greeting</span></code> or create a <a class="reference internal" href="cmds/fish_greeting.html"><span class="doc">fish_greeting</span></a> function. For example, to remove the greeting use:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">set</span><span class="w"> </span><span class="no">-U</span><span class="w"> </span><span class="no">fish_greeting</span>
</pre></div>
</div>
<p>Or if you prefer not to use a universal variable, use:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">set</span><span class="w"> </span><span class="no">-g</span><span class="w"> </span><span class="no">fish_greeting</span>
</pre></div>
</div>
<p>in <a class="reference internal" href="language.html#configuration"><span class="std std-ref">config.fish</span></a>.</p>
</section>
<section id="how-do-i-run-a-command-from-history">
<h2>How do I run a command from history?<a class="headerlink" href="#how-do-i-run-a-command-from-history" title="Link to this heading">¶</a></h2>
<p>Type some part of the command, and then hit the <kbd class="kbd docutils literal notranslate">up</kbd> (<code class="docutils literal notranslate"><span class="pre">↑</span></code>) or <kbd class="kbd docutils literal notranslate">down</kbd> (<code class="docutils literal notranslate"><span class="pre">↓</span></code>) arrow keys to navigate through history matches, or press <kbd class="kbd docutils literal notranslate">ctrl</kbd>-<kbd class="kbd docutils literal notranslate">r</kbd> to open the history in a searchable pager. In this pager you can press <kbd class="kbd docutils literal notranslate">ctrl</kbd>-<kbd class="kbd docutils literal notranslate">r</kbd> or <kbd class="kbd docutils literal notranslate">ctrl</kbd>-<kbd class="kbd docutils literal notranslate">s</kbd> to move to older or younger history respectively.</p>
<p>Additional default key bindings include <kbd class="kbd docutils literal notranslate">ctrl</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd> (up) and <kbd class="kbd docutils literal notranslate">ctrl</kbd>-<kbd class="kbd docutils literal notranslate">n</kbd> (down). See <a class="reference internal" href="interactive.html#history-search"><span class="std std-ref">Searchable command history</span></a> for more information.</p>
</section>
<section id="why-doesn-t-history-substitution-etc-work">
<h2>Why doesn’t history substitution (“!$” etc.) work?<a class="headerlink" href="#why-doesn-t-history-substitution-etc-work" title="Link to this heading">¶</a></h2>
<p>Because history substitution is an awkward interface that was invented before interactive line editing was even possible. Instead of adding this pseudo-syntax, fish opts for nice history searching and recall features.  Switching requires a small change of habits: if you want to modify an old line/word, first recall it, then edit.</p>
<p>As a special case, most of the time history substitution is used as <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">!!</span></code>. In that case press <kbd class="kbd docutils literal notranslate">alt</kbd>-<kbd class="kbd docutils literal notranslate">s</kbd>, and it will recall your last commandline with <code class="docutils literal notranslate"><span class="pre">sudo</span></code> prefixed (or toggle a <code class="docutils literal notranslate"><span class="pre">sudo</span></code> prefix on the current commandline if there is anything).</p>
<p>In general, fish’s history recall works like this:</p>
<ul class="simple">
<li><p>Like other shells, the Up arrow, <code class="docutils literal notranslate"><span class="pre">up</span></code> recalls whole lines, starting from the last executed line. So instead of typing <code class="docutils literal notranslate"><span class="pre">!!</span></code>, you would hit the up-arrow.</p></li>
<li><p>If the line you want is far back in the history, type any part of the line and then press Up one or more times.  This will filter the recalled lines to ones that include this text, and you will get to the line you want much faster.  This replaces “!vi”, “!?bar.c” and the like. If you want to see more context, you can press <code class="docutils literal notranslate"><span class="pre">ctrl-r</span></code> to open the history in the pager.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">alt-up</span></code> recalls individual arguments, starting from the last argument in the last executed line. This can be used instead of “!$”.</p></li>
</ul>
<p>See <a class="reference internal" href="interactive.html#editor"><span class="std std-ref">documentation</span></a> for more details about line editing in fish.</p>
<p>That being said, you can use <a class="reference internal" href="interactive.html#abbreviations"><span class="std std-ref">Abbreviations</span></a> to implement history substitution. Here’s <code class="docutils literal notranslate"><span class="pre">!!</span></code> only:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">function</span><span class="w"> </span><span class="no">last_history_item</span><span class="p">;</span><span class="w"> </span><span class="nf">echo</span><span class="w"> </span><span class="o">$history[</span><span class="no">1</span><span class="o">]</span><span class="p">;</span><span class="w"> </span><span class="nf">end</span>
<span class="nf">abbr</span><span class="w"> </span><span class="no">-a</span><span class="w"> </span><span class="no">!!</span><span class="w"> </span><span class="no">--position</span><span class="w"> </span><span class="no">anywhere</span><span class="w"> </span><span class="no">--function</span><span class="w"> </span><span class="no">last_history_item</span>
</pre></div>
</div>
<p>Run this and <code class="docutils literal notranslate"><span class="pre">!!</span></code> will be replaced with the last history entry, anywhere on the commandline. Put it into <a class="reference internal" href="language.html#configuration"><span class="std std-ref">config.fish</span></a> to keep it.</p>
</section>
<section id="how-do-i-run-a-subcommand-the-backtick-doesn-t-work">
<h2>How do I run a subcommand? The backtick doesn’t work!<a class="headerlink" href="#how-do-i-run-a-subcommand-the-backtick-doesn-t-work" title="Link to this heading">¶</a></h2>
<p><code class="docutils literal notranslate"><span class="pre">fish</span></code> uses parentheses for subcommands. For example:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">for</span><span class="w"> </span><span class="no">i</span><span class="w"> </span><span class="nf">in</span><span class="w"> </span><span class="o">(</span><span class="nf">ls</span><span class="o">)</span>
<span class="w">    </span><span class="nf">echo</span><span class="w"> </span><span class="o">$i</span>
<span class="nf">end</span>
</pre></div>
</div>
<p>It also supports the familiar <code class="docutils literal notranslate"><span class="pre">$()</span></code> syntax, even in quotes. Backticks are not supported because they are discouraged even in POSIX shells. They nest poorly and are hard to tell from single quotes (<code class="docutils literal notranslate"><span class="pre">''</span></code>).</p>
</section>
<section id="my-command-pkg-config-gives-its-output-as-a-single-long-string">
<h2>My command (pkg-config) gives its output as a single long string?<a class="headerlink" href="#my-command-pkg-config-gives-its-output-as-a-single-long-string" title="Link to this heading">¶</a></h2>
<p>Unlike other shells, fish splits command substitutions only on newlines, not spaces or tabs or the characters in $IFS.</p>
<p>That means if you run</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">count</span><span class="w"> </span><span class="o">(</span><span class="nf">printf</span><span class="w"> </span><span class="s1">&#39;%s &#39;</span><span class="w"> </span><span class="no">a</span><span class="w"> </span><span class="no">b</span><span class="w"> </span><span class="no">c</span><span class="o">)</span>
</pre></div>
</div>
<p>It will print <code class="docutils literal notranslate"><span class="pre">1</span></code>, because the “a b c “ is used in one piece. But if you do</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">count</span><span class="w"> </span><span class="o">(</span><span class="nf">printf</span><span class="w"> </span><span class="s1">&#39;%s\n&#39;</span><span class="w"> </span><span class="no">a</span><span class="w"> </span><span class="no">b</span><span class="w"> </span><span class="no">c</span><span class="o">)</span>
</pre></div>
</div>
<p>it will print <code class="docutils literal notranslate"><span class="pre">3</span></code>, because it gave <code class="docutils literal notranslate"><span class="pre">count</span></code> the arguments “a”, “b” and “c” separately.</p>
<p>In the overwhelming majority of cases, splitting on spaces is unwanted, so this is an improvement. This is why you hear about problems with filenames with spaces, after all.</p>
<p>However sometimes, especially with <code class="docutils literal notranslate"><span class="pre">pkg-config</span></code> and related tools, splitting on spaces is needed.</p>
<p>In these cases use <code class="docutils literal notranslate"><span class="pre">string</span> <span class="pre">split</span> <span class="pre">-n</span> <span class="pre">&quot;</span> <span class="pre">&quot;</span></code> like:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">g++</span><span class="w"> </span><span class="no">example_01.cpp</span><span class="w"> </span><span class="o">(</span><span class="nf">pkg-config</span><span class="w"> </span><span class="no">--cflags</span><span class="w"> </span><span class="no">--libs</span><span class="w"> </span><span class="no">gtk+-2.0</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="nf">string</span><span class="w"> </span><span class="no">split</span><span class="w"> </span><span class="no">-n</span><span class="w"> </span><span class="s2">&quot; &quot;</span><span class="o">)</span>
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">-n</span></code> is so empty elements are removed like POSIX shells would do.</p>
</section>
<section id="how-do-i-get-the-exit-status-of-a-command">
<h2>How do I get the exit status of a command?<a class="headerlink" href="#how-do-i-get-the-exit-status-of-a-command" title="Link to this heading">¶</a></h2>
<p>Use the <code class="docutils literal notranslate"><span class="pre">$status</span></code> variable. This replaces the <code class="docutils literal notranslate"><span class="pre">$?</span></code> variable used in other shells.</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">somecommand</span>
<span class="nf">if</span><span class="w"> </span><span class="nf">test</span><span class="w"> </span><span class="o">$status</span><span class="w"> </span><span class="no">-eq</span><span class="w"> </span><span class="no">7</span>
<span class="w">    </span><span class="nf">echo</span><span class="w"> </span><span class="s2">&quot;That&#39;s my lucky number!&quot;</span>
<span class="nf">end</span>
</pre></div>
</div>
<p>If you are only interested in success or failure, you can run the command directly as the if-condition:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">if</span><span class="w"> </span><span class="nf">somecommand</span>
<span class="w">    </span><span class="nf">echo</span><span class="w"> </span><span class="s2">&quot;Command succeeded&quot;</span>
<span class="nf">else</span>
<span class="w">    </span><span class="nf">echo</span><span class="w"> </span><span class="s2">&quot;Command failed&quot;</span>
<span class="nf">end</span>
</pre></div>
</div>
<p>Or if you just want to do one command in case the first succeeded or failed, use <code class="docutils literal notranslate"><span class="pre">and</span></code> or <code class="docutils literal notranslate"><span class="pre">or</span></code>:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">somecommand</span>
<span class="o">or</span><span class="w"> </span><span class="nf">someothercommand</span>
</pre></div>
</div>
<p>See the <a class="reference internal" href="language.html#syntax-conditional"><span class="std std-ref">Conditions</span></a> and the documentation for <a class="reference internal" href="cmds/test.html"><span class="doc">test</span></a> and <a class="reference internal" href="cmds/if.html"><span class="doc">if</span></a> for more information.</p>
</section>
<section id="my-command-prints-no-matches-for-wildcard-but-works-in-bash">
<h2>My command prints “No matches for wildcard” but works in bash<a class="headerlink" href="#my-command-prints-no-matches-for-wildcard-but-works-in-bash" title="Link to this heading">¶</a></h2>
<p>In short: <a class="reference internal" href="language.html#quotes"><span class="std std-ref">quote</span></a> or <a class="reference internal" href="language.html#escapes"><span class="std std-ref">escape</span></a> the wildcard:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">scp</span><span class="w"> </span><span class="no">user@ip:/dir/</span><span class="s2">&quot;string-*&quot;</span>
</pre></div>
</div>
<p>When fish sees an unquoted <code class="docutils literal notranslate"><span class="pre">*</span></code>, it performs <a class="reference internal" href="language.html#expand-wildcard"><span class="std std-ref">wildcard expansion</span></a>. That means it tries to match filenames to the given string.</p>
<p>If the wildcard doesn’t match any files, fish prints an error instead of running the command:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt; </span><span class="nf">echo</span><span class="w"> </span><span class="o">*</span><span class="no">this</span><span class="o">*</span><span class="no">does</span><span class="o">*</span><span class="no">not</span><span class="o">*</span><span class="no">exist</span>
<span class="go">fish: No matches for wildcard &#39;*this*does*not*exist&#39;. See `help expand`.</span>
<span class="go">echo *this*does*not*exist</span>
<span class="go">     ^</span>
</pre></div>
</div>
<p>Now, bash also tries to match files in this case, but when it doesn’t find a match, it passes along the literal wildcard string instead.</p>
<p>That means that commands like the above</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>scp<span class="w"> </span>user@ip:/dir/string-*
</pre></div>
</div>
<p>or</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>apt<span class="w"> </span>install<span class="w"> </span>postgres-*
</pre></div>
</div>
<p>appear to work, because most of the time the string doesn’t match and so it passes along the <code class="docutils literal notranslate"><span class="pre">string-*</span></code>, which is then interpreted by the receiving program.</p>
<p>But it also means that these commands can stop working at any moment once a matching file is encountered (because it has been created or the command is executed in a different working directory), and to deal with that bash needs workarounds like</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="k">for</span><span class="w"> </span>f<span class="w"> </span><span class="k">in</span><span class="w"> </span>./*.mpg<span class="p">;</span><span class="w"> </span><span class="k">do</span>
<span class="w">      </span><span class="c1"># We need to test if the file really exists because</span>
<span class="w">      </span><span class="c1"># the wildcard might have failed to match.</span>
<span class="w">      </span><span class="nb">test</span><span class="w"> </span>-f<span class="w"> </span><span class="s2">&quot;</span><span class="nv">$f</span><span class="s2">&quot;</span><span class="w"> </span><span class="o">||</span><span class="w"> </span><span class="k">continue</span>
<span class="w">      </span>mympgviewer<span class="w"> </span><span class="s2">&quot;</span><span class="nv">$f</span><span class="s2">&quot;</span>
<span class="k">done</span>
</pre></div>
</div>
<p>(from <a class="reference external" href="http://mywiki.wooledge.org/BashFAQ/004">http://mywiki.wooledge.org/BashFAQ/004</a>)</p>
<p>For these reasons, fish does not do this, and instead expects asterisks to be quoted or escaped if they aren’t supposed to be expanded.</p>
<p>This is similar to bash’s “failglob” option.</p>
</section>
<section id="why-won-t-ssh-scp-rsync-connect-properly-when-fish-is-my-login-shell">
<h2>Why won’t SSH/SCP/rsync connect properly when fish is my login shell?<a class="headerlink" href="#why-won-t-ssh-scp-rsync-connect-properly-when-fish-is-my-login-shell" title="Link to this heading">¶</a></h2>
<p>This problem may show up as messages like “<code class="docutils literal notranslate"><span class="pre">Received</span> <span class="pre">message</span> <span class="pre">too</span> <span class="pre">long</span></code>”, “<code class="docutils literal notranslate"><span class="pre">open</span> <span class="pre">terminal</span>
<span class="pre">failed:</span> <span class="pre">not</span> <span class="pre">a</span> <span class="pre">terminal</span></code>”, “<code class="docutils literal notranslate"><span class="pre">Bad</span> <span class="pre">packet</span> <span class="pre">length</span></code>”, or “<code class="docutils literal notranslate"><span class="pre">Connection</span> <span class="pre">refused</span></code>” with strange output
in <code class="docutils literal notranslate"><span class="pre">ssh_exchange_identification</span></code> messages in the debug log.</p>
<p>This usually happens because fish reads the <a class="reference internal" href="language.html#configuration"><span class="std std-ref">user configuration file</span></a> (<code class="docutils literal notranslate"><span class="pre">~/.config/fish/config.fish</span></code>) <em>always</em>,
whether it’s in an interactive or login or non-interactive or non-login shell.</p>
<p>This simplifies matters, but it also means when config.fish generates output, it will do that even in non-interactive shells like the one ssh/scp/rsync start when they connect.</p>
<p>Anything in config.fish that produces output should be guarded with <code class="docutils literal notranslate"><span class="pre">status</span> <span class="pre">is-interactive</span></code> (or <code class="docutils literal notranslate"><span class="pre">status</span> <span class="pre">is-login</span></code> if you prefer):</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">if</span><span class="w"> </span><span class="nf">status</span><span class="w"> </span><span class="no">is-interactive</span>
<span class="w">  </span><span class="nf">...</span>
<span class="nf">end</span>
</pre></div>
</div>
<p>The same applies for example when you start <code class="docutils literal notranslate"><span class="pre">tmux</span></code> in config.fish without guards, which will cause a message like <code class="docutils literal notranslate"><span class="pre">sessions</span> <span class="pre">should</span> <span class="pre">be</span> <span class="pre">nested</span> <span class="pre">with</span> <span class="pre">care,</span> <span class="pre">unset</span> <span class="pre">$TMUX</span> <span class="pre">to</span> <span class="pre">force</span></code>.</p>
</section>
<section id="i-m-getting-weird-graphical-glitches-a-staircase-effect-ghost-characters-cursor-in-the-wrong-position">
<span id="faq-unicode"></span><h2>I’m getting weird graphical glitches (a staircase effect, ghost characters, cursor in the wrong position,…)?<a class="headerlink" href="#i-m-getting-weird-graphical-glitches-a-staircase-effect-ghost-characters-cursor-in-the-wrong-position" title="Link to this heading">¶</a></h2>
<p>In a terminal, the application running inside it and the terminal itself need to agree on the width of characters in order to handle cursor movement.</p>
<p>This is more important to fish than other shells because features like syntax highlighting and autosuggestions are implemented by moving the cursor.</p>
<p>Sometimes, there is disagreement on the width. There are numerous causes and fixes for this:</p>
<ul class="simple">
<li><p>It is possible the character is too new for your system to know - in this case you need to refrain from using it.</p></li>
<li><p>Fish or your terminal might not know about the character or handle it wrong - in this case fish or your terminal needs to be fixed, or you need to update to a fixed version.</p></li>
<li><p>The character has an “ambiguous” width and fish thinks that means a width of X while your terminal thinks it’s Y. In this case you either need to change your terminal’s configuration or set $fish_ambiguous_width to the correct value.</p></li>
<li><p>The character is an emoji and the host system only supports Unicode 8, while you are running the terminal on a system that uses Unicode &gt;= 9. In this case set $fish_emoji_width to 2.</p></li>
</ul>
<p>This also means that a few things are unsupportable:</p>
<ul class="simple">
<li><p>Non-monospace fonts - there is <em>no way</em> for fish to figure out what width a specific character has as it has no influence on the terminal’s font rendering.</p></li>
<li><p>Different widths for multiple ambiguous width characters - there is no way for fish to know which width you assign to each character.</p></li>
</ul>
</section>
<section id="fish-does-not-work-in-a-specific-terminal">
<span id="faq-terminal-compatibility"></span><h2>fish does not work in a specific terminal<a class="headerlink" href="#fish-does-not-work-in-a-specific-terminal" title="Link to this heading">¶</a></h2>
<p>The terminal might not meet all of <a class="reference internal" href="terminal-compatibility.html"><span class="doc">fish’s requirements</span></a>.
Please report this to your terminal’s and to fish’s issue tracker.</p>
</section>
<section id="uninstalling-fish">
<span id="faq-uninstalling"></span><h2>Uninstalling fish<a class="headerlink" href="#uninstalling-fish" title="Link to this heading">¶</a></h2>
<p>If you want to uninstall fish, first make sure fish is not set as your shell. Run <code class="docutils literal notranslate"><span class="pre">chsh</span> <span class="pre">-s</span> <span class="pre">/bin/bash</span></code> if you are not sure.</p>
<p>If you installed it with a package manager, use that package manager’s uninstall function. If you built fish yourself, assuming you installed it to /usr/local, do this:</p>
<div class="highlight-fish-docs-samples notranslate"><div class="highlight"><pre><span></span><span class="nf">rm</span><span class="w"> </span><span class="no">-Rf</span><span class="w"> </span><span class="no">/usr/local/etc/fish</span><span class="w"> </span><span class="no">/usr/local/share/fish</span><span class="w"> </span><span class="o">~</span><span class="no">/.config/fish</span>
<span class="nf">rm</span><span class="w"> </span><span class="no">/usr/local/share/man/man1/fish</span><span class="o">*</span><span class="no">.1</span>
<span class="nf">cd</span><span class="w"> </span><span class="no">/usr/local/bin</span>
<span class="nf">rm</span><span class="w"> </span><span class="no">-f</span><span class="w"> </span><span class="no">fish</span><span class="w"> </span><span class="no">fish_indent</span>
</pre></div>
</div>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div> 
      <div class="clearer"></div>
    </div>  
    <div class="related" role="navigation" aria-label="Related">
      <h3>Navigation</h3>
      <ul>
    <li><img src="_static/fish.png" alt=""
             style="width: 80px; height: 80px; vertical-align: middle; margin-top: -1px"/></li>
    <li><a href="https://fishshell.com/">fish-shell</a> &#187;</li>
    
    <a href="index.html">fish-shell 4.2.1 documentation</a> &#187;
    

        <li class="nav-item nav-item-this"><a href="">Frequently asked questions</a></li>
    <li class="right">
        

    <div class="inline-search" role="search">
        <form class="inline-search" action="search.html" method="get">
          <input placeholder="Quick search" type="text" name="q" />
          <input type="submit" value="Go" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    </li>
    
    <div id="old-docs-notice" style="display: none">
        This documents an old version of fish.
        <a href="../current/">See the latest release.</a>
    </div>

      </ul>
    </div>  
    <div class="footer">
    &copy; Copyright fish-shell developers.
    <br />
    <a href="https://github.com/fish-shell/fish-shell/issues">Found a bug</a>?
    <br />

    Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
    </div>
</div>

<script type="text/javascript">
 FISH_DOCS_VERSION = "4.2";

 function copy_to_clipboard(it) {
     // Find the pre tag we're interested in.
     var pre = it.target;
     while (pre.tagName != "PRE") pre = pre.parentNode;
     var txt = "";
     // Cheesy: If we have a prompt,
     // we only copy prompted lines,
     // by splitting and matching and stuff
     if (pre.querySelector('span.gp')) {
         var texts= [];
         for (var line of pre.innerText.split('\n')) {
             if (line.match(/^>_?.*/)) {
                 texts.push(line.replace(/^>_?/, ""));
             }
         }
         txt = texts.join("\n");
     } else {
         // Even cheesier: If we don't have a prompt, we remove the button text from the end.
         var txt = pre.innerText.substring(0, pre.innerText.length - it.target.innerText.length).trim();
     }

     navigator.clipboard.writeText(txt).then(function() {
         // Success - set the text to indicate it,
         // then set it back after 2 seconds.
         var span = pre.querySelector("button span");
         if (span) {
             var oldText = span.innerText;
             span.innerText = "COPIED!";
             setTimeout(function() {
                 span.innerText = oldText;
             }, 2000);
         }
     }, function() {
     });
 }

  (function () {
      // Add copy buttons to all the codeblocks.
      var codeblocks = document.querySelectorAll('div > pre');

      var button = document.createElement('button');
      var span = document.createElement('span');
      span.innerText = "COPY";
      button.appendChild(span);

      for (var i of codeblocks) {
          var newButton = button.cloneNode(true);
          newButton.addEventListener('click', copy_to_clipboard);
          i.appendChild(newButton);
      }
  })();
</script>

  </body>
</html>