Results 1 to 15 of 15
  1. #1
    Join Date
    Dec 2002
    Location
    UK
    Posts
    837

    Deleting muliple files SSH? Easier way?

    Hi

    Been searching all over cant seem to find the answer for this

    In my home directory i have a load of .tar.gz files which i used for restoring accounts there are atleast around 100 i'd say

    Does anyone know what command to issue to delete all files in the /home directory with a .tar.gz extension

    i can do them one by one but gonan take ages wondering if there is na easier way?

  2. #2
    You can use following command.. Will definitely help you.
    rm -rf *.tar.gz

  3. #3
    Join Date
    Dec 2002
    Location
    UK
    Posts
    837
    thank your sir

    worked fine!

  4. #4
    BTW you can use midnight commander (mc) to simply highlight and delete un-needed files, sometimes it is easier then to use pattern

  5. #5
    Join Date
    Dec 2007
    Location
    Indianapolis, Indiana USA
    Posts
    15,200
    Quote Originally Posted by Crashus View Post
    BTW you can use midnight commander (mc) to simply highlight and delete un-needed files, sometimes it is easier then to use pattern
    Eh? rm -rf *.tar.gz is easy as pie and only takes a split second to do.
    Michael Denney - MDDHosting, LLC - Professional Hosting Solutions
    LiteSpeed Powered - Shared, Premium, Reseller, and VPS
    For high-end shared accounts ideal for business, check out our Premium offerings!
    http://www.mddhosting.com/ - Providing Quality Services since 2007

  6. #6

    *

    Quote Originally Posted by MikeDVB View Post
    Eh? rm -rf *.tar.gz is easy as pie and only takes a split second to do.
    And what if you need to delete 5-10 files which have *mike* or *dvb* or *webhostingtalk* in their names with *tar or *gz or *bz or *sql in their extensions with all these files mtime more then 1 day?

    Would you still use patterns for these? Or maybe simply check them in MC and press F8?

  7. #7
    Join Date
    Dec 2007
    Location
    Indianapolis, Indiana USA
    Posts
    15,200
    I have no idea what "mc" is and I've never used it. Chances are you could easily delete the files in the time it would take to even install "mc".

    As far as deleting files with those attributes, a bit of simple regex could do it or you could just type out a few commands and be done with it.

    The point I was trying to make is that they OP had a simple request with a simple solution that doesn't require anything more than a single command.

    If they were asking how to delete an array of files with different names and extensions then perhaps your solution would be a good fit.
    Michael Denney - MDDHosting, LLC - Professional Hosting Solutions
    LiteSpeed Powered - Shared, Premium, Reseller, and VPS
    For high-end shared accounts ideal for business, check out our Premium offerings!
    http://www.mddhosting.com/ - Providing Quality Services since 2007

  8. #8
    Quote Originally Posted by MikeDVB View Post
    I have no idea what "mc" is and I've never used it. Chances are you could easily delete the files in the time it would take to even install "mc".

    As far as deleting files with those attributes, a bit of simple regex could do it or you could just type out a few commands and be done with it.

    The point I was trying to make is that they OP had a simple request with a simple solution that doesn't require anything more than a single command.

    If they were asking how to delete an array of files with different names and extensions then perhaps your solution would be a good fit.
    mc is a clone of norton commander under unix. I'm glad OP figured out how to achieve his needs but I was hoping my advice will be handy for him in the future, thats all.

  9. #9
    Join Date
    Dec 2007
    Location
    Indianapolis, Indiana USA
    Posts
    15,200
    Quote Originally Posted by Crashus View Post
    mc is a clone of norton commander under unix. I'm glad OP figured out how to achieve his needs but I was hoping my advice will be handy for him in the future, thats all.
    I see - tools like those do have their place but I prefer to work using the built in utilities in Linux for a couple of reasons -> they're always available no matter what system I'm in -> I don't have to install them before I can do what I need to do.

    Maybe it will be helpful to somebody in the future.
    Michael Denney - MDDHosting, LLC - Professional Hosting Solutions
    LiteSpeed Powered - Shared, Premium, Reseller, and VPS
    For high-end shared accounts ideal for business, check out our Premium offerings!
    http://www.mddhosting.com/ - Providing Quality Services since 2007

  10. #10
    Quote Originally Posted by MikeDVB View Post
    I see - tools like those do have their place but I prefer to work using the built in utilities in Linux for a couple of reasons -> they're always available no matter what system I'm in -> I don't have to install them before I can do what I need to do.

    Maybe it will be helpful to somebody in the future.
    It's like buying a car to drive yourself 2 kilometers, sometimes it is very-very handy and cool and sometimes you can stuck in a traffic for half-day.

    I hope you will like mc if you ever will try it

  11. #11
    Join Date
    Dec 2007
    Location
    Indianapolis, Indiana USA
    Posts
    15,200
    I've never had problems with regular expressions being a developer for well over 15 years so I'll probably just stick to doing things the way I've always done them.
    Michael Denney - MDDHosting, LLC - Professional Hosting Solutions
    LiteSpeed Powered - Shared, Premium, Reseller, and VPS
    For high-end shared accounts ideal for business, check out our Premium offerings!
    http://www.mddhosting.com/ - Providing Quality Services since 2007

  12. #12
    Quote Originally Posted by MikeDVB View Post
    I've never had problems with regular expressions being a developer for well over 15 years so I'll probably just stick to doing things the way I've always done them.
    You've never used mc for 15 years? You're probably very strict person, which is good from other side.

    I'm glad you're ok with it

  13. #13
    Join Date
    Dec 2007
    Location
    Indianapolis, Indiana USA
    Posts
    15,200
    Quote Originally Posted by Crashus View Post
    You've never used mc for 15 years? You're probably very strict person, which is good from other side.

    I'm glad you're ok with it
    I've never used it, ever. Never had a need for it.
    Michael Denney - MDDHosting, LLC - Professional Hosting Solutions
    LiteSpeed Powered - Shared, Premium, Reseller, and VPS
    For high-end shared accounts ideal for business, check out our Premium offerings!
    http://www.mddhosting.com/ - Providing Quality Services since 2007

  14. #14
    Join Date
    Apr 2003
    Location
    NC
    Posts
    3,076
    Same here, I have never messed with MC. The shell works fine and once you are used to it why bother with any sort of gui?

    Just be careful when you are using *'s, an extra space can ruin your day in a matter of seconds
    John W, CISSP, C|EH
    MS Information Security and Assurance
    ITEagleEye.com - Server Administration and Security
    Yawig.com - Managed VPS and Dedicated Servers with VIP Service

  15. #15
    Join Date
    Apr 2003
    Location
    San Jose, CA.
    Posts
    1,622
    Am I the only one who thinks that if the OP can't use one of the most basic commands and apply simple arguments to it... that they shouldn't be the one trying to remove account backups or be allowed to use a shell account?

Similar Threads

  1. Looking for software to help make ssh/rdesktop easier
    By jaymef in forum Hosting Software and Control Panels
    Replies: 2
    Last Post: 11-29-2005, 12:56 PM
  2. Deleting a Directory in SSH
    By openXS in forum Dedicated Server
    Replies: 5
    Last Post: 09-22-2005, 03:12 AM
  3. Tired of SpeedTest Files? Want a easier way?
    By Sheps in forum Other Web Hosting Related Offers
    Replies: 16
    Last Post: 06-05-2005, 12:10 AM
  4. Deleting SSH user
    By AA2004 in forum Dedicated Server
    Replies: 7
    Last Post: 05-17-2004, 03:27 AM
  5. Deleting Directory using SSH
    By dropscripts in forum Hosting Security and Technology
    Replies: 3
    Last Post: 10-27-2003, 10:52 PM

Related Posts from theWHIR.com

Posting Permissions

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