dacaprice.com from fitness to technology.

22Feb/100

Change uppercase filenames to lowercase

I needed to rename a handful of image files from my iPhone from all uppercase letters to lowercase.  I did this in a bash shell in Fedora linux. Here's how I did it:

[dacaprice@fedora10]$ for i in `ls *JPG`
do
mv $i `echo $i |  tr '[:upper:]' '[:lower:]'`
done

Tagged as: , No Comments
3Jan/100

How to run fsck on a Logical Volume in Linux.

I recently had a problem on my laptop running Fedora 11 where my X session just totally froze when trying to bring the laptop back from a hibernate state.  Outside of the occasional issues coming out of hibernate (usually X not restoring) I'd say Fedora 11 has been pretty solid.  This particular time, my X session restored but everything locked up.  I tried switching to another virtual terminal to log in and kill GDM but some sort of inode error just streamed down the console.  My only option was a hard reboot and after that I couldn't boot Fedora with any kernel.  To fix my problem I booted off the Fedora install CD into rescue mode without mounting  / .  I then performed the following:

# lvm pvscan
# lvm vgscan
# lvm lvchange -ay /dev/VolGroup00/LogVol_home
# lvm lvscan
# fsck -yfv /dev/VolGroup00/LogVol_home

Tagged as: , No Comments
21Nov/091

Connect to Cisco routers using screen

screen is a Linux utility that I use to connect to the console on Cisco routers.  If your router is plugged in to a serial port on a Linux box, you can use the following command to connect to it:

[dacaprice@FedoraBox ~]$ screen /dev/ttyS0

Tagged as: 1 Comment
11Nov/090

Changing sdiff column width in Linux

I use sdiff pretty often to do a side-by-side comparison of config files on my Linux box. The thing that annoys me the most is the default column width; often whatever it is I am comparing, gets cut short because the width is too narrow. I like use the -w ColumnWidth to set a wider width and the -s to supress any common lines.

[dacaprice@fedora]$ sdiff -s -w 150 file1 file2

Tagged as: No Comments
4Oct/091

Using script to record a terminal session.

script is a useful utility in Linux that records everything that is printed to stdout to a specified file.

[dacaprice@fedora10 ~]$ script filename.txt

I find script particularly useful for capturing a large amount of output from a router or firewall that I need to save it to a file.

Tagged as: 1 Comment