Find the answer to your Linux question:
Results 1 to 5 of 5
Hello, I have just started my "adventure" with Linux and i have a problem. I've tried everything but i couldn't finish my examples. Here they are: 1) Using ls command ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2012
    Posts
    3

    ls Command Problem


    Hello,
    I have just started my "adventure" with Linux and i have a problem. I've tried everything but i couldn't finish my examples.
    Here they are:
    1) Using ls command find all files in /etc which have got 4 or more letters ....
    I've tried
    ls -d /etc/????
    But it only shows words with 4 letters (but no more) ...

    2) Using ls command find files in /etc which penultimate letter is small
    I have no idea how to do this. I've tried
    ls -d /etc/?[a-z]? but it will only work for word with 3 letters ...

    3) Using command Find files in /etc which 3 letter is Capital
    I don't know how to do this for word which has f.e 4 or more letters ...
    ls -d /etc/??[A-Z] /etc/???[A-Z] - but how to do this "general" - when we don't know how many letters has the word ... ANd other problem is when i type [A-Z] - Debian doesn't recognize Capital letter from this range ... only small ...
    THanks in advance for help/advices
    rajd3r

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Hello and welcome!

    Is this a homework question? If so, they are against Forum Rules. However, we can still give you helpful advice. Here's some now: Check out grep. Hint: the '.' character matches any character.

  3. #3
    Just Joined!
    Join Date
    Oct 2012
    Posts
    3
    It's not exactly homework - doesn't matter
    I understand and yes, hints will be very helpful - i didn't expect "ready answer"
    I'll try sth with grep.
    Thanks for help.
    rajd3r

  4. #4
    Just Joined!
    Join Date
    Oct 2012
    Posts
    3
    1) Using ls command find all files in /etc which have got 4 or more letters ....
    I've tried
    ls -d /etc/????
    But it only shows words with 4 letters (but no more) ...

    Ok i think it works when i type:
    ls -d /etc/????*

    atrey: The only problem is that i have to do this without grep Only ls -d command /etc/.....
    rajd3r

    EDIT: OK i solved the problem. You can close.
    Thanks for advices
    rajd3r
    Last edited by rajd3r; 10-26-2012 at 12:52 PM.

  5. #5
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by rajd3r View Post
    EDIT: OK i solved the problem. You can close.
    Great! For the sake of others coming to this thread later, (and to satisfy my own curiosity), can you post your solution?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •