LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 09: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, 01:27 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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 01:30 AM.
 
1 members found this post helpful.
Old 08-28-2015, 03:22 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,918

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
also check type ls and which ls to find out what was really executed
 
1 members found this post helpful.
Old 08-28-2015, 03:35 AM   #4
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,501

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, 09:18 AM   #5
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
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, 10: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 10:38 AM.
 
Old 08-28-2015, 12:07 PM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
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, 12:26 PM   #8
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
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, 05: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, 05:49 PM   #10
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
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



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 06:53 AM
[SOLVED] Dotfiles becoming undotted in 64-13.1 ahmadj Slackware 9 12-24-2010 01:50 PM
Archive dotfiles and dotdirectories only mjmwired Linux - Software 3 05-28-2008 10:01 PM
BASH script showing random behavior chatterbug89 Programming 12 07-19-2005 10:45 PM
Command line: How do I filter for dotfiles only? unamiccia Linux - General 21 04-14-2004 06:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:19 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
Open Source Consulting | Domain Registration