Commands by hiepdev (3)

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

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

vi case insensitive search

Set access and modification timestamps of a file using another one as reference
atime and mtime timestamps of $FILE2 is changed according to the ones of $FILE1. If $FILE2 doesn't exist is created.

Filter the output of a file continously using tail and grep
The OPs solution will work, however on some systems (bsd), grep will not filter the data, unless the --line-buffered option is enabled.

A DESTRUCTIVE command to render a drive unbootable
Overwrites the boot sector. Since this doesn't overwrite any data, you can usually recover by re-creating the partition table exactly the same as before you zeroed it. This can also help sometimes if you install a new drive in a Windows machine which can't read it.

Find where a kind of file is stored
In this case searches for where .desktop files are stored. The resulted is a sorted list of the top directories containing such files.

a simple bash one-liner to create php file and call php function

Debug pytest failures in the terminal
pudb is an ncurses debugger. This command will allow interactive debugging of test failures in pytest using pudb.

Kill a broken ssh connection
This is useful for example if you are on ssh in a server and the server goes down without letting you out. This is part of a larget sets of escape sequences provided by ssh. You can find them with ~? Here's the list: ~. - terminate connection (and any multiplexed sessions) ~B - send a BREAK to the remote system ~C - open a command line ~R - request rekey ~V/v - decrease/increase verbosity (LogLevel) ~^Z - suspend ssh ~# - list forwarded connections ~& - background ssh (when waiting for connections to terminate) ~? - this message ~~ - send the escape character by typing it twice (Note that escapes are only recognized immediately after newline.)

Create MySQL-Dump, copy db to other Server and upload the db.
This option makes a copy of your current db and via ssh it transfer to the server you specify and upload the database to the specific User & Password you specify (Note the db User & Pass, can be different from the one you use in the other server) If you are going to use "localhost" as your main db remove (-h) and youst add "localhost"

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: