# Can't see files from console



## jimheard (May 18, 2009)

I'm a newbie, so please forgive me if this is a dumb question.  I have a file (a downloaded package) that appears on my desktop when running a GUI (Xfce), but does not show up when I run LS from within the console (after changing to the Desktop folder).  Can anyone explain this?

Thanks.


----------



## Nokobon (May 18, 2009)

I dont't really know, but maybe you are in the wrong Desktop-folder?
Maybe of the wrong user?

And what's the output of

```
ls -l
```
?

Furthermore I would try to copy the file to another directory and see if you can find it there in the console.

Well, that are just some suggestions of another newbie


----------



## Beastie (May 18, 2009)

Maybe it's a dot file (i.e. hidden).
Try doing a `$ ls -a`.


----------



## Nokobon (May 18, 2009)

Beastie said:
			
		

> Maybe it's a dot file (i.e. hidden).
> Try doing a `$ ls -a`.



Doesn't show "ls" hidden files by default?


----------



## Beastie (May 18, 2009)

AFAIK, no, unless you're logged in as root.


----------



## Nokobon (May 18, 2009)

Beastie said:
			
		

> AFAIK, no, unless you're logged in as root.



Ah okay,
atm I just explore FreeBSD on a testing machine and use most of the time the root account. That explains why I see allways see the hidden files 

@jimheard:
Do you tried it as root or as a normal user?


----------



## tangram (May 18, 2009)

Beastie said:
			
		

> AFAIK, no, unless you're logged in as root.



Even as root `# ls` doesn't list hidden files. For that you need to run `# ls -a` or define an alias.

Run `# alias` to check root's alias or `% alias` to check your user's alias.

Alias can be set at any time or added to user's .cshrc if using t/csh shells.

For further information have a look at ls(1).


----------



## Nokobon (May 18, 2009)

So not all files with a dot at the beginning are hidden?


----------



## tangram (May 18, 2009)

All files beginning with a dot are hidden. If you want to list them run `% ls -a`.

Btw hidden =! not having permissions. But that's another story.


----------



## Nokobon (May 18, 2009)

tangram said:
			
		

> All files beginning with a dot are hidden. If you want to list them run `% ls -a`.
> 
> Btw hidden =! not having permissions. But that's another story.


When I log in as root i.e. in home directories I can sie dotted files with 
	
	



```
ls
```
Logged in as a normal user they really are hidden and I only see them with 
	
	



```
ls -a
```


----------



## tangram (May 18, 2009)

Most likely your root account as [cmd=]ls[/cmd] aliased to [cmd=]ls -a[/cmd].

And that's why I said it depends on the aliases that are setup for each user.

Run 


```
alias
```

as both root and user and see the differences.


----------



## Nokobon (May 18, 2009)

tangram said:
			
		

> And that's why I said it depends on the aliases that are setup for each user.


Okay. Sorry, I didn't know about aliases so far.
Thanks for that lightbulb.


----------



## tangram (May 18, 2009)

No prob. Alias are big time savers, especially when you repeat the same commands often.


----------



## Beastie (May 18, 2009)

tangram said:
			
		

> Even as root `# ls` doesn't list hidden files.


Yes, it does and I haven't changed anything in .cshrc.

ls() says:

```
-A    Include directory entries whose names begin with a dot (`.') except for . and ...  [u]Automatically set for the super-user unless -I is specified[/u].

-a    Include directory entries whose names begin with a dot (`.').
```
Both -a and -A do the same (including the "super-user" thing), -A just doesn't display current and parent directories.

The `% ls` command itself is not aliased by default for _any_ user, not even root.
However, there's `% la`, which is an alias for `% ls -a`.
All users, including root, have by default the same aliases in .cshrc (if they're using csh, which is the default shell for root).


----------



## SirDice (May 18, 2009)

Beastie said:
			
		

> Yes, it does and I haven't changed anything in .cshrc.


Confirm:


```
dice@maelcum:~>ls
backup             maelcum_backup.tgz
dice@maelcum:~>su -
Password:
root@maelcum:~#ls
.cshrc   .history .k5login .lesshst .login   .profile .ssh
```


----------



## tangram (May 18, 2009)

Hmm... weird.

I also confirmed with `# su -`: it does list hidden files.

The odd thing is that having a look at /usr/src/etc/root/dot.cshrc, there isn't an alias.


```
# cat /usr/src/etc/root/dot.cshrc

# $FreeBSD: src/etc/root/dot.cshrc,v 1.30.8.1 2009/04/15 03:14:26 kensmith Exp $
#
# .cshrc - csh resource script, read at beginning of execution by each shell
#
# see also csh(1), environ(7).
#

alias h         history 25
alias j         jobs -l
alias la        ls -a
alias lf        ls -FA
alias ll        ls -lA

# A righteous umask
umask 22

set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin)

setenv  EDITOR  vi
setenv  PAGER   more
setenv  BLOCKSIZE       K

if ($?prompt) then
        # An interactive shell -- set some stuff up
        set prompt = "`/bin/hostname -s`# "
        set filec
        set history = 100
        set savehist = 100
        set mail = (/var/mail/$USER)
        if ( $?tcsh ) then
                bindkey "^W" backward-delete-word
                bindkey -k up history-search-backward
                bindkey -k down history-search-forward
        endif
endif
```


----------



## blah (May 18, 2009)

tangram said:
			
		

> The odd thing is that having a look at /usr/src/etc/root/dot.cshrc, there isn't an alias.


it's hardcoded into ls(1)

```
src/bin/ls/ls.c:
        /* Root is -A automatically unless -I. */
        if (!f_listdot && getuid() == (uid_t)0 && !f_noautodot)
                f_listdot = 1;
```


----------



## tangram (May 18, 2009)

Ah there we go .


----------



## jimheard (May 18, 2009)

*Problem solved*

Thanks to all for the helpful and informative suggestions.  As I initially guessed, my question was indeed a dumb one.  Turns out I was logged in as root when I downloaded the file, so I was looking in the wrong folder.  The file was in /root/Desktop, not /home/jim/Desktop.

Thanks again for the help.


----------

