2

I always use less -S instead of less, so I create an alias less="less -S".

But sometimes, I want to use less without -S. I tried something like les=less, but of course, it doesn't work because les calls the other alias less -S.

Is there a solution?

(Note: I don't want to just rename my less alias because when other people use my computer they always use less without -S and I find the output hard to read for some huge files.)

fedorqui
  • 275,237
  • 103
  • 548
  • 598
Liad
  • 340
  • 4
  • 15
  • 3
    To execute a command without using defined aliases start it with backslash `\less` or if you want your alias `alias les='\less'` – infotoni91 Dec 13 '16 at 10:53
  • ^^ or use `command less` e.g. `command less filename` or `some_cmd | command less`. With your case, you can use `alias les='command less'` – anishsane Dec 13 '16 at 10:55

1 Answers1

2

Set up the second alias so that it contains the full path to the less executable:

alias les='/usr/bin/less'

Alternatively, use a backslash to prevent alias expansion:

alias les='\less'
Tom Fenech
  • 72,334
  • 12
  • 107
  • 141