Commands tagged sqlite (11)


  • 18
    find ~/.mozilla/firefox/ -type f -name "*.sqlite" -exec sqlite3 {} VACUUM \;
    grokskookum · 2009-09-01 21:45:46 10
  • Sqlite database keeps collecting cruft as time passes, which can be cleaned by the 'vacuum;' command. This command cleans up the cruft in all sqlite files relating to the user you have logged in as. This command has to be run when firefox is not running, or it will exit displaying the pid of the firefox running.


    11
    pgrep -u `id -u` firefox-bin || find ~/.mozilla/firefox -name '*.sqlite'|(while read -e f; do echo 'vacuum;'|sqlite3 "$f" ; done)
    kamathln · 2009-08-22 10:36:05 10
  • For Mac OS X users only


    1
    find ~/Library/Application\ Support/Firefox/ -type f -name "*.sqlite" -exec sqlite3 {} VACUUM \;
    stanishjohnd · 2009-09-02 23:12:13 3
  • Filters out all non-insert SQL operations (we couldn't filter out only lines starting with "INSERT" because inserts can span multiple lines), quotes table names with backticks, saves dump to a file and pipes it straight to mysql. This transfers only data--it expects your schema is already in place. In Ruby on Rails, you can easily recreate the schema in MySQL with "rake db:schema:load RAILS_ENV=production".


    0
    sqlite3 mydb.sqlite3 '.dump' | grep -vE '^(BEGIN|COMMIT|CREATE|DELETE)|"sqlite_sequence"' | sed -r 's/"([^"]+)"/`\1`/' | tee mydb.sql | mysql -p mydb
    mislav · 2009-10-02 14:40:51 4
  • Similar output to using MySQL with the \G at the end of a Query. Displays one column per line. Other modes include: -column Query results will be displayed in a table like form, using whitespace characters to separate the columns and align the output. -html Query results will be output as simple HTML tables. -line Query results will be displayed with one value per line, rows separated by a blank line. Designed to be easily parsed by scripts or other programs -list Query results will be displayed with the separator (|, by default) character between each field value. The default. From inside the command line this can be also changed using the mode command: .mode MODE ?TABLE? Set output mode where MODE is one of: csv Comma-separated values column Left-aligned columns. (See .width) html HTML code insert SQL insert statements for TABLE line One value per line list Values delimited by .separator string tabs Tab-separated values tcl TCL list elements Show Sample Output


    0
    sqlite3 -line database.db
    pykler · 2010-10-09 16:10:19 8

  • 0
    sqlite3 -csv ~/.thunderbird/*.default/calendar-data/local.sqlite "SELECT CASE WHEN priority IS NULL THEN 5 ELSE priority END AS priority, title FROM cal_todos WHERE ical_status IS NULL ORDER BY priority ASC, last_modified DESC;"
    hfs · 2011-01-26 13:27:13 3

  • 0
    sqlite> select date('now', 'start of year', '+4 months', 'weekday 0', '+7 days');
    kev · 2011-05-23 13:18:55 14
  • Newer versions of Dropbox let you choose the location for your Dropbox folder. If you use script to put things into your Dropbox folder (todo list, screenshots, torrents etc.) but have the Dropbox folder in different locations on your other computers this lets you use the same script on all systems without having to tell it where the Dropbox folder is. Show Sample Output


    -1
    sqlite3 $HOME/.dropbox/config.db "select value from config where key like '%dropbox_path%'"
    mobilediesel · 2011-06-05 08:26:02 13

  • -1
    find ~ -name '*.sqlite' -exec sqlite3 '{}' 'VACUUM;' \;
    kev · 2011-06-29 16:36:05 3

  • -2
    find ~/.mozilla -name '*.sqlite' -exec sqlite3 {} VACUUM \;
    kev · 2012-04-26 15:09:54 7
  • This command defragment the SQLite databases found in the home folder of the current Windows user. This is usefull to speed up Firefox startup. The executable sqlite3.exe must be located in PATH or in the current folder. In a script use: for /f "delims==" %%a in (' dir "%USERPROFILE%\*.sqlite" /s/b ') do echo vacuum;|"sqlite3.exe" "%%a" Show Sample Output


    -3
    for /f "delims==" %a in (' dir "%USERPROFILE%\*.sqlite" /s/b ') do echo vacuum;|"sqlite3.exe" "%a"
    vutcovici · 2010-01-18 20:56:00 6

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Listing package man page, services, config files and related rpm of a file, in one alias
Many times I give the same commands in loop to find informations about a file. I use this as an alias to summarize that informations in a single command. Now with variables! :D

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

save date and time for each command in history
Date-time format: YYYY-MM-DD HH:MM:SS

Write comments to your history.
A null operation with the name 'comment', allowing comments to be written to HISTFILE. Prepending '#' to a command will *not* write the command to the history file, although it will be available for the current session, thus '#' is not useful for keeping track of comments past the current session.

sort lines by length
making it "sound" more "natural" language like -- additionally sorting the longest words alphabetically: this approach is using: * to get at all lines of input * post-"for" structure * short-circuit-or in sort: if the lengths are the same, then sort alphabetically otherwise don't even evaluate the right hand side of the or * -C sets all input and ouput channels to utf8

create a simple version of ls with extended output
create a short alias for 'ls' with multi-column (-C), file type syntax additions (slashes after directories, @ for symlinks, etc... (-F), long format (-l), including hidden directories (all ./, ../, .svn, etc) (-a), show file-system blocks actually in use (-s), human readable file sizes (-h)

List detailed information about a ZIP archive
list zipfile info in long Unix ``ls -l'' format.

Recursively remove .svn directories from the current location

check open ports without netstat or lsof

Create a zip file ignoring .svn files


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: