Category Archives: shell

PHPHOST BLOG

Web Hosting Related Articles You May Need

[one-liner]: Working with ssh-keygen & SSH Key Pair Files

Background

Here are some typical examples for creating ssh RSA key files. SSH keys are generated & modified using the command ssh-keygen.

Example #1 – defaults

For starters here’s what happens when you run ssh-keygen with just it’s defaults:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
% ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jaml/.ssh/id_rsa):
Enter passphrase (empty for no […] Continue reading

Posted in linux, one-liner, Security, shell, ssh, Syndicated, tips & tricks | Comments Off on [one-liner]: Working with ssh-keygen & SSH Key Pair Files

[one-liner]: Working around the SSH error message: Too many authentication failures for root

Background

Yesterday I ran into an issue while trying to ssh to one of my computers. I started getting this error, Too many authentication failures for root. At first I thought it has something to do with PAM or some sort of login detection protection related to /var/log/btmp (a log file maintaining bad login attempts). Turns […] Continue reading

Posted in linux, one-liner, Security, shell, ssh, Syndicated, sysadmin, tip, tips & tricks | Comments Off on [one-liner]: Working around the SSH error message: Too many authentication failures for root

[one-liner]: Calculating Disk Space Usage for a List of Files Using du under Linux

Background

Being the most techie of my group of friends I often get other people’s problems dumped into my lap when something goes wrong with their computer. I generally don’t mind since it gives me the opportunity to help out a friend and work on some obscure problems, such as:

* issue #1: laptop no longer works, […] Continue reading

Posted in backup, linux, one-liner, shell, Syndicated, sysadmin, tip, tips & tricks | Comments Off on [one-liner]: Calculating Disk Space Usage for a List of Files Using du under Linux

[one-liner]: Working with VMware ESXi 3.5 via the command line

Background

Recently I’ve been getting more hands on experience with VMware ESXi 3.5 at my day job. It seems pretty capable in it’s free version form. After familiarizing myself with the command line shell over the last few days it’s finally starting to make sense. If you’ve worked on any Red Hat distros such as Fedora/CentOS/RHEL […] Continue reading

Posted in one-liner, server, shell, Syndicated, sysadmin, tip, tips & tricks, virtualization, vmware | Comments Off on [one-liner]: Working with VMware ESXi 3.5 via the command line

[one-liner]: How to make CD & DVD .iso images from physical CDs/DVDs on Linux via the Command Line

Background

Quick tip on how to make CD & DVD .iso images from physical CDs/DVDs via the command line.

Solution

There are many ways but these are probably the 2 more common ones.

using the cat command

1
% cat /dev/dvd > ~/image1.iso

using the dd command

1
% dd if=/dev/dvd of=~/image1.iso bs=2048

NOTE: On my Thinkpad 410 laptop my CD/DVD drive has the […] Continue reading

Posted in linux, one-liner, shell, Syndicated, sysadmin, tip, tips & tricks | Comments Off on [one-liner]: How to make CD & DVD .iso images from physical CDs/DVDs on Linux via the Command Line

How to use rvm installs of Ruby in shell & CGI scripts

Background

Before I get started some quick defninitions:

Ruby : a programming language
rvm : Ruby Version Manager, tool for managing rubies

If you’ve had to work with multiple versions of Ruby in the past, the power of rvm is very compelling. Gone are the headaches of trying to get multiple versions to coexist nicely on a single box. […] Continue reading

Posted in programming, Ruby, rvm, shell, Syndicated, sysadmin, tip, tips & tricks | Comments Off on How to use rvm installs of Ruby in shell & CGI scripts

[one-liner]: Copying a Subset of Files in a Directory using cpio

Background

Recently I needed to make copies of a bunch of files: .mp3, .doc, .xls, .ppt, and .jpg from an old windows hard drive. This gave me a chance to try out my recently purchased Rosewill SATA or IDE 3-in-1 (5.25″, 3.5″, 2.5″) to USB2.0 Cable Converter Adapter (part#: RCW608). The product url is here.

Rosewill Setup

The […] Continue reading

Posted in one-liner, shell, Syndicated, sysadmin, tip, tips & tricks | Comments Off on [one-liner]: Copying a Subset of Files in a Directory using cpio

[one-liner]: Previewing a Pretty Printed Text File using enscript & ps2pdf

Background

Before my wife and I had kids we thought it would be nice to collect the United States quarters that were released during 1999 through 2008 to commemorate each of the 50 states. Seemed like something simple to do and would be a nice gift for the kids when they got older. So we bought […] Continue reading

Posted in one-liner, shell, Syndicated, tips & tricks | Comments Off on [one-liner]: Previewing a Pretty Printed Text File using enscript & ps2pdf

[one-liner]: Copying & Moving Files efficiently with xargs

Background

From time to time I need to move and/or copy a subset of files from one directory to another. I typically would use something like one of these to do the task:

1
2
3
4
5
#– COPY
find . -type f -ctime -1 | xargs -I {} cp {} /some/other/directory
 
#– MOVE
find . -type f -ctime -1 | xargs -I {} […] Continue reading

Posted in one-liner, shell, Syndicated, tips & tricks | Comments Off on [one-liner]: Copying & Moving Files efficiently with xargs

[one-liner]: How to Use the Bash Shell’s export Command

Problem

Recently at my day job I’ve been having to go through some pretty old Bash scripts that I’ve basically inherited. As I’ve been going through them I’ve been seeing a lot of confusion as to the proper use of Bash’s export command. The major offense? Not really understand whether a particular variables needs to be […] Continue reading

Posted in bash, one-liner, shell, Syndicated, tip, tips & tricks | Comments Off on [one-liner]: How to Use the Bash Shell’s export Command