linux: how to remove file with this kind of name "test\download\"? - linux

I was trying to remove this file from server using rm command but it doesn't work. Also I can't rename this file. Please help.

Try something like
rm -i test?download*
and read glob(7) and rm(1)

Related

Is there a way to remove file with substitutions in name in linux?

Let's say I have directory with files: log[1-3], log1, log2, log3. I want to type a command and remove file log[1-3]. How it can be done?.
Yes I know, that I can type rm -i log* and then choose file that I wanted to remove, but it is not appropriate for me, because in this directory can be many files begins with log.
So, i need a way to do this with just one command.
I found way to do this. You just need to type rm 'log[1-3]'. With a single quotes
Thank you CamilCuk
There seem to be two ways to do this:
rm log\[1-3\]
rm 'log[1-3]'
rm log\[1-3\] is a result of rm log ESCESC
rm 'log[1-3]' is a result of ls -ltra.

Delete file from Unix system

I want to delete a text file from Unix machine. I am using the following command for the same.
rm /tmp/filename.txt
It is working fine. After execution it returns nothing.
I want to get some conformation about deletion as follows,
filename.txt deleted successfuly.
Please any one help me on this.
Thanks in advance.
You can use these commands:
rm /tmp/filename.txt && echo "File successfuly deleted"
this will remove the file and then (only if the exit status of command is successful) print the message.
Otherwise, as Venkat said, you can use rm -i that asks for confirmation before deleting the file.
I have used the following to slove my issue.
rm -v /tmp/filename.txt
this will display the message as follows,
removed `/tmp/filename.txt`
you can use option with Unix command please See
this link below
The below command prompts you once whether you want to remove the file before deleting it.
rm -i tmp/filename.txt
If the file is unavailable shows you :
cannot remove ‘tmp/filename.txt’: No such file or directory
Hope it helps.

I can't delete files like "#test.cpp#~" in terminal

I'm using Ubuntu linux. I have a file #test.cpp#~ and when I try to run the following command in the terminal:
rm #test.cpp#~
all I get is:
rm: missing operand
Can someone tell me what's happening? I think the file is an autosave but I don't know how to delete it.
~ and # have special meaning in shell environment. User quotes:
rm "#test.cpp#~"
you need to escape the # try the following:
rm \#test.cpp\#~
you may need to do
rm \#test.cpp\#\~

When I use mv on one of my files, it disappears

When I use
mv Engine_Controls.py ~/Flight_Computer
The file disappears, but I was able to successfully move another python file without an issue into the same directory.
Also, when I type in:
sudo locate Engine_Controls.py
It says that it's in the original directory.. but it isnt.
Could somebody explain why the file is disappearing, as well as why locate says the file is still there?
edit: Problem solved.
Could you have had a typo in your mv command? Try running history | grep mv and see if you might have had a typo.
If you want to fix the 'locate' issue, try a sudo updatedb and then do your sudo locate Engine_controls.py again.
Another option would be to use the -v on the mv command. This will give you some additional info for troubleshooting. For example, if I want to move the file test to test2:
mv -v ~/test ~/test2
the output would be:
'/home/nelsone/test' -> '/home/nelsone/test2'

How to remove the hashtag #index.html# file in linux/unix?

if I ls in terminal, i got this
#index.html# Procfile bootstrap index.html
And I want to remove this #index.html# file, how can I do so?
Typing
rm -f #index.html#
doesn't work. Also, anyone know why is it there in the first place? I'm using aws EC2.
# is a special character: you must backslash it:
rm -f \#index.html#
This file could appear if this directory is part of a CVS repository and there was a conflict on this file (see the man page of cvs update).

Resources