Commands tagged sqlite3 (6)

  • This is the way to get access to your Firefox history...

    sqlite3 ~/.mozilla/firefox/*.[dD]efault/places.sqlite "SELECT strftime('%d.%m.%Y %H:%M:%S', visit_date/1000000, 'unixepoch', 'localtime'),url FROM moz_places, moz_historyvisits WHERE = moz_historyvisits.place_id ORDER BY visit_date;"
    return13 · 2015-02-24 21:51:14 1
  • Found this useful query at The b.parent=2 in the command refers to the bookmarks folder to extract. See the source webpage for additional info.

    sqlite3 ~/.mozilla/firefox/*default/places.sqlite "select a.url, a.title from moz_places a, moz_bookmarks b where and b.parent=2;"
    jrdbz · 2013-04-12 17:41:34 1
  • Crude, but works. Note for security, /data/ will be inaccessible unless your device has been *rooted*. On the other hand, if a device has been rooted, its data is now wide open to anyone with a USB cable and the above "one-liner". `adb` is one of the platform tools in the android SDK. To get SMS messages: adb pull /data/data/ ; sqlite3 -batch <<EOF contacts2.db <CR> .header on <CR> .mode tabs <CR> select * from sms; <CR> EOF

    adb pull /data/data/ ; sqlite3 -batch <<EOF contacts2.db <CR> .header on <CR> .mode tabs <CR> select * from data; <CR> EOF
    mhs · 2012-12-26 11:35:23 3
  • Extracts yours bookmarks out of sqlite with the format: dateAdded|url Show Sample Output

    sqlite3 ~/.mozilla/firefox/*.[dD]efault/places.sqlite "SELECT strftime('%d.%m.%Y %H:%M:%S', dateAdded/1000000, 'unixepoch', 'localtime'),url FROM moz_places, moz_bookmarks WHERE = ORDER BY dateAdded;"
    return13 · 2015-03-08 19:26:16 0
  • 1. First we get the `item_id` for that `comment`. Adapt the -C[N] parameter for your use. 2. Then we show the bookmark's `title` (or `url`). With that in your hand it's a matter of seconds to open Firefox's library and find the bookmark. Handy for eg. forensics or better sanitize of a place.sqlite before sharing it (on the cloud). It sure has room for improvement. Show Sample Output

    sqlite3 -list places.sqlite 'SELECT item_id, content FROM moz_items_annos ;' | grep -A9 "string" ; sqlite3 places.sqlite 'SELECT title FROM moz_bookmarks WHERE .fk = <item_id number> ;'
    datruche · 2015-10-31 19:32:52 0
  • Speed up Google Chrome like speedyfox does for MAC USER. This script will detect all SQLITE DATABASE on the Google directory

    cd "/Users/$USER/Library/Application Support/Google" && find . -print|while read line;do (file "$line"|grep SQLite) && (sqlite3 "$line" "VACUUM;";echo "Compress");done;
    c0derz · 2016-04-03 13:46:40 0

What's this? 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

Rsync using SSH and outputing results to a text file
--delete will delete copies on remote to match local if deleted on local --stats will output the results -z zip -a archive -A preserve ACL -x don't cross filesystem boundaries -h human readable -e specify the remote shell to use

connects to a serial console
cu (call UNIX) establishes a full-duplex connection to another machine (*BSD) using a serial console. It becames more useful than screen if you have to send a BREAK signal. using cu just type "~#". $man cu

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

Create md5sum of a directory

Get your Firefox history
This is the way to get access to your Firefox history...

Optimal way of deleting huge numbers of files
Optimal way of deleting huge numbers of files Using -delete is faster than: $ find /path/to/dir -type f -print0 | xargs -0 rm $ find /path/to/dir -type f -exec rm {} + $ find /path/to/dir -type f -exec rm \-f {} \;

Execute a command with a timeout
A timeout is great, but what if the command is taking longer than expected because it's hung up or ran into some other problem? That's where the -k option comes in. Run "some_command" and timeout after 30s. If the command is still running after 1 minute, it will receive a kill signal.

Display summary of git commit ids and messages for a given branch
In color. Additionally you may define in your ~/.gitconfig and run it just as 'git one': one = log --pretty='format:%Cgreen%H %Cred%ai %Creset- %s'

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

Instantly load bash history of one shell into another running shell
By default bash history of a shell is appended (appended on Ubuntu by default: Look for 'shopt -s histappend' in ~/.bashrc) to history file only after that shell exits. Although after having written to the history file, other running shells do *not* inherit that history - only newly launched shells do. This pair of commands alleviate that.

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.


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: