If you run a recent vintage of Ubuntu, you may encounter the following dpkg error when you’re trying to update or install packages. This is usually caused by Ubuntu simultaneously running another instance of the package manager, often on system startup. Still, it can be annoying when you’re trying to update your system. So you […]
Tag: Bash
Bash: Make a Web Site Index
An old Bash script that uses awk to construct an index with hyperlinks from the .html files in a web tree. Attempts to use the <title> tag to name each link. To use, change your directories in the ‘for dir’ line to the directories you want to scan, then run the script: ./myscript.sh > myfile.html.
Stop xmlrpc.php Attacks
Summary: how to diagnose and eliminate the xmlrpc.php WordPress exploit when it’s clobbering your web server. You’ve been running a public Ubuntu 12+ and Apache/LAMP web server for a while now. Until recently everything has worked fine, but suddenly your server is struggling to display even static pages. Sometimes content takes forever to load, and […]
Bash: WordPress Installer
A basic WordPress installer in Bash. Assumes Ubuntu 14.04 LTS, so adjust as necessary. The end-of-line backslashes here are added for ease of display, so remove them before running this.
wget and cURL
wget wget is a GNU utility for retrieving files over the web using the popular internet transfer protocols (HTTP, HTTPS, FTP). It’s useful either for obtaining individual files or mirroring entire web sites, as it can convert absolute links in downloaded documents to relative links. The GNU wget manual is the definitive resource. Some Useful […]
sed and awk
sed and awk are two powerful but often overlooked data processing tools, and if you know how to use them effectively you’ll be well ahead of many sysadmins and developers. sed sed is an in-place stream editor, that is, it accepts input from a file or STDIN, manipulates the data stream in some way, and […]
grep
grep is a useful utility that finds fixed strings or patterns of text in a given file or standard input. Used in conjunction with error logs or debugger output, grep can help a programmer identify errors in an application code base or filesystem; to help with this, grep understands regular expressions, what it calls “extended” […]
Fedora 20 Installation Woes
Attempting to install Fedora 20 on an older i7 system recently produced a series of failures. For starters, after the installation allegedly completed, the system would hang after the BIOS screens at the point where the OS should start. That’s because Anaconda installed no bootloader. A computer isn’t very useful with no operating system. To […]
Back Up MySQL Databases
A simple bash script to back up MySQL databases. This backs up every database on the server to individual gzipped files in the directory you specify so that you can easily restore them separately. If you want it to run everyday, save it with an .sh extension and add it to the crontab of an […]
Linux Command Line Tricks
Here are some Linux command line tricks I use on occasion for search and replace. This presumes the use of GNU utilities, so commands and results will vary on different platforms. Some cheat sheets: Sed | Awk | Perl | Bash See also the sed/awk and grep pages. Replace A with B in all files […]