Very often I find myself looking through directories using 'ls', then when I find the file I want, I use 'less' to look at the file.
So for example to find a mysql log file I might type
ls /var
then:
ls /var/log/
and then:
ls /var/log/mysql
and finally:
less /var/log/mysql/mysql.log
(its a bit of a contrived example, but hopefully you know what I am doing)
I find it annoying that I need to decide if the command should be ls or less. Why can't 'less' determine if it has been given a directory and act as 'ls' ?
Is there a command that I can use instead of less that will act as ls or less depending on the file type ? Or is there a common alias that people use ?
less
are you using? Recent versions (mine is 444) do exactly what you want automatically. – depquid Jan 2 '14 at 17:16