LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   bash ls (https://www.linuxquestions.org/questions/linux-newbie-8/bash-ls-584937/)

peteraiea 09-15-2007 03:56 PM

bash ls
 
ref- OS: Suse 9.2, running kde, bash

ls behavior
bash "ls" when run by root seems to default to "ls -a" form, showing every normally hidden file.

When run as a regular user, it runs normally, that is hiding the dotted files.

ls is normal under "sh" for the root user.

what's with that? thanks!

btmiller 09-15-2007 04:32 PM

Is ls aliased to ls -a for root? You can use the alias command to see all of the aliases that are currently set in the shell.

peteraiea 09-15-2007 05:40 PM

yest that's it
ls is aliased to /bin/ls $LS_OPTIONS

now hunting around for where LS_OPTIONS is set for root ...

thanks

farkus888 09-15-2007 08:42 PM

Code:

echo $LS_OPTIONS
will tell you what it is currently set to
Code:

LS_OPTIONS=whatever you want it to be, I like -l
Code:

export LS_OPTIONS
will set it for your current session.
as for changing it permanently try google. you could set your own options or remove the alias if you want it to behave "normally"

Scroggs79 09-16-2007 03:06 AM

The defaults are set in /etc/bashrc and they can be overridden in a .bashrc or .bash_profile file in the home directory.

colucix 09-16-2007 03:26 AM

On Suse the settings for bash are in /etc/bash.bahsrc where you can see the relevant part:
Code:

if test "$UID" = 0 ; then
    LS_OPTIONS="-A -N $LS_OPTIONS -T 0"
else
    LS_OPTIONS="-N $LS_OPTIONS -T 0"
fi

You can see the difference from root and users. However, as already suggested, you do better modify LS_OPTIONS in ~/.bashrc. Bye

peteraiea 09-17-2007 12:45 AM

that nails it.
In retro I could have tried a grep LS_ /etc/*rc which shows that csh also prescribes a set of ls defaults as well.

thanks all
P


All times are GMT -5. The time now is 08:20 AM.