Red HatThis forum is for the discussion of Red Hat Linux.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
To delete multiple files you need to use a wildcard, which is the * character. (Yes, it's your asterisk.) * means every possible string of numbers and letters, including spaces.
Delete all files in a directory:
Be very, very careful with this. If I want to delete everything in the /usr/bin/foo directory, I type:
Thus specifiying the directory. (It's unnecessary and paranoid, but I do it anyway, because I might one day want to type "rm -RF," which removes all files and all subdirectories, and I want to keep the good, safe habit.)
To delete all files starting with the word "star" type:
This will remove starfish, star.doc, star.conf.bak, star.html, etc.
To delete all files that end in out, type
Keep the period. Make sure you don't type
because that will also remove shout, pout, standout, etc.
so you can learn about the "rm" command.
You can also use the * with commands such as cp, ls, etc.
I can't help you with removing things after a certain date. You'll have to write a script and I don't have time to fiddle with that tonight.
To do it manually, you'll need to type
which will give you a listing of all files with dates. You can probably do something like
I just made some files with .out extensions and tried to remove them. The command
worked perfectly. This makes me think that someone aliased the rm command to something silly. Try typing
at the command prompt. This will show you a list of aliased commands. You may discover that "rm" has been connected to an incorrect command. Commands such as "rm" or "cp" that can affect files in a dangerous manner are usually aliased with the "-i" extension, so if you see output like this:
alias rm="rm -i"
then you're ok. If "rm" is not on the list you need to look elsewhere for the problem. On the other hand, if you see something that looks like this:
alias rm="rm -i -t -N"
then rm has been aliased improperly. In this case you should type:
alias rm="rm -i"
which will give you a sane "rm" command. Then try:
The other possibility is that you're working on a drive which someone else has mounted and on which you don't have proper permissions. This can cause some commands to behave erratically. In fact, I just got an identical error message (Argument list too long) trying to eject a CDROM drive as "alex" which I had mounted as "root."
You may have to su to root, or contact your sysadmin.
Thanks for your quick support
I am log in with user root and try the alias and rm command. alias command shows the right result which u have mentioned but the rm command display same error message. the result of two commands are as
[root@visiondb1 PROD_proddb]# alias
alias cp='cp -i'
alias l.='ls -d .[a-zA-Z]* --color=tty'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-do
[root@visiondb1 PROD_proddb]# rm *.out
bash: /bin/rm: Argument list too long
the command is:
for i in *.out ; do rm $i ; done
this command run sccussfully, but it prompt on every file before deletion. I want to delete all files with out extention without prompting.
[root@visiondb1 PROD_proddb]# for i in *.out ; do rm $i ; don
rm: remove `o165278.out'? y
rm: remove `o165291.out'? y
rm: remove `o165296.out'? y
rm: remove `o165301.out'?