Fish shell question

I had never used the Fish shell before installing Garuda Linux, I had considered trying it but had never pulled the trigger. I like the customizations and prompt that is preconfigured with garuda.

One thing that's been really getting me incensed however is related to how ls works. I'm ok with some of the shortcuts like how ls by itself does ls -la, etc. etc. What bothers me is that when I try to do ls -lrt I get some error about the t switch needing some extra argument and so far I have not been able to figure out how to make ls -lrt work the way I would normally expect on any other unix/linux system. I want to see a list with the newest files last. I use this command all the time to easily tell which files are newest in a directory. I can't get it to work... I feel like such a newbie having to admit I'm having trouble with gasp the ls command.... lol...

I'm assuming there's something in fish shell causing this. I might be wrong, but hopefully someone on here will take pity on me and knows how to get ls -lrt to work like normal.

Can you post the output of the following command:

which ls

I suspect it is aliased to exa, which is a program like ls, except more colourful and it has different, non-standard options. If I'm correct, the solution is to either read the manual for exa and figure out how to accomplish what you want (my guess is you're looking for the option --sort=modified), or simply remove the alias from your fish configuration and use ls. I don't know exactly where fish stores aliases, because I don't use fish. Probably somewhere in .config/fish/functions

That's the reason I don't like fish. I had no trouble switching from bash to zsh, but fish is just too crazy. I also don't like using aliases to replace one command with another, unless they have identical command line options. It's confusing.

2 Likes

You are right, ls is alias for exa. The best thing to do is deleting the aliases from ~/.config/fish/config.fish if they dont fit you :slight_smile: (or to know what theyre doing)

4 Likes

Thanks @Kresimir and @dr460nf1r3. ls -lrsage is what I needed to get the equivalent of ls -lrt.

I had looked for alias' but had missed the one I really needed, I was only looking in my home directory, but I needed to be looking in the fish config directory.

Now that I know it was exa, I was able to look at the man pages and find out how to get the results I wanted. I hadn't ever heard of exa before, now that I read the man pages I'm going to stick with it for a while, seems like it might be useful. The problem I will have is that commands are hard coded into my fingers for things like ls so I might still have to switch back if there are many more surprises.

I like learning new commands, it just threw me off a bit when an old command didn't act the way I expected.

3 Likes

Since I was in the fish config anyway, I figured I might as well add in vi mode for the command line since I keep hitting esc+k all the time instead of up arrow. I like to use vi like commands to edit commands too. I never realized how much until I was using fish with it's default emacs style.

:grin:

fish_vi_key_bindings insert

Y'all know fish shell has a web based configuration interface eh?

In a terminal just type:

fish_config

5 Likes

Nope, I didn't know that @Bog thanks for sharing.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.