linuxbashshellaliastcsh

Linux alias chain commands (can recursion be avoided?)


I've been looking around for ways to alias clear and ls into one command. Currently I've defined command x:

alias x="clear;ls"

Now is there any walkaround to avoid recursion and define:

 alias ls='clear;ls'

Solution

  • If you put a backslash before the command name, that will disable any aliases.

    alias ls='clear;\ls'
    

    Or, like Arnaud said, just use the full path for ls.