Middleware Tech

February 13, 2011

copy file from one linux to another linux box using SCP

Filed under: Application server,JBOSS,Unix or Bash Commands — Vijay Nekkanti @ 6:55 pm

sending a file from one linux box to another linux box.

scp stands for secure cp (copy), which means that you can copy files across an ssh connection that will be encrypted, and therefore secured.

You can this way copy files from or to a remote server, you can even copy files from one remote server to another remote server, without passing through your PC.


scp [[user@]from-host:]source-file [[user@]to-host:][destination-file]

Description of options

Is the name or IP of the host where the source file is, this can be omitted if the from-host is the host where you are actually issuing the command
Is the user which have the right to access the file and directory that is supposed to be copied in the cas of the from-host and the user who has the rights to write in the to-host
Is the file or files that are going to be copied to the destination host, it can be a directory but in that case you need to specify the -r option to copy the contents of the directory
Is the name that the copied file is going to take in the to-host, if none is given all copied files are going to maintain its names


Preserves the modification and access times, as well as the permissions of the source-file in the destination-file
Do not display the progress bar
Recursive, so it copies the contents of the source-file (directory in this case) recursively
Displays debugging messages


scp *.txt user@remote.server.com:/home/user/

This will copy all files with .txt extension to the directory /home/user in the remote.server.com host

scp -r miguel@ miguel@

This is going to recursively copy all files from miguel’s Home directory on host to his Home directory in host.


February 1, 2011

How to install GCC in linux

Filed under: Application server,JBOSS — Vijay Nekkanti @ 10:53 pm

Important messages about GCC:

GCC version :     $ gcc -v

gcc path  :  $which gcc

If you are using Red Hat Enterprise Linux, type the command:

# up2date gcc

If you are using CentOS/Fedora Core Linux, type the command:

# yum install gcc

Some important GCC commands :

$ which gcc

$ whereis gcc
gcc: /usr/bin/gcc3.2-version /usr/bin/gcc /usr/local/bin/gcc /usr/share/man/man1/gcc.1.bz2 /usr/share/man/man1/gcc.1

$ gcc -v
Reading specs from /usr//bin/../lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/specs
Configured with: /usr/local/src/gcc-3.3.1/configure –prefix=/usr –libdir=/usr/lib –with-slibdir=/lib –mandir=/usr/share/man –infodir=/usr/share/info –enable-shared –enable-threads=posix –disable-checking –enable-long-long –enable-__cxa_atexit –enable-languages=c,c++,ada,f77,objc,java –host=i586-mandrake-linux-gnu –with-system-zlib
Thread model: posix
gcc version 3.3.1

$ gcc –version
gcc (GCC) 3.3.1
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO

Install GCC in linux:

su –

mkdir /usr/local/src
cd /usr/local/src

gunzip /tmp/gcc-3.3.1.tar.gz #where I downloaded the file
tar xvf /tmp/gcc-3.3.1.tar

cd /opt/build
–prefix=/usr –libdir=/usr/lib –with-slibdir=/lib –mandir=/usr/share/man –infodir=/usr/share/info –enable-shared –enable-threads=posix –disable-checking –enable-long-long –enable-__cxa_atexit –enable-languages=c,c++,ada,f77,objc,java –host=i586-mandrake-linux-gnu –with-system-zlib

make install

Blog at WordPress.com.