Just a quick question:
How would I copy ONLY hidden files using (a) the cp, and (b) the tar commands in the command line?
I’ve been trying to brush up on CLI a bit, but I can’t figure this one out …
Cheers,
homoludens
Just a quick question:
How would I copy ONLY hidden files using (a) the cp, and (b) the tar commands in the command line?
I’ve been trying to brush up on CLI a bit, but I can’t figure this one out …
Cheers,
homoludens
cp /home/*username/.*filename <to location>
eg: from my terminal
cp /home/kernelcruncher/.xsession-errors /home/kernelcruncher/bin
Thanks, but what about copying several files? (For example, all files starting with “K”,or all hidden files in a given directory?)
In these cases, the placeholder “.*” doesn’t seem to work as all files are copied, not just the hidden ones.
homoludens
Most hidden files are of the form .[A-Za-z]*, so you can use this glob:
cp .[A-Za-z]* destination-directory
If you have numeric dotfiles, then add 0-9 to the brackets.
Thanks!
What about, for example, copying ALL FILES EXCEPT files 1-n? (e.g. all except .kde, .kde4)
Try a glob like:
.^.1-n]*