1497 \htmlonly </div> \endhtmlonly
1553 font-weight: normal;
1592 line-height: normal;
1596 font-family:
"Trebuchet MS", Verdana, Arial, sans-serif;
1597 list-style-image: none;
1598 list-style-position: outside;
1599 list-style-type: none;
1606 text-decoration: none;
1611 .tutorial_nav .chevron {
1612 font-family: Times,
"Times New Roman";
1619 .no_shadow > li > a,
1624 .nav > li > a:hover {
1625 text-decoration: none;
1626 background-color: inherit;
1647 -moz-box-shadow: -5px 0px 5px -2px black;
1648 -webkit-box-shadow: -5px 0px 5px -2px black;
1649 box-shadow: -5px 0px 5px -2px black;
1652 padding: 1px 25px 10px 10px;
1655 background-color: white;
1663 h1, h2, h3 { color: #1E335E; }
1666 padding-bottom: 10px;
1667 border-bottom: 1px solid #AAA;
1670 h1 { font-size: 150%; }
1671 h2 { font-size: 135%; }
1672 h3 { font-size: 110%; }
1679 <div
class=
"fish_left_bar fish_left_medium">
1680 <div
class=
"tutorial_nav">
1681 <ul
class=
"nav no_shadow">
1682 <li><a href=
"#tut_why_fish"><span
class=
"chevron">›</span> Why fish?</a></li>
1683 <li><a href=
"#tut_learning_Fish"><span
class=
"chevron">›</span> Learning fish</a></li>
1684 <li><a href=
"#tut_running_commands"><span
class=
"chevron">›</span> Running Commands</a></li>
1685 <li><a href=
"#tut_getting_help"><span
class=
"chevron">›</span> Getting Help</a></li>
1686 <li><a href=
"#tut_syntax_highlighting"><span
class=
"chevron">›</span> Syntax Highlighting</a></li>
1687 <li><a href=
"#tut_wildcards"><span
class=
"chevron">›</span> Wildcards</a></li>
1688 <li><a href=
"#tut_pipes_and_redirections"><span
class=
"chevron">›</span> Pipes and Redirections</a></li>
1689 <li><a href=
"#tut_autosuggestions"><span
class=
"chevron">›</span> Autosuggestions</a></li>
1690 <li><a href=
"#tut_tab_completions"><span
class=
"chevron">›</span> Tab Completions</a></li>
1691 <li><a href=
"#tut_variables"><span
class=
"chevron">›</span> Variables</a></li>
1692 <li><a href=
"#tut_exit_status"><span
class=
"chevron">›</span> Exit Status</a></li>
1693 <li><a href=
"#tut_exports"><span
class=
"chevron">›</span> Environment Variables</a></li>
1694 <li><a href=
"#tut_lists"><span
class=
"chevron">›</span> Lists</a></li>
1695 <li><a href=
"#tut_command_substitutions"><span
class=
"chevron">›</span> Command Substitutions</a></li>
1696 <li><a href=
"#tut_combiners"><span
class=
"chevron">›</span> Combiners (And, Or, Not)</a></li>
1697 <li><a href=
"#tut_conditionals"><span
class=
"chevron">›</span> Conditionals (If, Else, Switch)</a></li>
1698 <li><a href=
"#tut_functions"><span
class=
"chevron">›</span> Functions</a></li>
1699 <li><a href=
"#tut_loops"><span
class=
"chevron">›</span> Loops</a></li>
1700 <li><a href=
"#tut_prompt"><span
class=
"chevron">›</span> Prompt</a></li>
1701 <li><a href=
"#tut_startup"><span
class=
"chevron">›</span> Startup</a></li>
1706 <div
class=
"fish_right_bar fish_right_medium">
1708 <h1
class=
"interior_title">fish tutorial</h1>
1710 <h2
id=
"tut_why_fish">Why fish?</h2>
1712 <p>fish is a fully-equipped command line shell (like bash or zsh) that is smart and user-friendly. fish supports powerful features like syntax highlighting, autosuggestions, and tab completions that just work, with nothing to learn or configure.
1714 <p>If you want to make your command line more productive, more useful, and more fun, without learning a bunch of arcane syntax and configuration options, then fish might be just what you
're looking for!
1716 <h2 id="tut_learning_Fish">Learning fish</h2>
1718 <p>This tutorial assumes a basic understanding of command line shells and Unix commands, and that you have a working copy of fish.
1720 <p>If you have a strong understanding of other shells, and want to know what fish does differently, search for the magic phrase <i>unlike other shells</i>, which is used to call out important differences.
1722 <p>When you start fish, you should see this:
1725 Welcome to fish, the friendly interactive shell
1726 Type <em>help</em> for instructions on how to use fish
1727 you@hostname <em>~</em>>
1730 <p>fish comes with a default prompt that shows your username, hostname, and working directory. You'll see <a href=
"#tut_prompt">how to change your prompt</a> further down. From now on, we
'll pretend your prompt is just a '>
' to save space.
1732 <h2 id="tut_running_commands">Running Commands</h2>
1734 <p>fish runs commands like other shells: you type a command, followed by its arguments. Spaces are separators:
1737 > <b>echo</b> <i>hello world</i>
1741 You can include a literal space in an argument with a backslash, or by using single or double quotes:
1744 > <b>mkdir</b> <i>My\ Files</i>
1745 > <b>cp</b> <i>~/Some\ File</i> <i class=quote>'My Files
'</i>
1746 > <b>ls</b> <i class=quote>"My Files"</i>
1750 Commands can be chained with semicolons.
1752 <h2 id="tut_getting_help">Getting Help</h2>
1754 fish has excellent help and man pages. Run <tt>help</tt> to open help in a web browser, and <tt>man</tt> to open it in a man page. You can also ask for help with a specific command, for example, <tt>help set</tt> to open in a web browser, or <tt>man set</tt> to see it in the terminal.
1757 > <b>man</b> <i>set</i>
1758 set - handle environment variables
1762 <h2 id="tut_syntax_highlighting">Syntax Highlighting</h2>
1763 You'll quickly notice that fish performs syntax highlighting as you type. Invalid commands are colored red by
default:
1766 > <b
class=
"error">/bin/mkd</b>
1769 A command may be invalid because it does not exist, or refers to a file that you cannot execute. When the command becomes valid, it is shown in a different color:
1775 fish will underline valid file paths as you type them:
1778 > <b>cat</b> <i><span style=
"text-decoration: underline">~/somef<u>i</u></span></i>
1781 <p>This tells you that there exists a file that starts with
'<tt>somefi</tt>', which is useful feedback as you type.
1783 <p>These colors, and many more, can be changed by running <tt>fish_config</tt>, or by modifying variables directly.
1785 <h2
id=
"tut_wildcards">Wildcards</h2>
1787 fish supports the familiar wildcard *. To list all JPEG files:
1790 > <b>ls</b> <i>*.jpg</i>
1796 <p>You can include multiple wildcards:
1799 > <b>ls</b> <i>l*.p*</i>
1804 <p>Especially powerful is the <i>recursive wildcard</i> ** which searches directories recursively: