1540 \htmlonly </div> \endhtmlonly
1596 font-weight: normal;
1635 line-height: normal;
1639 font-family:
"Trebuchet MS", Verdana, Arial, sans-serif;
1640 list-style-image: none;
1641 list-style-position: outside;
1642 list-style-type: none;
1649 text-decoration: none;
1654 .tutorial_nav .chevron {
1655 font-family: Times,
"Times New Roman";
1662 .no_shadow > li > a,
1667 .nav > li > a:hover {
1668 text-decoration: none;
1669 background-color: inherit;
1690 -moz-box-shadow: -5px 0px 5px -2px black;
1691 -webkit-box-shadow: -5px 0px 5px -2px black;
1692 box-shadow: -5px 0px 5px -2px black;
1695 padding: 1px 25px 10px 10px;
1698 background-color: white;
1706 h1, h2, h3 { color: #1E335E; }
1709 padding-bottom: 10px;
1710 border-bottom: 1px solid #AAA;
1713 h1 { font-size: 150%; }
1714 h2 { font-size: 135%; }
1715 h3 { font-size: 110%; }
1722 <div
class=
"fish_left_bar fish_left_medium">
1723 <div
class=
"tutorial_nav">
1724 <ul
class=
"nav no_shadow">
1725 <li><a href=
"#tut_why_fish"><span
class=
"chevron">›</span> Why fish?</a></li>
1726 <li><a href=
"#tut_learning_Fish"><span
class=
"chevron">›</span> Learning fish</a></li>
1727 <li><a href=
"#tut_running_commands"><span
class=
"chevron">›</span> Running Commands</a></li>
1728 <li><a href=
"#tut_getting_help"><span
class=
"chevron">›</span> Getting Help</a></li>
1729 <li><a href=
"#tut_syntax_highlighting"><span
class=
"chevron">›</span> Syntax Highlighting</a></li>
1730 <li><a href=
"#tut_wildcards"><span
class=
"chevron">›</span> Wildcards</a></li>
1731 <li><a href=
"#tut_pipes_and_redirections"><span
class=
"chevron">›</span> Pipes and Redirections</a></li>
1732 <li><a href=
"#tut_autosuggestions"><span
class=
"chevron">›</span> Autosuggestions</a></li>
1733 <li><a href=
"#tut_tab_completions"><span
class=
"chevron">›</span> Tab Completions</a></li>
1734 <li><a href=
"#tut_variables"><span
class=
"chevron">›</span> Variables</a></li>
1735 <li><a href=
"#tut_exit_status"><span
class=
"chevron">›</span> Exit Status</a></li>
1736 <li><a href=
"#tut_exports"><span
class=
"chevron">›</span> Shell Variables</a></li>
1737 <li><a href=
"#tut_lists"><span
class=
"chevron">›</span> Lists</a></li>
1738 <li><a href=
"#tut_command_substitutions"><span
class=
"chevron">›</span> Command Substitutions</a></li>
1739 <li><a href=
"#tut_combiners"><span
class=
"chevron">›</span> Combiners (And, Or, Not)</a></li>
1740 <li><a href=
"#tut_conditionals"><span
class=
"chevron">›</span> Conditionals (If, Else, Switch)</a></li>
1741 <li><a href=
"#tut_functions"><span
class=
"chevron">›</span> Functions</a></li>
1742 <li><a href=
"#tut_loops"><span
class=
"chevron">›</span> Loops</a></li>
1743 <li><a href=
"#tut_prompt"><span
class=
"chevron">›</span> Prompt</a></li>
1744 <li><a href=
"#tut_startup"><span
class=
"chevron">›</span> Startup</a></li>
1749 <div
class=
"fish_right_bar fish_right_medium">
1751 <h1
class=
"interior_title">fish tutorial</h1>
1753 <h2
id=
"tut_why_fish">Why fish?</h2>
1755 <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.
1757 <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!
1759 <h2 id="tut_learning_Fish">Learning fish</h2>
1761 <p>This tutorial assumes a basic understanding of command line shells and Unix commands, and that you have a working copy of fish.
1763 <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.
1765 <p>When you start fish, you should see this:
1768 Welcome to fish, the friendly interactive shell
1769 Type <em>help</em> for instructions on how to use fish
1770 you@hostname <em>~</em>>
1773 <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.
1775 <h2 id="tut_running_commands">Running Commands</h2>
1777 <p>fish runs commands like other shells: you type a command, followed by its arguments. Spaces are separators:
1780 > <b>echo</b> <i>hello world</i>
1784 You can include a literal space in an argument with a backslash, or by using single or double quotes:
1787 > <b>mkdir</b> <i>My\ Files</i>
1788 > <b>cp</b> <i>~/Some\ File</i> <i class=quote>'My Files
'</i>
1789 > <b>ls</b> <i class=quote>"My Files"</i>
1793 Commands can be chained with semicolons.
1795 <h2 id="tut_getting_help">Getting Help</h2>
1797 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.
1800 > <b>man</b> <i>set</i>
1801 set - handle shell variables
1805 <h2 id="tut_syntax_highlighting">Syntax Highlighting</h2>
1806 You'll quickly notice that fish performs syntax highlighting as you type. Invalid commands are colored red by
default:
1809 > <b
class=
"error">/bin/mkd</b>
1812 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:
1818 fish will underline valid file paths as you type them:
1821 > <b>cat</b> <i><span style=
"text-decoration: underline">~/somef<u>i</u></span></i>
1824 <p>This tells you that there exists a file that starts with
'<tt>somefi</tt>', which is useful feedback as you type.
1826 <p>These colors, and many more, can be changed by running <tt>fish_config</tt>, or by modifying variables directly.
1828 <h2
id=
"tut_wildcards">Wildcards</h2>
1830 fish supports the familiar wildcard *. To list all JPEG files:
1833 > <b>ls</b> <i>*.jpg</i>
1839 <p>You can include multiple wildcards:
1842 > <b>ls</b> <i>l*.p*</i>
1847 <p>Especially powerful is the <i>recursive wildcard</i> ** which searches directories recursively: