On Sat, 17 Mar 2007 11:53:48 -0500
dwain
Jerry Feldman wrote:
On Sat, 17 Mar 2007 10:53:14 -0500 dwain
wrote: Jerry Feldman wrote:
On Sat, 17 Mar 2007 03:12:06 -0500 dwain
wrote: what is the command line command to delete a file, directory etc.? The previous posts mentioned both rm (remove a file, but this can also remove a directory tree). rmdir removes an empty directory.
One difference between Unix/Linux systems and other operating systems is that a file is an entry in a table, called inode. A file may have many different names (hard and symbolic links). For instance, a directory will have a minimum or 2 names, the name you see from its parent directory, and the dot ( . ). Whenever a new hard link is created, it increments the use count in the inode table. The rm command removes the file name and decrements the use count, but does not necessarily delete the file. The system deletes the file, only when the use count reaches zero. Also, when a program opens a file, the use count is incremented. One of the things that can happen is that log files are generally opened by daemons. If you try to delete a large log file, rm will remove the file name, but the file remains open until either the daemon closes it or the daemon exits.
thank you for the additional information. although it is completely over my head in comprehension, i hope to understand it one day. it was recommended to do an rm --help. i did that, and was told to do -r or -R after the rm and before the file or directory i was to remove.
i noticed in konquer that after the deletion the directory was still there, but it was empty. there was a nested directory inside of the one i deleted. after a reboot, the directory was gone.
is this what you meant about the daemon keeping the directory open until the daemon closes it or exits? rm -r is a recursive delete. Be very careful. There are many reasons a directory is not removed. rm -rf <directory name> This will remove the directory and everything in it. (-f is force). rmdir removes an empty directory. One reason a directory may not be removed is that you could be in it. For instance, 'rm -rf . ' will not delete the current directory because that is your current working directory.
i understand that. the reason i had deleted the directory was that during the installation of jre 1.5.0 (according to the install instructions on the site) it was mentioned to install in the usr/local/java directory.
well, not know and muddling along i created the java directory in the wrong place. when i did install the rpm it was put where it was supposed to be, i guess. that meant that i had an rpm file sitting in a directory in the wrong place that needed to be gotten rid of.
that's why i deleted the directory; and i do appreciate everyone's remarks on how dangerous that can be. i understand that as well. since i am in the process of setting up my new and first linux system, a fresh install of the os means nothing, since i have nothing of great importance on the drive anyway.
i'm learning and having fun with my new toy, the command line interface.
please recommend some reading material that will help me better understand and use linux more efficiently. i'm an old man and i don't have much time left on this earth and i want to make the best of what i have left.
if your interested, here's my personal web site, if you enjoy art.
http://www.studiokdd.com/ Here is a URL: http://www.linuxcommand.org/learning_the_shell.php
Basically, there are 2 flavors of shell (command line interpreters) in
Unix and Linux. /bin/sh is the Bourne Shell. The Linux BASH shell is a
derivation of sh as is the Korn Shell. The other flavor is the C shell
developed by Bill Joy and his team at Berkeley. This includes csh and
tcsh. Which one you use is religious. You can actually write some
fairly complex script with either shell.
When I was preparing to teach a Linux course at a local university I
did a quick count and Linux has over 1500 different commands. But,
remember, that Unix commands are generally designed as tools in a kit.
You can chain a number of them together on a command line using the
pipe ( | ):
ls -l | grep "\.doc" | pr -f
In the above, I'm doing a long listing (see man ls) in a directory,
filtering for and file that contains .doc - note that grep is a regular
expression parser so the . must be escaped, and filtering though pr
with the -f flag to paginate it nicely.
--
Jerry Feldman