Skip to main content

Posts

Showing posts from November, 2025

Move selected files in Linux

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.

vim or vi searching for whole words or string

Search for a whole word or string in VI or VIM, can be done easily and a time savee so no need to keep pressing next or 'n' for the next match. How to search for a whole word or string in VI or VIM? Example open a file with a list of IP addresses. vim list-of-local-ips.txt Example contents: 192.168.13.130 192.168.13.131 192.168.13.1 192.168.13.135 192.168.13.137 192.168.13.23 192.168.13.13 192.168.13.100 If vi or vim is insert mode, press ESC until it's in command mode, If need to search for 192.168.13.1, or just 13.1 In comand-line mode type:  :/\<13.1\> and press enter  Or see picture below: After pressing enter it will go directly to 192.168.13.1,  if /13.1 is type then it will match also 192.168.13.135, 192.168.13.131 etc.. But with the /\<word or string\> syntax it will find the whole word. That's it, explore vi/vim for time saver tips. Cheers! Lift up your needs in Prayer; with a humble and contrite heart. God listens to the broken hearted....