The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to view my IP blowFish@ubuntu UNIX for Dummies Questions & Answers 14 05-09-2008 06:35 AM
Listing directories and sub directories jinxor UNIX for Advanced & Expert Users 3 03-11-2008 07:27 AM
moving directories to new directories on multiple servers mackdaddy07 Shell Programming and Scripting 0 04-06-2007 08:30 AM
view all others terminals vkandati UNIX for Dummies Questions & Answers 2 03-08-2005 04:27 PM
DBM View schafferm UNIX for Dummies Questions & Answers 1 08-06-2002 01:18 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 04-05-2006
Registered User
 

Join Date: Mar 2006
Location: Gurgaon
Posts: 26
have u tried dir command
type:- I cant understand what u looking for??? but i guess thats it...or u want to see files within dir also???


dir
Reply With Quote
Forum Sponsor
  #9  
Old 04-05-2006
Registered User
 

Join Date: Dec 2005
Location: Pune
Posts: 78
do u want this??

ls -ld mails
Reply With Quote
  #10  
Old 05-04-2006
Registered User
 

Join Date: May 2006
Posts: 2
Displays all the directories (current location)

Append this in profile:
alias lsd='ls -1F $* | grep '/$' '

type
lsd

This will display all the directories.
E.g.:-
dir_a/
dir_b/
mails/
Reply With Quote
  #11  
Old 05-04-2006
4FtHawaiian's Avatar
Registered User
 

Join Date: May 2006
Location: Sydney, AUS
Posts: 5
Quote:
Originally Posted by blazingrock4u
Append this in profile:
alias lsd='ls -1F $* | grep '/$' '

type
lsd

This will display all the directories.
E.g.:-
dir_a/
dir_b/
mails/
Dude! That's a nice little alias.

I'm an alias junkie.. I'll make sure I add that one

Cheers
Reply With Quote
  #12  
Old 05-05-2006
Registered User
 

Join Date: Mar 2006
Posts: 143
The given alias is quite ok for listings of the $PWD.
But if I remember correctly aliases (or better alii) are parameter ignorant.
If you wish to pass parameters you need to define a shell function.
For instance you could put this in your .shrc file.
Code:
lsd() { ls -p $*|grep /\$; }
Then you could say e.g.
lsd /etc /var
Reply With Quote
  #13  
Old 05-05-2006
Registered User
 

Join Date: Mar 2006
Posts: 143
Of course the classic way to list directories is simply to use find
e.g. for a recursive search

find /var -type d

But you could restrict the descent to inodes of the same filesystem

find /var -xdev -type d

Or even limit the depth of descent

find /var -maxdepth 1 -type d

But better consult your Unix's manpage of find because despite
a common denominator the different finds all deviate slightly in their scope and syntax.
Probably the widest functionality is offered by GNU find,
as is part of findutils of Linux distros.

Note also, if you run find with restricted permissions as far as read and execute
of dirs is concerned that it's probably advisable to redirect stderr to /dev/null
to prevent error messages cluttering your find results.
Reply With Quote
  #14  
Old 05-07-2006
4FtHawaiian's Avatar
Registered User
 

Join Date: May 2006
Location: Sydney, AUS
Posts: 5
Cool

Quote:
Originally Posted by buffoonix
The given alias is quite ok for listings of the $PWD.
But if I remember correctly aliases (or better alii) are parameter ignorant.
If you wish to pass parameters you need to define a shell function.
For instance you could put this in your .shrc file.
Code:
lsd() { ls -p $*|grep /\$; }
Then you could say e.g.
lsd /etc /var

I've never had a problem passing arg's to aliases. Consider the RH default, which aliases 'ls' to 'ls --color'..

Perhaps the problem is a "shell specific", one. In which case, we could chalk it up to another example of of how much bash RULES.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0