Results 1 to 3 of 3

Thread: How can I delete a directory using SSH

  1. #1
    Join Date
    May 2009
    Posts
    640

    How can I delete a directory using SSH

    I want to delete a directory from my remote Linux server. Can I do it using SSH ? My problem is that I don't know the command to achieve this goal. Can you help me to delete it?

  2. #2
    Join Date
    May 2008
    Posts
    1,020

    Re: How can I delete a directory using SSH

    Delete directory via SSH

    Syntax

    rm -r -f directory_name

    where,

    -r = recursively deletes the directory and all files in it, including subdirectories
    -f = will not ask for confirmation before deleting

    For example:

    rm filename.txt: deletes filename.txt, will ask for confirmation before deleting
    rm -f filename.txt: deletes filename.txt, will not ask for confirmation before deleting.
    rm -rf tmp/: deletes the directory tmp, and all files in it, including subdirectories. It will not ask for confirmation.


    Always be careful with this command. If you provide the second parameter (-f), it will simply delete the directory without any confirmation.

  3. #3
    Join Date
    May 2008
    Posts
    681

    Re: How can I delete a directory using SSH

    I would like to add my comments to this discussion. Are you logged in as a privileged user? You can check this using below command:

    ls -al

    It will show you all the directory details including sub-directories and attributes in it. It will also show you if you are privileged to modify or delete the directory.

Similar Threads

  1. Cannot Delete xxx xxx: The Directory Is Not Empty Windows XP
    By Gavinovo in forum Networking & Security
    Replies: 3
    Last Post: 19-10-2010, 10:22 PM
  2. Delete data under .sqmaildata directory
    By Morea in forum Software Development
    Replies: 4
    Last Post: 17-06-2010, 05:45 PM
  3. Batch script to delete directory
    By Logan 2 in forum Software Development
    Replies: 4
    Last Post: 01-04-2010, 12:31 PM
  4. How to Check or Delete Directory in Java?
    By Rob Dizzle in forum Software Development
    Replies: 5
    Last Post: 19-02-2010, 02:22 AM
  5. Delete the contents of a directory using Batch
    By GUSSIE in forum Operating Systems
    Replies: 3
    Last Post: 11-09-2009, 12:43 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,396,266.96569 seconds with 16 queries