November 18

Linux: journalctl -xef

The -x gives explanations to the log text when available
The -e jumps to the end of the log
The -f shows only the most recent journal entries, and continuously print
new entries as they are appended to the journal

Category: Linux | Comments Off on Linux: journalctl -xef
November 18

Linux: Finding text within multiple files in multiple directories and replacing the text

I like to start these type of recursive runs in the root directory of the search. So in our test case I would do the following:

Eg. Find the port number 8080 in multiple .xml files and replace it with the port number 15001.

  1. cd /path/rootdirectoryofsearch

*note – Change which files get examined by changing the extension type:

  1. Then run the command
    With Backup .mybackup
    find . -type f -name “*.xml” -exec sed -i.mybackup -e ‘s/8080/15001/g’ {} +
  2. Delete backups:
    find . -name “*.mybackup” -type f – delete
  3. With Backup
    find . -type f -name “*.xml” -exec sed -i” ‘s/8080/15001/g’ {} +

Category: Linux | Comments Off on Linux: Finding text within multiple files in multiple directories and replacing the text