Tag Archives: Search

Unix: Command history search

In a Unix Bash shell we can scroll through previous commands by using the up and down arrow keys, but we can also search for previous commands. I keep forgetting how, so time to write it down ๐Ÿ˜›


Start a command search

Run the command directly
Ctrl+e or Ctrl+a

Exit search and jump to the end or beginning of command.
รขโ€ ย or รขโ€ โ€™

Exit search and move through command as usual

Remove everything after the current cursor position and to the end of the command

Finding all constraints and their affected columns in an Oracle database

Found an SQL script to list all constraints in an Oracle database together with affected columns. Putting it here in case I need it again… Took a while to run, but sure beats having to look through all the table definitions to find what exactly is preventing me from deleting a row…

  AND UCC1.POSITION = UCC2.POSITION -- Correction for multiple column primary keys.

If you’re just looking for one particular constraint you can of course also add and UC.CONSTRAINT_NAME = 'SOME NAME' ๐Ÿ™‚

Some speedy WordPress fixes

Used Page Speed for FireFox the other day to analyze my blog. Found a couple of issues and a couple were very simple to fix. If these will work for you, depends a bit on where your WordPress site is hosted and what your web server does already. So, be brave and analyze your own site. Look through the results and see if you can fix some of it without too much hassle ๐Ÿ™‚

Continue reading Some speedy WordPress fixes

Unix: Recursive search for text in files

Keep forgetting how to do this, so here it is. How to do a quick and simple, recursive search for text using grep. Hint: It’s very simple.

$ grep -rl "some text" .

That’s all there is to it! grep is the command, r makes the search recursive (i.e. in the target folder and all its sub-folders), l means it will list the name of all the files where it finds the text, "some text" is the string to search for, and finally, the dot at the end means to start the search in the current directory. And just to clarify, this searches for text inside of files, in the content of the files; not the filenames.

There, now I know where to find it when I forget it next time. And perhaps I have helped someone else too ๐Ÿ™‚

Good night!