Linux: scp command basics and to copy a directory

The scp command in linux is used to securely copy (scp – secure copy) files and folders from one linux server to another. The basic structure of the scp command is as follows:

scp sourceĀ  target
scp username@source_servername_or_ip:/path/to/file_or_directory location/to/copy/file_or_folder/to

When you run the above command from the target directory, you will be prompted to type the password for the username on the source server. The username should have at least read privileges to the file_or_folder you are trying to copy.

To copy to the current directory location, you can just specify a ‘.’ as below:

scp username@source_servername_or_ip:/path/to/file_or_directory .

To copy an entire directory, use the following command:

scp -r username@source_servername_or_ip:/path/to/directory .
Advertisements

Documentum Composer: dar created with newer version issue

Sometimes when you create a dar file from a higher version of composer, and try to install that dar file with an earlier version, the dar deployer shows an error:

LaterVersionDar

This is easily fixed. Open the dar in a program like PKZip, or unzip the dar. There is a version.ini file in the root folder. Comment out the version information:

composer.version=7.2.0070.0203

Just put a # before the above line and save it back to the dar.

Linux: How to switch user

To switch user when you are in the sudoers list:

sudo su - username

Linux will then ask you to type your password (not the user you are switching to, but the user you are logged in as). You can always do whoami to check who you are running the command as

whoami

 

Linux: How to suppress permission denied messages with find command

When doing a find command, like the following, if you do not have sufficient permissions, you will get a lot of “permission denied” messages. This sometimes drowns out the few lines where you actually get a hit. One way to avoid that is to add the following to the command:

find / -name filename.txt 2>/dev/null

The 2 in the above command is the error output which is redirected to /dev/null, effectively suppressing your error messages. This way you will only see the successful paths where the file does exist andĀ  you have permissions.