Wednesday, December 31, 2014

Create .tar file in Linux

Following command can be used to create .tar file in Linux.

tar -cvf all.tar *.txt

Above command ceate tar files for all .txt files in the directory.


Wednesday, December 10, 2014

Find port usage

Following command can be used to check port usage.
In windows command prompt type following command.

netstat -aon |find /i "listening" |find "port"

This will return port usage.

Thursday, December 4, 2014

SSH vfs2 Change FTP Directory

Following configuration can be used to change logged user directory. In normally, FTP directory is set to logging user home. Sometimes, you have to access directories outside of the logging SFTP user home.

SftpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, false);

This code snip can be used, when you are using vfs2 SFTP client.

Now, you can FTP files in any location using following SFTP URI.

"sftp://" + userID + ":" + password + "@" + sftpHost + "/" + remoteDirectory + fileName

Change remote directory as you preferred.