find <starting point> <search criteria> <action> The starting point is the name of the directory where find should start looking for files. The find command examines all files in this directory (and any subdirectories) to see if they meet the specified search criteria. If any do, find performs the specified action on each found file.…
You are currently browsing the post archives for July 2008.
The all powerful find command
Comment on The all powerful find command
Another Linux Web MySQL Backup Script
I found this on on the nixcraft craft. Looks pretty good to me. Similar in functionality to my other script posted here. I’m going to poach some concepts from here to make a script that will auto-optimize all tables in all databases on the mysql server. #!/bin/sh ################## ## jcz 17-feb-2007 ## copied from http://www.cyberciti.biz/tips/…
Comment on Another Linux Web MySQL Backup Script
gzip all directories in a directory
I don’t know why I keep having to do this, but I do. I always to create separate archives of all the directories in a directory. So, here is script from David (aka Matir aka EmptyCinema) from linuxquestions.org http://www.linuxquestions.org/questions/showthread.php?s=&postid=1839513#post1839513 to do just that (along with a sample sessions using it). #!/bin/bash for dir in */…
Comment on gzip all directories in a directory
Postgis data loader from shapefile bash shell script
Run this script in a directory of shp files to create STDOUT that will load them all into postgis —————————————————— #!/bin/sh # jcz aug 24, 2005 # clip off the “.shp” file extensions before use # drops existing shapes if they are the same name for z in `ls *.shp do echo “shp2pgsql $z $z…
Comment on Postgis data loader from shapefile bash shell script
Bash shell script for creating a poor man’s CD-ROM (removable media) catalog for linux
#!/bin/sh # jcz 2004-jan-12 # assumes iso9660 CD-ROM mount -t iso9660 -r /dev/cdrom /mnt/cdrom echo “Disc Mounted. Run this program, then grep keywords in the “ echo “cdcatalogs directory to find which CD-ROM some file “ echo “is on. “ # makes the directory to store the catalog files mkdir cdcatalogs # runs volname (part…
Comment on Bash shell script for creating a poor man's CD-ROM (removable media) catalog for linux
Paths on Linux
Today I’m going to do a test install of the J2EE mapserver-like facilities provided by geoserver version 1.3 Rc2. I recently installed java and the JDK on this machine, so I still need to set JAVA_HOME in the path. I do this so rarely everytime I need to do it I have to look it…
Tips for using the ls command to list files in Cygwin or Linux
Classify ls –classify or ls -F will append characters to files to show their type: * / directory * * executable Code: ls -F directory/ me.jpeg script.sh* ls –color=tty Will color the ‘ls’ output. Directories are blue, regular files stay black (or white) and executable files are green. Make an Alias of your prefered method.…
Comment on Tips for using the ls command to list files in Cygwin or Linux
Upgrade your debian sources.list
apt-spy is a program that benchmarks debian apt-get sources. Run this script when you need to find your bets local mirror for grabbing debian packages. #!/bin/sh # jcz 2005-july-13 # # This script will add the best debian servers to your sources.list file. # You should prune the file by hand when it’s done. #…
Comment on Upgrade your debian sources.list
Changing run levels at boot time
As with most stories on this site, I use my stories to store notes on things that I keep needing to lookup and that might help others. This one is how to change the default startup runlevel of a debian (via knoppix distribution). In this case I want it to stop booting into graphical mode,…
Comment on Changing run levels at boot time
Simple grep and search & replace
grep -Hn -e ” int” *.c* *.h searches for the string “int” files ending in .c* or .h in the the current directory directory Returns: ! P8.CPP:52: cerr << “cannot allocate int *p1″ << endl ; ! P8.CPP:59: } //format => int *p = new int[100]; ! P9.CPP:9:inline int sumup( int x, int y) !…
Comment on Simple grep and search & replace