Commands by olalonde (1)

  • grep searches through a file and prints out all the lines that match some pattern. Here, the pattern is some string that is known to be in the deleted file. The more specific this string can be, the better. The file being searched by grep (/dev/sda1) is the partition of the hard drive the deleted file used to reside in. The ?-a? flag tells grep to treat the hard drive partition, which is actually a binary file, as text. Since recovering the entire file would be nice instead of just the lines that are already known, context control is used. The flags ?-B 25 -A 100? tell grep to print out 25 lines before a match and 100 lines after a match. Be conservative with estimates on these numbers to ensure the entire file is included (when in doubt, guess bigger numbers). Excess data is easy to trim out of results, but if you find yourself with a truncated or incomplete file, you need to do this all over again. Finally, the ?> results.txt? instructs the computer to store the output of grep in a file called results.txt. Source:

    grep -a -B 25 -A 100 'some string in the file' /dev/sda1 > results.txt
    olalonde · 2010-08-19 20:07:42 4

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

Make a DVD ISO Image from a VIDEO_TS folder on MacOSX
/path/ is the root folder of the DVD, not the VIDEO_TS folder.

Remove sound from video file using mencoder
Remove sound from input video file, output video stream is copied from input video stream, with no audio.

Know which version dpkg/apt considers more recent
Compares two versions with dpkg. It is not always obvious what version dpkg/apt will consider to be more recent. Operators include the following : * These treat an empty version as earlier than any version: lt le eq ne ge gt. * These treat an empty version as later than any version: lt-nl le-nl ge-nl gt-nl. * These are provided only for compatibility with control file syntax: < > >. This command doesn't output anything. It only returns with status 0 or 1, hence the echo "y" || echo "n" to get an output.

To create files with specific permission:

Bypass 1000 Entry limit of Active Directory with ldapsearch
That command bypass the entry limit specifing page results size, when the search arrive to the limit ldapsearch magically reiterate it from the last entry.

ssh X tunneling over multiple ssh hosts (through ssh proxy)
Simply makes it possible to launch any X application residing on sshhost through sshproxy and display it on your screen where ever you are.

Rank top 10 most frequently used commands

Restore mysql database uncompressing on the fly.
This way you keep the file compressed saving disk space. Other way less optimal using named pipes: mysql -uroot -p'passwd' database <

View internet connection activity in a browser
In addition to generating the current connections, it also opens then in your default browser on gnome.

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

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: