My name is Stefan Ashwell and when I'm not coding personal projects or painting miniatures, I'm a Web Developer at CWA in Leicester.

This blog is a place for me to write about things that require that little bit extra to solve. We all have gaps in our knowledge and every now and then I need to reach out on search engines or blogs to find an answer. Often, these answers come from multiple sources. This blog serves as a personal resource, but if it's helpful for me I'm sure it'll help others too!

SSH How to move all files up one directory – including hidden files

Posted on 16 April 2018

This is one command that comes up every now and then and I always forget it! So to save some time Googling the answer I thought I’d post it here as a quick reminder.

The command will move all files in the current directory – including hidden files – up one directory.

mv * .[^.]* ..

Here’s what’s going on. The mv command moves files and directories. The last argument to mv is the target (in this case the directory one step “up” in the tree, ..). The arguments before that are the source files and directories. The asterisk (*) is a wildcard which matches all files which do not start with a dot. Files that start with a dot (dotfiles) are “hidden”. They are matched using the pattern .[^.]*.