When I type ls in home directory it shows names of directories with suffix / : Desktop/ examples.desktop Jupyter notebook/ peda/ Public/ and so on. So how can I fix it?


I use fish shell, type ls:

ls is a function with definition
function ls --description 'List contents of directory'
    set -l param --color=auto
    if isatty 1
        set param $param --indicator-style=classify
    command ls $param $argv
  • 3
    You probably have ls aliased to either ls -F or ls -p – steeldriver Mar 7 '17 at 23:08
  • ^ What steeldriver said. Run type ls to find out. – wjandrea Mar 7 '17 at 23:41
  • @wjandrea edited! – Tehada Mar 7 '17 at 23:45
  • @steeldriver may be I should find this alias in config of fish? – Tehada Mar 7 '17 at 23:46
  • @Tehada I don't use Fish, but --indicator-style=classify is the relevant bit for sure. – wjandrea Mar 7 '17 at 23:47

This is a system function installed from the fish-common package in /usr/share/functions/ls.fish.

I can see three options for disabling the system function:

  1. Delete /usr/share/functions/ls.fish. (Not recommended.) It will probably be recreated whenever the fish-common package is updated.

  2. Disable it once by running functions --erase ls. Disable it automatically when your shell is initialized by adding that to your ~/.config/fish/config.fish file. (--erase can be abbreviated -e.)

  3. Override it locally, by creating your own function of the same name. Just type in a new function with the same name and your own preferences. The funcsave command afterward saves the function in ~/.config/fish/functions/ls.fish. (Note this example changes the description string and the parameter added in the if block):

    user@host ~> function ls --description 'List directory (local override)'
                    set -l param --color=auto
                    if isatty 1
                        set param $param --quoting-style=literal
                    command ls $param $argv
    user@host ~> funcsave ls

I'm fairly new to fish, so there may be other ways to do what you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.