Category Archives: tips & tricks

PHPHOST BLOG

Web Hosting Related Articles You May Need

[one-liner]: Overview of Bash I/O Redirection

Background

I recently came across this question on the Stackexchange site Unix & Linux. This question was interesting in the sense that it covered much of the I/O redirection facilities that are available in the Bash Shell, so for posterity sake I’m adding my answer to this question here on my blog.

Solution

a number 1 = standard […]

Continue reading

Posted in bash, one-liner, script, shell, Syndicated, tips & tricks | Comments Off on [one-liner]: Overview of Bash I/O Redirection

[one-liner]: Fixing the WordPress “Plugin Enhanced Recent Posts” in WP v3.5.1

Background

I’ve been using the WordPress plugin, Enhanced Recent Posts, for several years now and during an upgrade to several plugins on WP 3.5.1, I noticed that I was no longer able to unroll/roll my widgets (see the 2nd screenshot below) in the Widgets area of WordPress under the menu Appearances -> Widgets (see the 1st […]

Continue reading

Posted in one-liner, Syndicated, tips & tricks, wordpress, wordpress plugin | Comments Off on [one-liner]: Fixing the WordPress “Plugin Enhanced Recent Posts” in WP v3.5.1

[one-liner]: How can I Trigger a Notification When a Command Line Job/Process Ends?

Background

Occasionally I need to notify myself when a long running command has finished. Here are a couple of tricks that I use to give me either a audible or visual notification.

Solution

The trick with this is to construct your command like so:

1
% command; command-after &

Then in the command-after position you can do things like this:

1
2
3
4
5
6
7
8
# ring […]

Continue reading

Posted in monitoring, notification, one-liner, script, Syndicated, tips & tricks | Comments Off on [one-liner]: How can I Trigger a Notification When a Command Line Job/Process Ends?

[one-liner]: How to Manipulate an Image Files Modify/Create Date/Time

Background

Recently I answer a question on superuser.com about how to modify the modify/create time/date on an image file such as a TIFF or PSD formatted file.

Solution

There are basically 2 ways to change the modify/create meta data on a file:

From the file-system’s perspective.
Within a file’s metadata.

NOTE: If you’d like to follow along here’s a sample PSD […]

Continue reading

Posted in file-format, images, one-liner, Syndicated, tip, tips & tricks | Comments Off on [one-liner]: How to Manipulate an Image Files Modify/Create Date/Time

[one-liner]: Statically building Subversion on Fedora 14

Background

In my experience it can be tricky to compile applications that make use of 3rd party libraries and/or system libraries such as glibc etc. The problem is that in addition to your application being built statically, all these libraries need to provide both a dynamic (.so) version as well as a static version (.a) and […]

Continue reading

Posted in compiling, linux, one-liner, programming, Syndicated, tip, tips & tricks | Comments Off on [one-liner]: Statically building Subversion on Fedora 14

[one-liner]: Howto get your WAN IP Address

Background

I’ve seen this question asked MANY times over the years and thought I’d write up all the various ways I’m familiar with getting your WAN IP (ISP provided) address. But before we start here’s a quick overview of some of the terminology.

IP Address:a number that identifies your computer on a network from other computers on […]

Continue reading

Posted in linux, networking, one-liner, Syndicated, tips & tricks | Comments Off on [one-liner]: Howto get your WAN IP Address

Howto Create a Daily Rotating Log in Perl using Log::Log4Perl

Background

Recently while cruising StackOverflow I came across this question where a user was trying to use the Perl module Log::Log4Perl. Log4Perl provides a mechanism similar to log4j (logging for Java) for logging mesages to various outputs such as the console or a log file. I’ve used this module a couple of times in the past […] Continue reading

Posted in perl, programming, Syndicated, tip, tips & tricks | Comments Off on Howto Create a Daily Rotating Log in Perl using Log::Log4Perl

[one-liner]: Monitoring Network Traffic with Netstat on Linux

Background

This is a quick guide to some not so obvious command-line options available in the Linux netstat(8) command. I hope you enjoy it.

Solution

1. Plain old netstat

Without any command-line arguments, “netstat” shows a list of network connections in your system, including TCP, UDP and UNIX socket connections. If you want to speed up things a bit, […] Continue reading

Posted in linux, monitoring, one-liner, redhat, rhel, Syndicated, sysadmin, tips & tricks | Comments Off on [one-liner]: Monitoring Network Traffic with Netstat on Linux

[one-liner]: LibreOffice Calc Keeps Messing with Dates

Background

I recently received an Excel spreadsheet (.xlsx) file that included dates for holidays for 2013 as my office. Dates that should’ve been displayed as 2013 dates were being displayed as 2016. I’m using a pretty recent version of LibreOffice, 3.6.0.4 (Build ID: 932b512), having just installed it on Aug 12, 2012.

bad dates

Solution

I hadn’t run […] Continue reading

Posted in LibreOffice, one-liner, Syndicated, tips & tricks | Comments Off on [one-liner]: LibreOffice Calc Keeps Messing with Dates

[one-liner]: Using scp to Copy Files that Contain Spaces

Background

Have you ever needed to copy either a single file or a directory that contains spaces using scp? Here are a couple of techniques for how to do this.

Solution

Here are several ways to accomplish the same thing. Copying a entire directory with spaces and copying a file with spaces using scp.

1
2
3
4
5
6
7
# Ways to copy entire […] Continue reading

Posted in bash, one-liner, script, Syndicated, sysadmin, tip, tips & tricks | Comments Off on [one-liner]: Using scp to Copy Files that Contain Spaces