Linux Fish Read Command Does Not Work
Like many developers, I use a combination of Windows and Mac systems between my dwelling house and function. When using a panel, I tend to stick to the default settings. But I reached a breaking indicate while navigating through directories using Mac's stock Bash last. I starting looking into Zsh only still wasn't sold. Then I discovered a shell chosen "Fish," and my life has never been the aforementioned.
There may be plenty of fish in the sea, merely there aren't any quite similar this one.
What is Fish?
As the "sh" at the end of its name implies, Fish is a shell. Fish itself stands for Friendly Interactive SHell. Courtesy of Github, this convenient control line trounce was developed with a special emphasis on user experience.
So what sets Fish autonomously from its competition? For starters, information technology was developed more than recently than its counterparts (with an initial release in 2005). Information technology boasts powerful suggestion/auto-completion functionality, friendly syntax highlighting, and its GUI (browser)-based settings/assistance pages are usable directly out of the box, and then to speak.
Installation
Installing this shell couldn't be easier. If y'all're using Homebrew on a Mac, input the following control:
And you're done.
Installing with Linux is just a touch trickier — you'll want to be sure to grab the official repository considering using a distribution package manager to install it might saddle y'all with an older version instead. 。
Ubuntu users tin install using the official Personal Package Archives (PPA).
| 1 2 3 | $ sudo apt – add – repository ppa : fish – vanquish / release – 2 $ sudo apt – get update $ sudo apt – get install fish |
For instructions on how to install the shell on other OS's (including Debian), visit Fish'south website here.
Functionality
Suggestion and completion
Once installed, I recommend taking its suggestion and completion functionality for a spin.
From the dwelling house directory, endeavor irresolute directories (cd) by typing /usr into the command line.
The above screenshot demonstrates how the crush behaves when you input the commandcd /u. In the grayed-out text, yous can come across thatsr/ is suggested to complete the line. The shell provides a suggestion without us even having to hitting the tab key.
Simply what happens when some other file/folder shares the aforementioned proper noun up until a certain betoken? In this state of affairs, the possibilities are sorted in alphabetical order and the entry that falls first in that order will be suggested showtime.
Unfortunately, the odds that the proper name you're searching for will testify upwards in the suggestions are slim. But rest bodacious: Fish has a user-friendly feature bachelor for these kinds of situations.
This time, blazon in /s and hit the tab key twice.
As shown above, this action displays an overview of all directories that brainstorm with/s. You tin then use the tab key or pointer keys to move through each.
Until now, Fish's proffer functionality may have seemed more or less equal to Fustigate and other competitors, but here yous tin can see that this shell is unlike: it allows you to directly cull your directory from a list.Never again volition you have to go through the motions of looking at a list only to type out the rest of the characters anyways.
Fish also supports scanning through subdirectories using commands like {directory}/*/ .
And these user-friendly suggestions are bachelor in more than than merely path situations.Other Linux commands and functions are bachelor. For example, entering ssh followed by a space so the tab button yields a listing of potential connections registered in known_hosts, and entering mount returns the devices currently mounted.
It's no exaggeration to say that with these functions, practically annihilation you're looking for tin can be autocompleted using the tab central.
It should be noted that since the completion of subcommands and options are generated through the man of each application, completion functionality will not be compatible with software installed at any signal after Fish is installed. Instead, these updates must be pushed to Fish.
Thankfully, this can be accomplished fairly hands.
~> fish_update_completions
Just input the above command and you're gear up to go.
Syntax highlighting
Syntax highlighting is another feature bachelor 'straight out of the box.'
As an example, let's say you make a typo when typing in the discussion 'clear.' Manifestly, at that place's no corresponding command for 'clare,' then information technology will indicate the mistake using red letters as we meet below.
This role works for directory paths as well.
In the above example, '/usr' is mistyped as '/user.' Since there is no '/user' directory, Fish again returns an fault in ruddy letters.
Settings and help pages
Fish'southward settings page and help folio are both a piffling different. Type 'assist' into the terminal and a browser window will pop open up displaying a page that looks like this:
In addition to this page, Fish too hosts a help page that tin be accessed via a browser. However, I don't find this office necessary considering the document is just a copy of the documentation already located on the official site.
What really impresses me is another office: return to your Fish terminal and typefish_config. This will launch a web-based configuration interface where yous tin can change the color settings (theme), prompt settings, access command histories, and a slew of other features.
They even provide examples of different settings, including colors and prompts, that you tin can preview before committing.
Rather than calling information technology out for its convenience, it bears mentioning here that if you choose to specify new color settings using the control line, other colour changes—such as the color of typical letters in Fish'south environment variables, or the colour of letters in quotes as returned by commands such as repeat—must all be completed manually, ane by one.
Likewise in the prompt area, functions must be created and defined individually by the user, an activity which is, afterward all, best performed in a browser environment.
Package manager
Similarly to what npm is for node.js, Fish has a packet director all its own. At that place are several dissimilar ones to choose from, but the most popular is Fisher .
To install, simply input the following and information technology'southward ready to utilize:
| 1 | curl – Lo ~/ . config / fish / functions / fisher . fish — create – dirs https : //git.io/fisher |
There's no real need to install any packages because Fish is a complete package in and of itself. Simply it can be useful for installing themes not available by default.
Become Fish?
While Fish is incredibly like shooting fish in a barrel to use, users comfortable with Fustigate may yet hesitate to brand the switch for diverse reasons. Here are a few.
The script construction is different
The Fustigate structure is difficult to main while Fish is uniquely simple; interestingly, that is a source of hesitation for would-be converts.
For example, Fish does not utilize the && AND operator.
Theapt update && apt upgrade commands are a regular fixture of Debian-manner OS's, but attempting to use this command in Fish volition only return an mistake, as the && function is not recognized.
Instead, the equivalent Fish commands would beapt update; and apt upgrade. Because the commands are recognized individually due to the;, the ANDoperator is no longer necessary.
Nor does Fish utilize the || operator, instead requiring the or command after the end of a semicolon to combine commands. (Reminds you of Python, doesn't it?)
Moreover, conditionals such as if ~ fi also take their own constructions, which you can read more near hither.
fishrc doesn't be
Fish has no equivalent for the ~rc file that we've all come up to know and love. The settings that would unremarkably exist written to a ~rc file are instead located in the config.fish file at~/.config/fish.
This means the same Bash-fashion syntax can't be used, so you lot will have to use the previously written descriptors unique to Fish. Environment variable settings can be recorded in the config, and they can also exist set direct through the beat out itself.
My personal preference is to alter the settings via the shell, since the environment variables changed—yes, even from the shell—will persist from there.
As for how to change those settings, Fish eschews the consign function to instead use the gear up command to change settings.
From within config.fish write the post-obit:
| 1 | set PATH / usr / local / bin $ PATH |
If using the shell, write the following:
| 1 | gear up – U fish_user_paths / usr / local / bin $ fish_user_paths |
$fish_user_paths is one of Fish'south universal variables and is read before h$PATH.
In conclusion
As written at the beginning of this article, I personally prefer using default settings generally; the fact that the higher up functions can be used immediately with no configuration makes Fish an ideal choice for me.
However, due to the differences in the *rc file handling and script language, I can't recommend it to people who like getting down and muddy with zsh and .zshrc, as these differences might cause more trouble than its worth.
For those who adopt using programs 'straight out of the box' with minimal attention to customization or people who wish zsh's autocomplete part was just a little more robust, well… You could practice far worse than Fish.
Collaborate and bring your projects to life with Backlog
Source: https://backlog.com/blog/fish-command-line-shell-thats-got-hooked/
0 Response to "Linux Fish Read Command Does Not Work"
Post a Comment