Friday, April 29, 2011

Converting all files in a directory to lowercase.

Converting all files in a directory to lowercase.


#!/bin/sh
# lowerit
# convert all file names in the current directory to lower case
# only operates on plain files--does not change the name of directories
# will ask for verification before overwriting an existing file
for x in `ls`
do
if [ ! -f $x ]; then
continue
fi
lc=`echo $x | tr '[A-Z]' '[a-z]'`
if [ $lc != $x ]; then
mv -i $x $lc
fi
done

Wow. That's a long script. I wouldn't write a script to do that; instead, I would use this command:

for i in * ; do [ -f $i ] && mv -i $i `echo $i | tr '[A-Z]' '[a-z]'`;
done;

on the command line.

How do i give users an ftp only account (no telnet, etc)?

How do i give users an ftp only account (no telnet, etc).?


give them shell which doesn't work, but is listed in /etc/shells
for example /bin/false...

Saturday, April 2, 2011

Speeding up your hard drive

Get faster file transfer by using 32-bit transfers on your hard drive in Linux Machines

Just add the line:

hdparm -c3 /dev/hdX

to a bootup script.

If you use SuSE or other distros based on SYS V,


/sbin/init.d/boot.local

should work for you.

This enables 32-bit transfer on your hard drive. On some systems it can improve transfer performance by 75%.

To test your performance gain, type:

hdparm -t -T /dev/hdX