# Useful things in (gentoo) linux

This is just a collection of some commands and tricks that I keep forgetting

• Search and replace in multiple files, using perl
perl -p -i -e 's/search/replace/g *.txt
• Change the color of a (gentoo) bash prompt
export PS1="\u@\h \w \$"\u@\h \w \ " • Operations on multiple files using bash (in this example: something interesting is done with every tex file in the current directory) for f in *.tex do echo "doing something interesting to file$f" done
• Redirect both standard error and stdout to /dev/null
2>&1 >/dev/null
• Syntax highlighting in openoffice (for presentations, for example)
Athough it seems a bit inefficient, this is the way to do it:

• open the file in kate and export it as html
• open the file in a web-browser and copy the text
• paste the text in an openoffice writer document
• save the file als .odt or export it as .rtf for use in impress
• Change the display of the "top" command, and save it for next time
• change the settings, for example like this: start top, press i, 1, d 1
• press W to save the current settings to ~/.toprc
• to use an end-of-line character to a vim search query: ctrl-V ctrl-M
This entry was posted in gentoo, linux. Bookmark the permalink.