Mostrando entradas con la etiqueta Linux. Mostrar todas las entradas
Mostrando entradas con la etiqueta Linux. Mostrar todas las entradas

martes, 11 de enero de 2011

Alias in Linux

Here a simple way to create a simple name to execute a repetitive command:

You can open you .cshrc
nedit ~/.cshrc

Type in this file the following:

alias copyNow 'cp /home/username/file.xml /home/username/MyDir'

Finally compile this file
source ~/.cshrc

From now on whenever you type in any terminal

copyNow

the file file.xml will be copied in MyDir.

Many possibilities here!!

Nedit, simple text file editor in Linux

If you find an alternative to vi (prehistoric) try nedit in Linux, it's the simplest way to edit your text file

"NEdit, the Nirvana editor, is a text editor and source code editor for the X Window System. It has an interface similar to text editors on Microsoft Windows and Macintosh, rather than to older UNIX editors like Emacs"

http://en.wikipedia.org/wiki/NEdit

How to find Strings in linux directory

To find some string in a directory you can find a String in this way:

ps aux | grep stringToFind

Example, you have a directory called Fruit, which contains all kind of files with fruits. You need to search the file/s containing the word "Apple"

you go to Fruit directory:
cd /home/username/Fruit

then you search for the word Apple in all subdirectory:
ps aux | grep Apple *
ps aux | grep Apple */*
ps aux | grep Apple */*/*
 
... and so on till you have this indication:

grep: No match.

This means that you don't have any more subdirectories to explore

Up to know I use this command because is the simplest one.

lunes, 10 de enero de 2011

Tomcat doesn't start or refresh

 If you stop and start Tomcat but it looks like your changes don't appear, try to check at your processes running in background.
If you use Linux do as following:

- Stop your tomcat server
  /tomcatDir/bin/shutdown.sh

- Open a shell and type:
  ps aux | grep tomcat

- Delete all the occurence of tomcat with the kill command
  kill -9 number_of_process

!! Be careful not to kill your friend tomcat !!

- Start tomcat again
  /tomcatDir/bin/startup.sh

How to copy my directory to remote host with ant?

You should use the scp command, like in the example:

<target name="copyMyDir"  description="Copying directories to your remote host">
        <scp todir="username:password@myhostname.com:/home/directoryIn yourremoteHostWhereYouWantToCopyYourStuff">
            <fileset dir="./dirIWantToCopy">
                <exclude name="build/**"/>
                <exclude name="src/"/>
                <exclude name="build.xml"/>
                <exclude name="otherStuffIWantToExclude"/>
            </fileset>
        </scp>
    </target>

If you are interested in this ant command you should read his specification that you can find here:
http://ant.apache.org/manual/Tasks/scp.html