Posts filed under 'Linux'

How Many Files in a Linux Directory

The following command will tell you how many files matching the *.csv pattern are in the current directory:

ls -1R | grep .*.csv | wc -l

1 comment July 4, 2008

Increasing Swap Space in Linux

I had trouble with an application that was using gigabytes of memory in Linux and running out, so I had to figure out how to increase the amount of memory without buying more hardware. A relatively easy solution for this is to create a new swap file. Of course, there are drawbacks to doing this, but if you are in need a quick solution to increase the memory available to an application, this might work for you, too.

This article explains how to do this on Red Hat. I am not sure, but I think it’s similar on other flavors of Linux.

Add comment April 4, 2008

Upgrading MySQL on Red Hat Linux Despite Dependency Conflicts

Recently I needed to upgrade MySQL from version 4.1 to 5.0 on Red Hat. I was having some dependency conflicts that were vexing me. After searching around the Web I figured out how to do it. Because I’m a Linux novice, I’m sure there are more details I don’t understand, so if anyone wants to provide insight, that would be great.

Here are the basic steps I performed:

  1. Downloaded the .rpm files from the MySQL site (server, client, shared libraries, shared compatibility libraries) for my O/S version to a single folder on the server.
  2. Tried the basic install (from the directory with the .rpm files): rpm -ivh MySQL-*
  3. That gave me errors about dependency conflicts with previously installed MySQL packages. I used this command to find out which packages were installed: rpm -qa | grep mysql
  4. I went through one by one trying to uninstall them (rpm -e <package name>). However, I ran into problems because there were some duplicates. For the duplicates I ran the following command: rpm -e –nodeps –allmatches <package name>.
  5. Then I reran the install command from step 2, and it worked!

This page has some helpful tips on starting up the MySQL service and setting the root password, etc.

Add comment March 31, 2008

Copying from One Directory to Another in Linux

cp FileName.txt DirectoryName/

1 comment March 27, 2008

How to Install tar.gz Files in Linux

cd Download_Dir/
tar -xvfz file.tar.gz
cd file_dir/
./configure
make
make install

Add comment March 25, 2008

Remove / Delete Directory and Its Contents in Linux

(Note: Please see my latest posts at my new blog!)

rm -rf <DirectoryName>

This command will remove a directory and its contents without prompting you to make sure you want to delete each file in the directory. Substitute <DirectoryName> with the actual directory name.

5 comments February 20, 2008


Categories

Archives

Top Posts