Archives for December, 2010

29
Dec

Creating a “Fluff” File Filled with Specified or Random Text

Described below are two different methods for quickly generating a certain size of fluff, or filler, to be inserted into a text file for testing purposes. The first method is to use a single line command which will very quickly fill a file with random text (must have base64 installed). The second method is to use a script that will quickly fill a file with text that the user specifies (there are some limitations).
[Read more →]

27
Dec

Change Terminal Behavior to be Similar to VI

Use the following command to setup your shell to have similar key behavior to vi.  If you’re already familiar with the keybindings of vi, then you may appreciate the ability to quickly search/edit your history, or navigate through your commands quickly.  One example I heard about was being able to change a single character in a massive 200 character command.

set -o vi

You could include this command within your ~/.bashrc or ~/.bash_profile files as well so you have it when you login to a shell.

24
Dec

Happy Holidays!

Happy holidays everybody! I hope ya’ll have something special planned to end 2010 with a bang. ;-) Get off the computer, throw your modem into standby (or unplug it), and go spend some time with family!

22
Dec

Determine Which Terminal Shell You’re Running

It’s very simply to determine which shell you’re using while logged into a Linux terminal.  Simply run the following command:

ps -p $$ | tail -n1 | cut -d" " -f26

You’ll get in return, the shell command you’re using (plus the full path to it).

user@localhost$ ps -p $$ | tail -n1 | cut -d" " -f26
/usr/bin/bash

Another way to do it would be to use awk instead of cut:

ps -p $$ | tail -n1 | awk '{print $NF}'
20
Dec

Larry Ellison (Oracle CEO) on the Term “Cloud Computing”

I’ll make your Monday morning easy thinking and present a little video I enjoy from time to time.

YouTube Preview Image

I’m with him.  Being a person who has gone through the Cisco Networking Academy to learn about network engineering, the buzzword “Cloud Computing” is totally overrated.  I sorta giggle inside every time I hear about it and I stop and think “it’s just Ethernet and computers”.

3
Dec

A Good Read: The Art of Unix Programming

Looking for more reading material to quench the thirst for Linux knowledge? If so, take a look at the book called “The Art of Unix Programming” by Eric S. Raymond. You can find it online here:
http://www.faqs.org/docs/artu/

1
Dec

Recursive Search/Replace Text from Terminal

This came in handy for myself the other day and I figured it might come in handy for some of you out there. This is a quick command that will recursively do a find and replace for certain keywords by using a combination of grep and sed. Basically, we search recursively using grep and then we pipe in the filenames into sed for the string replacement.

grep -Irl keyword . | xargs sed -i 's/keyword/replacement/g'

Here’s a breakdown of the options used (I’ll assume you’re familiar with xargs and piping):

grep -I will ignore binary files
grep -r is recursive
grep -l will spit out the filename only
sed -i will edit the files in place