Posted by walrus on September 12, 2008
How to rename multiple files at a shell prompt under Linux? The rename command is quite useful.
Rename command usage:
rename oldname newname *.files
Some examples:
Rename all *.abc file as *.xyz:
$ rename .abc .xyz *.abc
Remove .txt file extension:
$ rename 's/\.txt$//' *.txt
Convert all uppercase filenames to lowercase:
$ rename 'y/A-Z/a-z/' *
Posted in Software, linux | Tagged: command line, files, Howto, linux, rename | Leave a Comment »
Posted by walrus on July 30, 2008
Backing up via the command line:
Type the following at the prompt with the appropriate USERNAME and DATABASE name:
mysqldump -u USERNAME -p DATABASE > dump.sql
You will be prompted for your database password and then the DATABASE will be dumped to a plain-text file called dump.sql.
Restoring via the command line:
First drop and recreate the database as needed:
Drop the database
mysqladmin -u USERNAME -p drop DATABASE
Recreate the database
mysqladmin -u USERNAME -p create DATABASE
Import the backup data
mysql -u USERNAME -p DATABASE < dump.sql
Posted in MySQL, Software, linux | Tagged: backup, command line, MySQL, mysqladmin, restore | Leave a Comment »
Posted by walrus on July 21, 2008
Here is how to setup JAVA_HOME and PATH environment variables for a single user or all users on Fedora Linux system
Setting JAVA_HOME and PATH for a single user
# vi ~/.bash_profile
# export JAVA_HOME=/opt/jdkx.x.x_xx
# export PATH=$PATH:$JAVA_HOME/bin
Setting JAVA_HOME and PATH for all users
# vi /etc/profile
# export JAVA_HOME=/opt/jdkx.x.x_xx
# export PATH=$PATH:$JAVA_HOME/bin
Posted in Software, Technology, java, linux | Tagged: java, linux, shell | Leave a Comment »
Posted by walrus on July 21, 2008
Here are three quick ways to find out which shell you are currently using:
Method 1:
command:
# echo $SHELL
output:
/bin/bash
Method 2:
command:
# echo $0
output:
-bash
Method 3:
command:
# ps -p $$
output:
PID TTY TIME CMD
1447 tty1 00:00:01 bash
Posted in Software, Technology, linux | Tagged: fedora core 5, linux, shell | 1 Comment »
Posted by walrus on July 18, 2008
Windows Vista supports symbolic links (soft links). One way of creating these links is using the command line utility called MKLINK.
Run Command Prompt and type the comman MKLINK.
If the system warns saying…“You do not have sufficient privilege to perform this operation”. Run the Command Prompt as Administrator
Usage:
MKLINK [[/D] | [/H] | [/J]] Link Target
/D Creates a directory symbolic link. Default is a file
symbolic link.
/H Creates a hard link instead of a symbolic link.
/J Creates a Directory Junction.
Link specifies the new symbolic link name.
Target specifies the path (relative or absolute) that the new link
refers to.
Example: To create a directorty link called src what points to c:\users\foo\src
mklink /D src c:\users\foo\src
Thats it!
Posted in Software, Technology, Windows, linux | Tagged: linux, symbolic links, vista, Windows | 1 Comment »