Linked Questions

223 votes
12 answers
239k views

How do you move all files (including hidden) from one directory to another?

How do I move all files in a directory (including the hidden ones) to another directory? For example, if I have a folder "Foo" with the files ".hidden" and "notHidden" inside, how do I move both ...
Cory Klein's user avatar
  • 18.9k
8 votes
4 answers
7k views

How do I reference all files including hidden files? [duplicate]

I know that * references all files excluding hidden files, how to reference all files including hidden files whose names begin with a . in bash?
tmpbin's user avatar
  • 763
1 vote
2 answers
2k views

How do I select all the hidden files in the console? [duplicate]

How do I select all hidden files in a directory? ls .* selects the current folder - ., as well as it's parent ... I just want the hidden files
Casebash's user avatar
  • 1,051
1 vote
2 answers
567 views

How to avoid copying “..” while using cp command in terminal? [duplicate]

I am using CentOS7 and when I use command cp /root/test/.* /root/test1 it also copies .. which copies all the files and folder in the parent directory of the source. How to avoid copying . and ..?
Haris's user avatar
  • 19
38 votes
5 answers
28k views

Find the top 50 directories containing the most files/directories in their first level?

How can I use find to generate a list of directories which contain the most numbers of files. I'd like the list to be from highest to lowest. I'd only like the listing to go 1 level deep, and I'd ...
slm's user avatar
  • 370k
22 votes
3 answers
2k views

What does .??* mean in a shell command?

The following command will tar all "dot" files and folders: tar -zcvf dotfiles.tar.gz .??* I am familiar with regular expressions, but I don't understand how to interpret .??*. I executed ls .??* ...
SabreWolfy's user avatar
  • 1,164
9 votes
1 answer
34k views

(Why) is it bad to use ls -A to list hidden files?

I want to list every file, including hidden files, in the current directory. I don't want to include the parent (..) and current (.) directory. I found this: how to glob every hidden file except ...
Smile4ever's user avatar
6 votes
6 answers
4k views

How do I specify arguments to return all dot files, but not . and ..?

Normally dot files are not included for wildcard expansion: % echo * Applications Desktop Documents Downloads Library Movies Music Pictures Public bin If I explicitly ask for dot files, I get them: ...
Mark Adler's user avatar
  • 1,995
10 votes
4 answers
609 views

Is the behaviour of .* to include . and .. defined in LSB or POSIX or some other specification?

Is the behavior of .* to include . and .. defined in LSB or POSIX or some other specification?
Lesmana's user avatar
  • 27.4k
4 votes
2 answers
462 views

Linux: remove file*..but not file1 and file2 [duplicate]

Usually on bash i did shopt -s extglob rm !(filedontwantremove) and remove all files except filedontwantremove But if i want to remove all file except filedontwantremove and "...
elbarna's user avatar
  • 12.7k
0 votes
0 answers
89 views

Deleting a hidden file with linux command

I tried using rm -rf .* command to remove a hidden file and I am met with this error. rm: refusing to remove '.' or '..' directory: skipping '.' rm: refusing to remove '.' or '..' directory: skipping '...
Agbodike Chetam's user avatar
1 vote
1 answer
87 views

bash `if` block contents fail to execute due to syntax error on extended glob pattern in MacOS

Short Version: When extended glob is turned on inside a bash if block on my Mac, the entire block fails with a syntax error on any extend glob pattern contained in the block, even if it follows the ...
Arcticstar's user avatar
0 votes
1 answer
64 views

What command would I use to list all files and directories, including hidden ones, except . and ..?

Ok so, I know ls -a lists files including the hidden ones, and * command includes the elements I want to include. ls -I ".." -I "..." does not work as I have to use ls -a.
Tiana's user avatar
  • 3