DEV Community

Meet Rajesh Gor
Meet Rajesh Gor

Posted on • Originally published at meetgor.com

SQLite dot commands: run system shell commands

Shell dot command

If you are in middle of a sqlite shell session, and you don't want to quit the shell to run arbitrary shell command, you can simply use the .shell <command> to execute any shell commands right from within the sqlite shell. How handy is this!

.shell echo "hello, world!"
Enter fullscreen mode Exit fullscreen mode

That is a lame example, but it shows you the power of the .shell command.

Let's say I want to run a golang project, I can do this:

.shell go run main.go
Enter fullscreen mode Exit fullscreen mode

Its helpful if you want to do something but you don't want to quit the shell to do that:

  • look up few files/datapoints from the local filesystem,
  • run scripts to populate data
  • populate database and then reopen the db shell

This is are the things that I have stumbled upon, so far. Need more experience to see if there are more.

Read the entire blog post here with interactive SQL codeblocks and playground like environment

Top comments (0)