Linked Questions
16 questions linked to/from Does 'rm .*' ever delete the parent directory?
1
vote
1
answer
9k
views
rm -r * in unix [duplicate]
I am about to enter the command: rm -r * in a directory where I would like all files and directories (and their files) removed. My concern is that unix also has the ./ and the ../ directories. rm -r ...
0
votes
1
answer
155
views
Why can't I `rm -r .`? [duplicate]
A question I already asked myself a few times is why I can't delete the current working directory using rm -r .
The shell does not have a problem with a non-existing directory as working directory, ...
98
votes
14
answers
529k
views
How to remove all the files in a directory?
I am trying to remove all files and subdirectories in a directory. I used rm -r to remove all files, but I want to remove all files and subdirectories, excluding the top directory itself.
For example,...
41
votes
2
answers
9k
views
Why can't I remove the '.' directory?
I tried removing the '.' directory. I thought I could just delete my working directory without having to go into a parent directory.
The point of my question is to look for some insight into how the ...
22
votes
7
answers
2k
views
`command .*` acts on the parent directory [duplicate]
Someone of our team wanted to recursively change the user permissions on all hidden directories in a users home directory. To do so he executed the following command:
cd /home/username
chown -R ...
8
votes
3
answers
15k
views
difference copy contents folder between /. and /* in linux
to copy contents from a folder i've read , the use is:
cp -rfva ../foldersource/. ./
but this works too
cp -rfva ../foldersource/* ./
is there any difference?
by example if i want to delete a ...
13
votes
2
answers
2k
views
Why doesn't recursion go upwards with rm?
I'm wondering about direction of recursion in general and rm specifically.
rm recursion only works downwards correct?
Running: sudo rm -R *.QTFS will delete all *.QTFS files in current directory ...
8
votes
1
answer
55k
views
Does rm -rf * delete files recursively from the current directory or parent/root directory?
I wanted to delete files and folder recursively from a particular folder so I ran this command from that folder
rm -rf *
I assumed it would delete all files/directories under the current directory ...
8
votes
2
answers
32k
views
rm: refusing to remove '.' or '..' directory: skipping '..'
Why when I try to delete .. from directory I receive error:
rm: refusing to remove '.' or '..' directory: skipping '..'
And before you ask why I want to do this: Just because.
5
votes
6
answers
2k
views
How do I match only dotfiles in bash? [duplicate]
rm -rf .* will only not end horribly because rm refuses to delete . and ...
How do I exclude these special directories from a glob pattern?
This is not solved by dotglob since I want to match only ...
6
votes
2
answers
2k
views
When exactly would you use ".[^.]*" or ".??*" glob patterns?
I'm trying to understand Linux, its command-line and this quote:
You can run into problems with globs
because .* matches . and .. (the current and parent directories).
You may wish to use a pattern ...
9
votes
2
answers
3k
views
What happens when the current directory is deleted?
In the first terminal A, I create a directory, enter the directory, and create a file:
$ mkdir test
$ cd test
$ touch file1.txt
$ ls
file1.txt
Then in another terminal B, I delete the directory:
$ ...
3
votes
2
answers
7k
views
Why doesn't "rm -rf ./" delete anything?
The command rm -rf ./ does not do anything in a directory full of sub directories and files. Why so? Isn't -r supposed to go recursive?
To add more confusion, it even prints an error message ...
1
vote
1
answer
900
views
Faster way to Delete Large Number of Files Up to size (20GB)using rm -rf Failed and sometime get stuck?
I tried to delete the subDirectories using rm -rf .* it failed to delete the subfolders, It worked upto 5000...But it fails to delete 10000 + subdirectories at once , the I wrote a script which ...
0
votes
3
answers
378
views
How to set Linux to ask for authentication when running potentially dangerous commands?
I've faced times when I accidentally ran dangerous commands and lost all my data. How do I set Linux to ask for current user password or root user password when running potentially dangerous commands ...