commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
eh stands for Edit History
Frequently, I'll mistype a command, and then step back through my history and correct the command. As a result, both the correct and incorrect commands are in my history file. I wanted a simple way to remove the incorrect command so I don't run it by mistake.
When running this function, first the ~/bash_history file is updated, then you edit the file in vi, and then the saved history file is loaded back into memory for current usage.
while in vi, remember that `Shift-G` sends you to the bottom of the file, and `dd` removes a line.
this command is different than bash built-in `fc` because it does not run the command after editing.
Finds all the closing tags in a HTML document via non-greedy regex and adds a linefeed for easier reading/editing
sed -i.bak -r 's_(/[^>]*?>)_\1\n_g' filename.html
This will save a copy of filename.html as filename.html.bak and then add the linefeeds to the original file