How to move selected files in Linux via a one liner.command? Moving files is quite straight forward with mv command, if need to move a hundred or more files is another story. However, a group of commands like piping the output of the command to another command will make life easier. First, do an ls or list the files before moving the files to make sure those are the files that needs to be moved. ls | egrep -iv "*2025-11*" | egrep -iv "*2025-11-template*" After checking or listing the files then do the actual move. Here's an example: ls | egrep -iv "*2025-11*" | egrep -iv "*2025-11-template*" | xargs -I {} mv {} /my backup/logfiles The -iv parameters tells egrep to filter case insensitively and only shows files that doesn't match the pattern. That's it make life easier, work smart not hard. Let the technology work for you. Trust in God, Pray and don't worry. God is in Control, Be still.
Make the world a better place by sharing knowledge, ideas and anything that you can give that comes from the heart.