/usr/share/doc/fish/faq.html is in fish-common 2.4.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<title>fish: Frequently asked questions</title>
<link href="user_doc.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top" class="qindex"><!-- do not close this div here, it is closed by doxygen! -->
<a href="http://fishshell.com/"><code>fish</code> shell</a>
|
<a href="index.html">Documentation</a>
|
<a href="tutorial.html">Tutorial</a>
|
<a href="design.html">Design</a>
|
<a href="commands.html">Commands</a>
|
<a href="faq.html">FAQ</a>
|
<a href="license.html">License</a>
<!-- Generated by Doxygen 1.8.12 -->
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Frequently asked questions </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock">
<div class="fish_left_bar">
<div class="logo"></div>
<div class="menu faq_menu">
<ul>
<li><a href="#faq-envvar">How do I set or clear an environment variable?</a></li>
<li><a href="#faq-login-cmd">How do I run a command every login? What's fish's equivalent to <code>.bashrc</code>?</a></li>
<li><a href="#faq-prompt">How do I set my prompt?</a></li>
<li><a href="#faq-cmd-history">How do I run a command from history?</a></li>
<li><a href="#faq-subcommand">How do I run a subcommand? The backtick doesn't work!</a></li>
<li><a href="#faq-exit-status">How do I get the exit status of a command?</a></li>
<li><a href="#faq-single-env">How do I set an environment variable for just one command?</a></li>
<li><a href="#faq-customize-colors">How do I customize my syntax highlighting colors?</a></li>
<li><a href="#faq-update-manpage-completions">How do I update man page completions?</a></li>
<li><a href="#faq-cwd-symlink">Why does cd, pwd and other fish commands always resolve symlinked directories to their canonical path?</a></li>
<li><a href="#faq-cd-implicit">I accidentally entered a directory path and fish changed directory. What happened?</a></li>
<li><a href="#faq-open">The open command doesn't work.</a></li>
<li><a href="#faq-default">How do I make fish my default shell?</a></li>
<li><a href="#faq-titlebar">I'm seeing weird output before each prompt when using screen. What's wrong?</a></li>
<li><a href="#faq-greeting">How do I change the greeting message?</a></li>
<li><a href="#faq-history">Why doesn't history substitution ("!$" etc.) work?</a></li>
<li><a href="#faq-uninstalling">How do I uninstall fish?</a></li>
<li><a href="#faq-third-party">Where can I find extra tools for fish?</a></li>
</ul>
</div>
</div>
<div class="faq fish_right_bar">
<h1 class="interior_title">Frequently Asked Questions</h1>
<h1><a class="anchor" id="faq-envvar"></a>
How do I set or clear an environment variable?</h1>
<p>Use the <a href="commands.html#set"><code>set</code></a> command:</p>
<pre class="fish cli-dark">
<span class="command">set</span> <span class="argument">-x</span> <span class="argument">key</span> <span class="argument">value</span>
<span class="command">set</span> <span class="argument">-e</span> <span class="argument">key</span>
</pre><h1><a class="anchor" id="faq-login-cmd"></a>
How do I run a command every login? What's fish's equivalent to .bashrc?</h1>
<p>Edit the file <code>~/.config/fish/config.fish</code>, creating it if it does not exist (Note the leading period).</p>
<hr/>
<h1><a class="anchor" id="faq-prompt"></a>
How do I set my prompt?</h1>
<p>The prompt is the output of the <code>fish_prompt</code> function. Put it in <code>~/.config/fish/functions/fish_prompt.fish</code>. For example, a simple prompt is:</p>
<pre class="fish cli-dark">
<span class="command">function</span> <span class="argument">fish_prompt</span>
<span class="command">set_color</span> <span class="variable"><span class="operator">$</span>fish_color_cwd</span>
<span class="command">echo</span> <span class="argument">-n</span> <span class="operator">(</span><span class="command">prompt_pwd</span><span class="operator">)</span>
<span class="command">set_color</span> <span class="argument">normal</span>
<span class="command">echo</span> <span class="argument">-n</span> <span class="string">' > '</span>
<span class="command">end</span>
</pre><p>You can also use the Web configuration tool, <a href="commands.html#fish_config"><code>fish_config</code></a>, to preview and choose from a gallery of sample prompts.</p>
<h1><a class="anchor" id="faq-cmd-history"></a>
How do I run a command from history?</h1>
<p>Type some part of the command, and then hit the <span class="key"><b>↑</b></span> or <span class="key"><b>↓</b></span> arrow keys to navigate through history matches.</p>
<hr/>
<h1><a class="anchor" id="faq-subcommand"></a>
How do I run a subcommand? The backtick doesn't work!</h1>
<p><code>fish</code> uses parentheses for subcommands. For example:</p>
<pre class="fish cli-dark">
<span class="command">for</span> <span class="argument">i</span> <span class="command">in</span> <span class="operator">(</span><span class="binary">ls</span><span class="operator">)</span>
<span class="command">echo</span> <span class="variable"><span class="operator">$</span>i</span>
<span class="command">end</span>
</pre><h1><a class="anchor" id="faq-exit-status"></a>
How do I get the exit status of a command?</h1>
<p>Use the <code>$status</code> variable. This replaces the <code>$?</code> variable used in some other shells.</p>
<hr/>
<h1><a class="anchor" id="faq-single-env"></a>
How do I set an environment variable for just one command?</h1>
<p><em><code>SOME_VAR=1 command</code> produces an error: <code>Unknown command "SOME_VAR=1"</code>.</em></p>
<p>Use the <code>env</code> command.</p>
<p><code>env SOME_VAR=1 command</code></p>
<p>You can also declare a local variable in a block:</p>
<pre class="fish cli-dark">
<span class="command">begin</span>
<span class="command">set</span> <span class="argument">-lx</span> <span class="argument">SOME_VAR</span> <span class="argument">1</span>
<span class="command">command</span>
<span class="command">end</span>
</pre><h1><a class="anchor" id="faq-customize-colors"></a>
How do I customize my syntax highlighting colors?</h1>
<p>Use the web configuration tool, <a href="commands.html#fish_config"><code>fish_config</code></a>, or alter the <a href="index.html#variables-color"><code>fish_color</code> family of environment variables</a>.</p>
<hr/>
<h1><a class="anchor" id="faq-update-manpage-completions"></a>
How do I update man page completions?</h1>
<p>Use the <a href="commands.html#fish_update_completions"><code>fish_update_completions</code></a> command.</p>
<hr/>
<h1><a class="anchor" id="faq-cwd-symlink"></a>
Why does cd, $PWD and and various fish commands always resolve symlinked directories to their canonical path?</h1>
<p><em>For example if <code>~/images</code> is a symlink to <code>~/Documents/Images</code>, if I write '<code>cd images</code>', my prompt will say <code>~/Documents/Images</code>, not <code>~/images</code>.</em></p>
<p>Because it is impossible to consistently keep symlinked directories unresolved. It is indeed possible to do this partially, and many other shells do so. But it was felt there are enough serious corner cases that this is a bad idea. Most such issues have to do with how '..' is handled, and are variations of the following example:</p>
<p>Writing <code>cd images; ls ..</code> given the above directory structure would list the contents of <code>~/Documents</code>, not of <code>~</code>, even though using <code>cd ..</code> changes the current directory to <code>~</code>, and the prompt, the <code>pwd</code> builtin and many other directory information sources suggest that the current directory is <code>~/images</code> and its parent is <code>~</code>. This issue is not possible to fix without either making every single command into a builtin, breaking Unix semantics or implementing kludges in every single command. This issue can also be seen when doing IO redirection.</p>
<p>Another related issue is that many programs that operate on recursive directory trees, like the find command, silently ignore symlinked directories. For example, <code>find $PWD -name '*.txt'</code> silently fails in shells that don't resolve symlinked paths.</p>
<hr/>
<h1><a class="anchor" id="faq-cd-implicit"></a>
I accidentally entered a directory path and fish changed directory. What happened?</h1>
<p>If fish is unable to locate a command with a given name, and it starts with '<code>.</code>', '<code>/</code>' or '<code>~</code>', fish will test if a directory of that name exists. If it does, it is implicitly assumed that you want to change working directory. For example, the fastest way to switch to your home directory is to simply press <code>~</code> and enter.</p>
<hr/>
<h1><a class="anchor" id="faq-open"></a>
The open command doesn't work.</h1>
<p>The <code>open</code> command uses the MIME type database and the <code>.desktop</code> files used by Gnome and KDE to identify filetypes and default actions. If at least one of these environments is installed, but the open command is not working, this probably means that the relevant files are installed in a non-standard location. Consider <a href="index.html#more-help">asking for more help</a>.</p>
<hr/>
<h1><a class="anchor" id="faq-default"></a>
How do I make fish my default shell?</h1>
<p>If you installed fish manually (e.g. by compiling it, not by using a package manager), you first need to add fish to the list of shells by executing the following command (assuming you installed fish in /usr/local):</p>
<pre class="fish cli-dark">
<span class="command">echo</span> <span class="path">/usr/local/bin/fish</span> <span class="redirect">|</span> <span class="binary">sudo</span> <span class="argument">tee</span> <span class="argument">-a</span> <span class="path">/etc/shells</span>
</pre><p>If you installed a prepackaged version of fish, the package manager should have already done this for you.</p>
<p>In order to change your default shell, type:</p>
<pre class="fish cli-dark">
<span class="binary">chsh</span> <span class="argument">-s</span> <span class="path">/usr/local/bin/fish</span>
</pre><p>You may need to adjust the above path to e.g. <code>/usr/bin/fish</code>. Use the command <code>which fish</code> if you are unsure of where fish is installed.</p>
<p>Unfortunately, there is no way to make the changes take effect at once. You will need to log out and back in again.</p>
<hr/>
<h1><a class="anchor" id="faq-titlebar"></a>
I'm seeing weird output before each prompt when using screen. What's wrong?</h1>
<p>Quick answer:</p>
<p>Run the following command in fish:</p>
<pre class="fish cli-dark">
<span class="command">function</span> <span class="argument">fish_title</span><span class="redirect">;</span> <span class="command">end</span><span class="redirect">;</span> <span class="command">funcsave</span> <span class="argument">fish_title</span>
</pre><p>Problem solved!</p>
<p>The long answer:</p>
<p>Fish is trying to set the titlebar message of your terminal. While screen itself supports this feature, your terminal does not. Unfortunately, when the underlying terminal doesn't support setting the titlebar, screen simply passes through the escape codes and text to the underlying terminal instead of ignoring them. It is impossible to detect and resolve this problem from inside fish since fish has no way of knowing what the underlying terminal type is. For now, the only way to fix this is to unset the titlebar message, as suggested above.</p>
<p>Note that fish has a default titlebar message, which will be used if the fish_title function is undefined. So simply unsetting the fish_title function will not work.</p>
<hr/>
<h1><a class="anchor" id="faq-greeting"></a>
How do I change the greeting message?</h1>
<p>Change the value of the variable <code>fish_greeting</code> or create a <code>fish_greeting</code> function. For example, to remove the greeting use:</p>
<pre class="fish cli-dark">
<span class="command">set</span> <span class="argument">fish_greeting</span>
</pre><h1><a class="anchor" id="faq-history"></a>
Why doesn't history substitution ("!$" etc.) work?</h1>
<p>Because history substitution is an awkward interface that was invented before interactive line editing was even possible. Fish drops it in favor of perfecting the interactive history recall interface. Switching requires a small change of habits: if you want to modify an old line/word, first recall it, then edit. E.g. don't type "sudo !!" - first press Up, then Home, then type "sudo ".</p>
<p>Fish history recall is very simple yet effective:</p>
<ul>
<li>As in any modern shell, the Up arrow, <span class="key"><b>↑</b></span> recalls whole lines, starting from the last line executed. A single press replaces "!!", later presses replace "!-3" and the like.<ul>
<li>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 constrain the recall to lines that include this text, and you will get to the line you want much faster. This replaces "!vi", "!?bar.c" and the like.</li>
</ul>
</li>
<li><span class="key"><em>Alt</em><span>-</span><b>↑</b></span> recalls individual arguments, starting from the last argument in the last line executed. A single press replaces "!$", later presses replace "!!:4" and the like.<ul>
<li>If the argument you want is far back in history (e.g. 2 lines back - that's a lot of words!), type any part of it and then press <span class="key"><em>Alt</em><span>-</span><b>↑</b></span>. This will show only arguments containing that part and you will get what you want much faster. Try it out, this is very convenient!</li>
<li>If you want to reuse several arguments from the same line ("!!:3*" and the like), consider recalling the whole line and removing what you don't need (<span class="key"><em>Alt</em><span>-</span><b>D</b></span> and <span class="key"><em>Alt</em><span>-</span><b>Backspace</b></span> are your friends).</li>
</ul>
</li>
</ul>
<p>See <a href="index.html#editor">documentation</a> for more details about line editing in fish.</p>
<hr/>
<h1><a class="anchor" id="faq-uninstalling"></a>
Uninstalling fish</h1>
<p>Should you wish to uninstall fish, first ensure fish is not set as your shell. Run <code>chsh -s /bin/bash</code> if you are not sure.</p>
<p>Next, do the following (assuming fish was installed to /usr/local):</p>
<pre class="fish cli-dark">
<span class="binary">rm</span> <span class="argument">-Rf</span> <span class="path">/usr/local/etc/fish</span> <span class="path">/usr/local/share/fish</span> <span class="path">~/.config/fish</span>
<span class="binary">rm</span> <span class="path">/usr/local/share/man/man1/fish*.1</span>
<span class="command">cd</span> <span class="path">/usr/local/bin</span>
<span class="binary">rm</span> <span class="argument">-f</span> <span class="argument">fish</span> <span class="argument">fish_indent</span>
</pre><hr/>
<h1><a class="anchor" id="faq-reserved-chars"></a>
Unicode private-use characters reserved by fish</h1>
<p>Fish reserves the <a href="http://www.unicode.org/faq/private_use.html">Unicode private-use character range</a> from U+F600 thru U+F73F for internal use. Any attempt to feed characters in that range to fish will result in them being replaced by the Unicode "replacement character" U+FFFD. This includes both interactive input as well as any file read by fish (but not programs run by fish).</p>
<hr/>
<h1><a class="anchor" id="faq-third-party"></a>
Where can I find extra tools for fish?</h1>
<p>The fish user community extends fish in unique and useful ways via scripts that aren't always appropriate for bundling with the fish package. Typically because they solve a niche problem unlikely to appeal to a broad audience. You can find those extensions, including prompts, themes and useful functions, in various third-party repositories. These include:</p>
<ul>
<li><a href="https://github.com/fisherman/fisherman">Fisherman</a></li>
<li><a href="https://github.com/tuvistavie/fundle">Fundle</a></li>
<li><a href="https://github.com/oh-my-fish/oh-my-fish">Oh My Fish</a></li>
<li><a href="https://github.com/justinmayer/tacklebox">Tacklebox</a></li>
</ul>
<p>This is not an exhaustive list and the fish project has no opinion regarding the merits of the repositories listed above or the scripts found therein. We mention these only because you may find within them a solution to a need you have such as supporting the <code>&&</code> and <code>||</code> operators or improved integration with other tools that you use.</p>
</div>
</div></div><!-- contents -->
</body>
</html>
|