The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Odd .sh behavior in script robertmcol UNIX for Dummies Questions & Answers 2 02-10-2008 10:22 AM
sed behavior on hp-ux andy2000 Shell Programming and Scripting 8 05-04-2007 09:23 PM
ltoa Behavior charitonca HP-UX 2 07-13-2006 06:29 PM
Telnet behavior piltrafa UNIX for Dummies Questions & Answers 4 10-31-2001 03:49 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-22-2002
AtleRamsli AtleRamsli is offline
Registered User
  
 

Join Date: Feb 2002
Location: Brabant, Belgium
Posts: 65
ls behavior

I put this here because it is a 'behavior' type question..
I seem to remember doing ls .* and getting all the .-files, like
.profile
.login

etc.

But ls .* doesn't do that, it lsts the contents of every .*-type subdirectory.

Is it supposed to?
I should think that a -R should be given to dive into subdirs?
All I have access to are Solaris, BSD and Linux, what is with the others?

Atle
  #2 (permalink)  
Old 03-22-2002
Kevin Pryke Kevin Pryke is offline
Registered User
  
 

Join Date: Feb 2002
Location: Bradford, UK
Posts: 70
If I understand you question correctly

Your ls .* is finding the two directories . & .. (your current directory & the one a step back up the hierarchy)

use ls -d .* to supress printing the contents of these.
  #3 (permalink)  
Old 03-22-2002
AtleRamsli AtleRamsli is offline
Registered User
  
 

Join Date: Feb 2002
Location: Brabant, Belgium
Posts: 65
Quote:
Originally posted by Kevin Pryke
If I understand you question correctly

Your ls .* is finding the two directories . & .. (your current directory & the one a step back up the hierarchy)
Not as bad as that, it is not going up, but down.
It is printing all the stuff in .xauth, .netscape, etc.
Quote:

use ls -d .* to supress printing the contents of these.
Thanks, that did it.
Alias set up instantly
  #4 (permalink)  
Old 03-22-2002
LivinFree's Avatar
LivinFree LivinFree is offline Forum Advisor  
Goober Extraordinaire
  
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
When you type "ls .*", what is happening is that your shell is expanding the "*" to ".sh_history .netscape/ .profile .blah .less/" and everything else starting with a ".".

The -d flag tells ls not to go into the directories, like it would if you did it the way above.

I have a very usefull alias:

alias l.='ls -ld .[a-zA-Z0-9]*'

so when I type "l.", it gives me a long listing of all the dot-files and directories without going into them, and without listing "." and "..".
  #5 (permalink)  
Old 03-22-2002
AtleRamsli AtleRamsli is offline
Registered User
  
 

Join Date: Feb 2002
Location: Brabant, Belgium
Posts: 65
Quote:
Originally posted by LivinFree

alias l.='ls -ld .[a-zA-Z0-9]*'
Thanks, LivinFree, that's exactly what I was looking for, even better than just stupidly aliasing ls itself!

L miss those l, lc and ll and whatever they wre called. You reminded me to make them!


If you want to have some more fun, I'm setting up a 'hackers corner' (hacker in the true sense of the word, of course, not as in 'intruder') at

http://atle.linux-site.net

it is a little cryptic, so it actually goes like this
/cgi-bin/signon.cgi - signon
/cgi-bin/manager.cgi - manage

For the kind of people mention belov Unix only

That is: and

Atle
  #6 (permalink)  
Old 03-22-2002
LivinFree's Avatar
LivinFree LivinFree is offline Forum Advisor  
Goober Extraordinaire
  
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
I never knew I would miss ll and the others until I used HP-UX for the first time... Now, the first thing I do on a new system is set up my ls alias' !

Here's some other helpful ones:

alias lr='ls -ltr'
lsd () { ls -l $@|grep "^d" ; }
alias emode='set -o emacs'
alias vmode='set -o vi'

Boy, do I love Unix!
  #7 (permalink)  
Old 03-22-2002
AtleRamsli AtleRamsli is offline
Registered User
  
 

Join Date: Feb 2002
Location: Brabant, Belgium
Posts: 65
& amen 2 that

Not to start a shell war, but what is your favourite shell?
I've sort of rediscovered csh these days, it's really a shame that it seems to be losing out.

if ($< == "q") echo "yes"

is sort of 'natural' to a C programmer ...
Closed Thread

Bookmarks

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:40 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0