Need help with Linux Equivalent of a DOS command - Questions

This is a discussion on Need help with Linux Equivalent of a DOS command - Questions ; The DOS command is "Dir *." which would just list directories. I'm logged on as root and in the /etc directory ls -d looks like it ought to show me all the directories in /etc directory but just shows me ...

+ Reply to Thread
Results 1 to 12 of 12

Thread: Need help with Linux Equivalent of a DOS command

  1. Need help with Linux Equivalent of a DOS command

    The DOS command is "Dir *." which would just list directories.

    I'm logged on as root and in the /etc directory
    ls -d looks like it ought to show me all the directories in /etc
    directory but just shows me the "." directory

    I'm new to Linux so just trying to find my way around the file system.
    I've looked at "man ls" but aside from "-d" I don't see any other
    obvious options.

    Feel free to email or post.

    Thanks in advance

    Lester



  2. Re: Need help with Linux Equivalent of a DOS command

    On Sat, 11 Sep 2004 22:06:22 +0100, Lester wrote:

    > The DOS command is "Dir *." which would just list directories.


    $ tree -ndA

    See $ tree --help, for sorting, etc.

    --
    Paying more at the gas pump? Bush's Oil Sheikh Buddies, who support Al
    Qaeda, Palestinian terrorists, & hate-U.S. school systems everywhere,
    need more of your money now to arm and pay Iraqis to kill Americans.
    D. Raleigh Arnold dra@ (http://www.) openguitar.com darnold4@cox.net

  3. Re: Need help with Linux Equivalent of a DOS command

    Thanks David for your prompt response. I am using Red Hat 6.2 (using
    a Sun Ultra 5) and it doesn't recognize "tree"

    Can "ls" just not do what I need?

    Cheers

    Lester


    On Sat, 11 Sep 2004 18:13:49 -0400, David Raleigh Arnold
    wrote:

    >On Sat, 11 Sep 2004 22:06:22 +0100, Lester wrote:
    >
    >> The DOS command is "Dir *." which would just list directories.

    >
    >$ tree -ndA
    >
    >See $ tree --help, for sorting, etc.



  4. Re: Need help with Linux Equivalent of a DOS command

    Lester wrote:

    > Can "ls" just not do what I need?


    bash-2.05b$ ls -al | grep ^d

    .... stop TOP-POSTING
    ..
    --
    << http://michaeljtobler.homelinux.com/ >>
    Q: What's the difference between Windows 95 and a highly destructive virus?
    A: About 90 MB of hard disk space.


  5. Re: Need help with Linux Equivalent of a DOS command

    mjt wrote:
    >
    > bash-2.05b$ ls -al | grep ^d


    great tip. what's it mean? i can't find the '^' in 'man grep'.

    on a related note. is there an easy way with the ls command to have it
    list everything in a directory (files and directories), BUT all
    directories sorted before files?

    cheers,
    johnny


    --
    I'm Johnny Bobby Bee, and I approved this message.

    remove '.eh' to email

  6. Re: Need help with Linux Equivalent of a DOS command

    On Sat, 11 Sep 2004 23:37:55 GMT, mjt
    wrote:

    >Lester wrote:
    >
    >> Can "ls" just not do what I need?

    >
    >bash-2.05b$ ls -al | grep ^d
    >
    >... stop TOP-POSTING
    >.


    Thanks very much. Not quite as succinct as "dir *." but just as
    effective!

    Cheers

    Lester




  7. Re: Need help with Linux Equivalent of a DOS command

    On 2004-09-12, johnny bobby bee wrote:
    > mjt wrote:
    >> bash-2.05b$ ls -al | grep ^d


    > great tip. what's it mean? i can't find the '^' in 'man grep'.


    Really? Mine says (somewhere under "REGULAR EXPRESSIONS"):

    : The caret ^ and the dollar sign $ are metacharacters that respectively
    : match the empty string at the beginning and end of a line.

    > on a related note. is there an easy way with the ls command to have it
    > list everything in a directory (files and directories), BUT all
    > directories sorted before files?


    There are things other than (plain) files and directories ...

    I guess "ls -l | sort -r" suffices for your description, though.

    --
    Paul Kimoto
    This message was originally posted on Usenet in plain text. Any images,
    hyperlinks, or the like shown here have been added without my consent,
    and may be a violation of international copyright law.

  8. Re: Need help with Linux Equivalent of a DOS command

    johnny bobby bee wrote:
    > mjt wrote:
    >
    >>
    >> bash-2.05b$ ls -al | grep ^d

    >
    >
    > great tip. what's it mean? i can't find the '^' in 'man grep'.
    >
    > on a related note. is there an easy way with the ls command to have it
    > list everything in a directory (files and directories), BUT all
    > directories sorted before files?
    >
    > cheers,
    > johnny
    >
    >


    fyi, ^ means "begins with".

  9. Re: Need help with Linux Equivalent of a DOS command

    Lester wrote:
    > On Sat, 11 Sep 2004 23:37:55 GMT, mjt
    > wrote:
    >
    >
    >>Lester wrote:
    >>
    >>
    >>>Can "ls" just not do what I need?

    >>
    >>bash-2.05b$ ls -al | grep ^d
    >>
    >>... stop TOP-POSTING
    >>.

    >
    >
    > Thanks very much. Not quite as succinct as "dir *." but just as
    > effective!
    >
    > Cheers
    >
    > Lester
    >
    >
    >

    But you can always make an "alias" of the command. Many people will
    "alias" ls -l as "dir," for example. You might use "ddir" (meaning
    "directory of directories) for instance.

  10. Re: Need help with Linux Equivalent of a DOS command

    On Sun, 12 Sep 2004 15:20:28 GMT, A Nengineer
    wrote:

    >>
    >>

    >But you can always make an "alias" of the command. Many people will
    >"alias" ls -l as "dir," for example. You might use "ddir" (meaning
    >"directory of directories) for instance.



    Oh no another thing I'm gonna have to learn! :-) Thanks very much, I
    shall look up aliasing.

  11. Re: Need help with Linux Equivalent of a DOS command

    On Tue, 14 Sep 2004 13:15:36 -0400, David Raleigh Arnold
    wrote:

    >On Sun, 12 Sep 2004 19:57:52 +0100, Lester wrote:
    >
    >> On Sun, 12 Sep 2004 15:20:28 GMT, A Nengineer
    >> wrote:
    >>
    >>
    >>>>
    >>>But you can always make an "alias" of the command. Many people will
    >>>"alias" ls -l as "dir," for example. You might use "ddir" (meaning
    >>>"directory of directories) for instance.

    >>
    >>
    >> Oh no another thing I'm gonna have to learn! :-) Thanks very much, I
    >> shall look up aliasing.

    >
    >That would be interesting, and it would be useful, but IMHO it would
    >be better to write a bash script to do it. Make a ~/bin directory, edit
    >ddir:
    >
    >#!/bin/bash
    >ls -al | grep ^d
    >
    >save it in *your* bin directory, not /bin, but /home/you/bin, or
    >~/bin for short. Then make it executable:
    >
    >$ chmod +x ddir
    >
    >Put your ~/bin directory in your path in ~/.bashrc
    >
    >#path - this line is a comment
    >
    > export PATH=$PATH:/home/dra/bin
    >
    >Look at all the aliases in there! Point is that a bash script
    >is slower, but you can do more with it, and the difference
    >in speed won't be important unless you are using a machine
    >that is really really really old. Aliases are like DOS macros,
    >in memory, and bash scripts are like DOS batchfiles, on disk.
    >
    >tree is prettier than ls for this. daveA


    Thanks very much for your very thorough answer. I have already had a
    quick look at bash scripts so you've given me a good reason to look a
    bit deeper.


  12. Re: Need help with Linux Equivalent of a DOS command

    in ruP0d.137112$A8.12245@edtnps89 johnny bobby bee posted:

    > mjt wrote:
    >>
    >> bash-2.05b$ ls -al | grep ^d

    >
    > great tip. what's it mean? i can't find the '^' in 'man grep'.
    >
    > on a related note. is there an easy way with the ls command to have it
    > list everything in a directory (files and directories), BUT all
    > directories sorted before files?
    >
    > cheers,
    > johnny


    If I need to break down the listings that way I just use mc.
    --
    Stephen S.
    -------------------------



+ Reply to Thread