I knew there was a way to ftp multiple files without being prompted.
It was just a matter of knowing the syntax.
It is possible to download several files at once, using the mget command. This command can take several filenames as arguments, and you can even use wildcards to download matching files. For example, the command
mget *.txt
would download all the files that end in .txt in the current directory on the remote host. When using mget , you will be prompted as to whether or not you wish to download each file. This feature can be toggled on and off by typing prompt at the ftp> prompt before beginning the file transfer.
Read more about "FTP multiple files without prompt"!
Tuesday, May 05, 2009
FTP multiple files without prompt
Friday, October 24, 2008
Windows Boot Screen
So many times I have wanted to see why my windows is booting so slowly. What drivers are causing problems... Well msconfig has a nice feature to disable the eye candy bootup and just show what drivers are being loaded!!
on Windows XP open msconfig and go to the BOOT.INI tab and check on the /SOS checkbox. The next time you bootup, it will show what drivers are being loaded.
On Vista go to the Boot tab and check on the OS bootinformation check box to do the same.
Read more about "Windows Boot Screen"!
Friday, July 18, 2008
rxvt on cygwin
rxvt is so much better than the dumb command prompt style shell you get with default cygwin.
Remember to choose rxvt when installing cygwin. Then create a shortcut with the following command C:\cygwin\bin\rxvt.exe -fg green -bg black -fn "Lucida Console-14" -e bash --login -i
Read more about "rxvt on cygwin"!
Friday, June 20, 2008
Manage directory navigation with pushd and popd
UNIX supports a wide variety of directory-navigation tools. Two good tools are pushd and popd.
You're certainly aware that the cd command changes your current directory. What happens if you have several directories to navigate, but you want to be able to quickly return to a location? The pushd and popd commands create a virtual directory stack, with the pushd command changing your current directory and storing it on the stack, and the popd command removing the directory from the top of the stack and returning you to that location. You can use the dirs command to display the current directory stack without pushing or popping a new directory. Listing below shows how you can use the pushd and popd commands to quickly navigate the directory tree.
$ pushd .
~ ~
$ pushd /etc
/etc ~ ~
$ pushd /var
/var /etc ~ ~
$ pushd /usr/local/bin
/usr/local/bin /var /etc ~ ~
$ dirs
/usr/local/bin /var /etc ~ ~
$ popd
/var /etc ~ ~
$ popd
/etc ~ ~
$ popd
~ ~
$ popd
The pushd and popd commands also support parameters to manipulate the directory stack. Using the +n or -n parameter, where n is a number, you can rotate the stack left or right, as shown below
$ dirs
/usr/local/bin /var /etc ~ ~
$ pushd +1
/var /etc ~ ~ /usr/local/bin
$ pushd -1
~ /usr/local/bin /var /etc ~
Read more about "Manage directory navigation with pushd and popd"!
Reuse previous arguments
Here is another great tip from IBM. I love this. The !$ command returns the last argument used with a command. But what happens if you have a command that used arguments and you want to reuse just one of them?
The !:1 operator returns the argument used in a command. The example in Listing 3 shows how you can use this operator in combination with the !$ operator. In the first command, a file is renamed to a more meaningful name, but to preserve use of the original file name, a symbolic link is created. The file kxp12.c is renamed in a more readable manner, then the link command is used to create a symbolic link back to the original file name, in case it's still used elsewhere. The !$ operator returns the file_system_access.c argument, and the !:1 operator returns the kxp12.c argument, which is the first argument of the previous command.
$ mv kxp12.c file_system_access.c
$ ln –s !$ !:1
Read more about "Reuse previous arguments"!
Use history expansion
This post is from Unix tips from IBM. What happens if you're using the same file name for a series of commands? Well, there's a shortcut that can quickly retrieve the last file name you used.
What happens if you're using the same file name for a series of commands? Well, there's a shortcut that can quickly retrieve the last file name you used. As shown below, the !$ command returns the file name that the previous command used. The file this-is-a-long-lunch-menu-file.txt is searched for occurrences of the word pickles. After searching, the vi command is used to edit the this-is-a-long-lunch-menu-file.txt file without the need for retyping the file name. You use the bang, or exclamation point (!), to access the history, and the dollar sign ($) returns the last field of the previous command. It's a great tool if you are using long file names repeatedly.
$ grep pickles this-is-a-long-lunch-menu-file.txt
pastrami on rye with pickles and onions
$ vi !$
Read more about "Use history expansion"!
Thursday, April 17, 2008
A Comparison of Oracle's DATE and TIMESTAMP Datatypes
Nice article on oracle DATE and TIMESTAMP's. Good place to go for quick reference.
Just go either here or here to read in detail.
Read more about "A Comparison of Oracle's DATE and TIMESTAMP Datatypes"!
Friday, April 04, 2008
Maven: a lot better then Ant
Maven is a software tool for Java project management and build automation similar in functionality to the Apache Ant. Now a days a lot of open source java project are using Maven.
Some of the main features are:-
- Making the build process easy and it is network-ready
- A way to share JARs across several projects
- Providing guidelines for best practices development i.e. to write unit test
- Creates common configuration for eclipse for users of same project.
- more...
also checkout http://en.wikipedia.org/wiki/Apache_Maven
A sample web project would look like
/project-name
/project-name/src/main/java
/project-name/src/main/resources
/project-name/src/test/java
/project-name/src/test/resources
/project-name/pom.xml
/project-name/src/main/webapp/project-name/src/main/webapp/WEB-INF
Some of the commands i use
mvn eclipse:eclipse
mvn clean
mvn install
more ...
Read more about "Maven: a lot better then Ant"!
Continuous integration
Continuous integration describes a set of software
engineering practices that speed up the delivery of software by decreasing ntegration times -Wikipedia
This is a cool concept to use which helps faster development and minimize bugs. Some of the key features are:-
- Maintain a code repository
- Automate the build
- Make your build self-testing
- Everyone commits every day
- Keep the build fast
- Test in a clone of the production environment
- Make it easy to get the latest deliverables
- Everyone can see the results of the latest build
- Automate Deployment
For more details checkout http://en.wikipedia.org/wiki/Continuous_integration
For java developers i would recommend Hudson since its feature rich and Free!
Read more about "Continuous integration"!
Eclipse and ANT build problem with jdk1.3
You can't do an ANT build inside eclipse if your chosen jdk is 1.3. Here is a the error message you get...
BUILD FAILED
java.lang.NoClassDefFoundError: org/xml/sax/SAXException
at org.apache.tools.ant.ProjectHelper.getProjectHelper(ProjectHelper.java:228)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.parseBuildFile(InternalAntRunner.java:189)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:400)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
nice little trick to fix that...
Inside Eclipse Go to Window->Preferences...->Ant->Runtime
In the classpath tab, add a new entry to the Ant Home Entries to the xerces jar file inside your eclipse/pluggins folder. In my case the file was org.apache.xerces_2.8.0.v200705301630.jar.
Now go ahead an run your build again successfully :)
update: When I updated my eclipse to 3.4, this again stopped working for me. The above fix did not work.I then saw a mailing list where the user executed the ant script by right clicking the ant script and choosing Run->Ant build..
Now change the JRE it runs in. It should be set to the option which says "Run in the same JRE as the workspace"
The mailing list thread is here
Read more about "Eclipse and ANT build problem with jdk1.3"!
How to use Read more!
Write your header message...
<span class="fullpost">Keep other stuff within your span tags</span>
I did this from here!
Only thing left to do is to enable or disable the "Read more!" which shows up at the bottom of each post!
Read more about "How to use Read more!"!
Replace ROOT context in tomcat without deleting or replacing the ROOT directory
This is a neat trick. At least it works in tomcat-4.1.24.
The first part to this trick is to know you can deploy a war file to the webapps in tomcat without adding the context in the server.xml of your tomcat installation. Suppose the name of your war file is HelloWorld.war, create an xml file called HelloWorld.xml and add the context snippet you would have added to the server.xml file to HelloWorld.xml. Now deploy both HelloWorld.war and HelloWorld.xml to the webapps folder. Voila! Your web application should now work.
The second part is to make your webapplication be the ROOT context. The ROOT context by default is the Tomcat welcome page. One way of doing this would be to just delete everything under ROOT and deploy your application in there. Well there is another way... In your Context file, just leave the path empty. Here is an example of the contents of the context file for HelloWorld.war without any resources:
<context path="" docbase="HelloWorld.war" debug="0" reloadable="true" crosscontext="true" />
That should do it.. Just bring up Tomcat and enter your url in your favourite browser.
Read more about "Replace ROOT context in tomcat without deleting or replacing the ROOT directory"!
Redirect stdout and stderr to same file
I keep forgetting the correct syntax....
% script 2>& logfile
Read more about "Redirect stdout and stderr to same file"!
Wednesday, August 08, 2007
More unix find tips
There are so many little things to remember in this command that I always have to lookup what switches to use. So here are a few ways of using find
To find all files modified in the last 24 hours (last full day) in current directory and its sub-directories:
find . -mtime -1 -print
Flag -mtime -1 option tells find command to look for files modified in the last day (24 hours). Flag -print option will cause find command to print the files’ location. -print can be replaced with -ls if you want a directory-listing-type response.
To find all files modified in the last 24 hours (last full day) in a particular specific directory and its sub-directories:
find /directory_path -mtime -1 -print
The command is basically the same with the earlier command, just that now you no need to cd (change directory) to the directory you want to search.
To find all files with regular file types only, and modified in the last 24 hours (last full day) in current directory and its sub-directories:
find /directory_path -type f -mtime -1 -print
To find all files that are modified today only (since start of day only, i.e. 12 am), in current directory and its sub-directories:
touch -t `date +%m%d0000` /tmp/$$
find /tmefndr/oravl01 -type f -newer /tmp/$$
rm /tmp/$$
The first command can be modified to specify other date and time, so that the commands will return all files that have changed since that particular date and time.
Find a file or directory
# find . -name TEMP -print
or
# find . -name TEMP -exec echo {} \;
Find core files in this directory tree and remove them
# find . -name "core" -exec rm -f {} \;
Find junk directories and remove their contents recursively
# find . -name "junk" -exec rm -rf {} \;
Find a pattern in a file using the recursive grep (ignore case)
# find . -type f xargs grep -i MYPATTERN
Find files modified in the past 7 days
# find . -mtime -7 -type f
Find files owned by a particular user
# find . -user esofthub
Find all your writable directories and list them
# find . -perm -0777 -type d -lsor# find . -type d -perm 777 -print
Find all your writable files and list them
# find . -perm -0777 -type f -lsor#find . -type f -perm 777 -print
Find large file sizes and list them
# find . -type f -size +1000 -lsor
# find . -type f -size +1000 -print
Find how many directories are in a path (counts current directory)
# find . -type d -exec basename {} \; wc -l
53
Find how many files are in a path
# find . -type f -exec basename {} \; wc -l
120
Find all my pipe files and change their permissions to all writable
# find . -name "pipe*" -exec chmod 666 {} \;
Find files that were modified 7 days ago and archive
# find . -type f -mtime 7 xargs tar -cvf `date '+%d%m%Y'_archive.tar`
Find files that were modified more than 7 days ago and archive
# find . -type f -mtime +7 xargs tar -cvf `date '+%d%m%Y'_archive.tar`
Find files that were modified less than 7 days ago and archive
# find . -type f -mtime -7 xargs tar -cvf `date '+%d%m%Y'_archive.tar`
Find files that were modified more than 7 days ago but less than 14 days ago and archive
# find . -type f -mtime +7 -mtime -14 xargs tar -cvf `date '+%d%m%Y'_archive.tar`
Find files in two different directories having the "test" string and list them
# find esofthub esoft -name "*test*" -type f -ls
Find files in two different directories having the "test" string and list them
# find esofthub esoft -name "*test*" -type f -ls
Find files in two different directories having the "test" string and count them
# find esofthub esoft -name "*test*" -type f -ls wc -l
12
Find files and directories newer than CompareFile
# find . -newer CompareFile -print
Find files and directories older than CompareFile
# find . ! -newer CompareFile -print
Find files and directories but don't traverse a particular directory
# find . -name RAID -prune -o -print
Find all the files in the current directory
# find * -type f -print -o -type d -prune
Find an inode and remove
# find . -inum 968746 -exec rm -i {} \;
Avoid using "-exec {}", as it will fork a child process for every file, wasting memory and CPU in the process. Use `xargs`, which will celeverly fit as many arguments as possible to feed to a command, and split up the number of arguments into chunks as necessary:
find . -depth -name "blabla*" -type f xargs rm -f
Also, be as precise as possible when searching for files, as this directly affects how long one has to wait for results to come back. Most of the stuff actually only manipulates the parser rather than what is actually being searched for, but even there, we can squeeze some performance gains, for example:
- use "-depth" when looking for ordinary files and symollic links, as "-depth" will show them before directories
- use "-depth -type f" when looking for ordinary file(s), as this speeds up the parsing and the search significantly:
find . -depth -type f -print ...
- use "-mount" as the first argument when you know that you only want to search the current filesystem, and
- use "-local" when you want to filter out the results from remote filesystems.
Note that "-local" won't actually cause `find` not to search remote file systems -- this is one of the options that affects parsing of the results, not the actual process of locating files; for not spanning remote filesystems, use "-mount" instead:
find / -mount -depth \( -type f -o -type l \) -print ...
Read more about "More unix find tips"!