LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-06-2005, 10:08 PM   #1
browser
Member
 
Registered: Aug 2004
Location: Australia,NSW
Distribution: CalculateLinux, FreeBSD, Makulu, Voyager, Bayanihan Linux
Posts: 265

Rep: Reputation: 30
Remove a Directory


Can anyone help me out by letting me know how to remove a directory using Command Line. I struggled to find the answer googling . & also what the command is 4 adding a file . I know how to add a directory= "mkdir /home/test" etc but not adding a file to a directory. Thanks (how 2 remove a Directory & how to add a file)
 
Old 08-06-2005, 10:26 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 122Reputation: 122
Code:
rm /directory/name
rm -r /directory/name
rm -rf /directory/name
To 'add' a file, you can create an empty file using the 'touch' command.
 
Old 08-06-2005, 10:55 PM   #3
andy753421
Member
 
Registered: Apr 2004
Distribution: Gentoo
Posts: 65

Rep: Reputation: 15
You can also use 'rmdir' to remove directorys. The nice thing about rmdir is that it makes sure the directory is empty. You might want to try to avoid using 'rm -rf' (or be careful with it at least) because it can be a very dangerous command, (especially if you're logged in as root). One of my friends accidentally typed 'rm -rf path/to/something *' while in the root directory (notice inbetween the something and the *, he typed a space where he intended to type a /) this caused him to accidentally begin deleting every file off of his hard drive.

As for creating fliles. In windows theres options like "create new text documet" and "create new bitmap image" in linux files are just files. I'm not sure why you would need to create a file though. For most things the easiest way would just to use the program that makes the file (the gimp for images, or a text editor for a text file) and then just save it to a specific location.
 
Old 08-07-2005, 07:28 AM   #4
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 33
Quote:
To 'add' a file, you can create an empty file using the 'touch' command.
Or, if you don't like too much typing, just use
Code:
>filename
 
Old 08-07-2005, 07:30 AM   #5
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 33
Quote:
The nice thing about rmdir is that it makes sure the directory is empty.
A pedantic point: "empty" directories actually contain two files, "." and "..".
 
Old 08-07-2005, 09:19 AM   #6
browser
Member
 
Registered: Aug 2004
Location: Australia,NSW
Distribution: CalculateLinux, FreeBSD, Makulu, Voyager, Bayanihan Linux
Posts: 265

Original Poster
Rep: Reputation: 30
G,Day.: Thanks for all the tips they worked well . I also got to install a decent Editor that has better features than plain gedit. One more question that I really would like to know . What & how do I use the touch command,Sounds interesting
 
Old 08-07-2005, 04:22 PM   #7
andy753421
Member
 
Registered: Apr 2004
Distribution: Gentoo
Posts: 65

Rep: Reputation: 15
Hey, >filename is a neat trick i never knew of.

Anyway, browser, just type 'touch filename' and it will create the file, if you want to know more about the touch, (or any command for that matter) type 'man command' as in 'man touch' and that will tell you about it.

As for a text editor I would suggest either EMACS or a vi derivative (I use Vim, but that's a matter of personal preference, and I know that many people prefer EMACS)
 
Old 08-11-2005, 09:28 AM   #8
browser
Member
 
Registered: Aug 2004
Location: Australia,NSW
Distribution: CalculateLinux, FreeBSD, Makulu, Voyager, Bayanihan Linux
Posts: 265

Original Poster
Rep: Reputation: 30
Thanks Everyone , LinuxQuestions is the best Forum
 
Old 08-11-2005, 09:28 AM   #9
browser
Member
 
Registered: Aug 2004
Location: Australia,NSW
Distribution: CalculateLinux, FreeBSD, Makulu, Voyager, Bayanihan Linux
Posts: 265

Original Poster
Rep: Reputation: 30
Thanks Everyone , LinuxQuestions is the best Forum
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rm: cannot remove directory `ff': Directory not empty blancs Linux - General 17 08-29-2011 02:47 PM
how remove directory laurentwahl Linux - Newbie 1 05-31-2005 03:52 PM
how to remove a directory Meatball1337 Linux - Software 2 10-10-2004 10:39 AM
remove directory?? KaktusKnight Linux - General 8 05-31-2003 02:26 PM
Remove a Directory RedHatMN Linux - Newbie 2 12-05-2001 03:33 PM


All times are GMT -5. The time now is 02:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration