LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-27-2015, 10:16 PM   #1
iaef
LQ Newbie
 
Registered: Aug 2015
Posts: 4

Rep: Reputation: Disabled
ls showing dotfiles in bash


I am completely new to this shell things, so bear with me on a totally simple question.

I somehow managed to change something in my terminal window, because the 'ls' command shows me all files (including the so called dotfiles) as if I have used 'ls -a'.

I have searched on many places on the Internet, but the most I have found are some exotic manners of putting an alias on .bashrc to make 'ls' behave as 'ls -a'.

I have checked my .bashrc and there is no such alias.

What do I have to do to use 'ls' and make it not show dotfiles.
 
Old 08-28-2015, 02:27 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529
Quote:
Originally Posted by iaef View Post
I somehow managed to change something in my terminal window
Does 'history; type ls; grep ls -r ~/.bash*' /etc/bash* /etc/profile*; ls -altr /etc/bash* /etc/profile*' show something that looks like an edit or echo command or files recently edited to look at? Does '\ls;' or 'unalias ls; ls;' show ls usage as you want?

Last edited by unSpawn; 08-28-2015 at 02:30 AM.
 
1 members found this post helpful.
Old 08-28-2015, 04:22 AM   #3
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
also check type ls and which ls to find out what was really executed
 
1 members found this post helpful.
Old 08-28-2015, 04:35 AM   #4
fatmac
Senior Member
 
Registered: Sep 2011
Location: Surrey/Hants Border, UK
Distribution: BSD & Linux - As long as they are Lightweight
Posts: 1,491

Rep: Reputation: Disabled
Welcome aboard.

Did you run ls from sudo or as the root user(?), (as it will normally show all files, compared to a regular user).
 
Old 08-28-2015, 10:18 AM   #5
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,159
Blog Entries: 10

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
Quote:
Originally Posted by pan64 View Post
also check type ls and which ls to find out what was really executed
+1 for "type ls".
Prolly aliased and this will show it.
To not use the alias temporarily, use
Code:
\ls
or set another.
I use
Code:
ls -lF
(no dot files).
 
Old 08-28-2015, 11:36 AM   #6
iaef
LQ Newbie
 
Registered: Aug 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
Step by step

First of all, thank you to everyone who helped me... your insights are really valuable as I still find a little alien this shell things.

Quote:
Originally Posted by unSpawn View Post
Does 'history; type ls; grep ls -r ~/.bash*' /etc/bash* /etc/profile*; ls -altr /etc/bash* /etc/profile*' show something that looks like an edit or echo command or files recently edited to look at? Does '\ls;' or 'unalias ls; ls;' show ls usage as you want?
@unSpawn : 'type ls' showed me: ls is aliased to /bin/ls $LS_OPTIONS'
So I used: 'echo $LS_OPTIONS' and found: '--color=tty -F -a -b -T 0' where I believe '-a' is the culprit. So now, I am wondering where this could be defined.

I also tried '\ls' and I got a plain listing.

Last edited by iaef; 08-28-2015 at 11:38 AM.
 
Old 08-28-2015, 01:07 PM   #7
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,159
Blog Entries: 10

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
good job, so far.
A temp 'fix' is to add to your ~/.bashrc a new ls alias
Code:
alias ls="ls -lF"
and restart your terminal app.
 
Old 08-28-2015, 01:26 PM   #8
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 5,999

Rep: Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611
I would be looking in ~/.bashrc so see whether $LS_OPTIONS is defined there....
However! That is on my system which Iam familiar with. I think it might help if you tell us which distribution you are running and what changes have been made to it recently (updating packages, installing things, ...) since these things don't change themselves.
 
Old 08-28-2015, 06:45 PM   #9
iaef
LQ Newbie
 
Registered: Aug 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
Still feels hacky to me.

Quote:
Originally Posted by 273 View Post
I would be looking in ~/.bashrc so see whether $LS_OPTIONS is defined there....
However! That is on my system which Iam familiar with. I think it might help if you tell us which distribution you are running and what changes have been made to it recently (updating packages, installing things, ...) since these things don't change themselves.
I am at a Bluehost hosting account (I believe it's running CentOS) so I have no way to know if an update was made.

There is nothing in my .bashrc file that points to setting the $LS_OPTIONS or ls. Maybe I could just redefine it without '-a' but I was wondering if there could be a solution that felt less hacky.
 
Old 08-28-2015, 06:49 PM   #10
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
Try "grep -r LS_OPTIONS /etc/bash* /etc/profile*"

Those are the system-wide profiles that get sourced before your personal one, it could be getting in there.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Sourcing dotfiles. Lockywolf Slackware 27 05-06-2014 07:53 AM
[SOLVED] Dotfiles becoming undotted in 64-13.1 ahmadj Slackware 9 12-24-2010 02:50 PM
Archive dotfiles and dotdirectories only mjmwired Linux - Software 3 05-28-2008 11:01 PM
BASH script showing random behavior chatterbug89 Programming 12 07-19-2005 11:45 PM
Command line: How do I filter for dotfiles only? unamiccia Linux - General 21 04-14-2004 07:10 PM


All times are GMT -5. The time now is 02:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration