Networking Most Used commands

Linux: Find Out Which Process Is Listening Upon  a Port

netstat -tulpn
Posted in Uncategorized | Leave a comment

SVN Most Used commands

svn log -l 5

Only the last 5 entries

What do the arrow icons in Subclipse mean?

When working with the Subversion repository, remote changes (those on the repository) are incoming changes (remote → local), while local changes are outgoing changes (local → remote).

In views that compare the local and remote copies, incoming changes are denoted with a blue, left-facing arrow, while outgoing changes are denoted with a gray, right-facing arrow. These arrows may be decorated to indicate more specific operations.

The Package Explorer view, on the other hand, indicates a file’s status with a different set of icons representing its local state. These icons are the ones most commonly seen, so let’s start with them:

Ignored File – A file ignored by version control. You can control what resources will be ignored by going toWindow → Preferences → Team → Ignored Resources.
Unversioned File – A file not under version control. These are typically new files that you have not committed to the repository yet.
New File – A versioned file that needs to be added to the remote repository. These are typically files you have either renamed, or moved to a different directory.
Deleted File – A deleted folder. These are folders that you have deleted locally without yet committing the changes to the repository. Note that files are usually removed from the view when they’re deleted locally, so they are normally not seen with this icon.
Synchronized File – A file with no local changes.
Local Changes – A file with local, uncommitted changes.
Locked File – A locked file.
Needs Lock – A file that needs a lock to be edited. These are typically files that cannot easily be merged (i.e. binary files), but may have many editors. A file needs a lock when its svn:needs-lock property is set, and Subversion will attempt to make these files read-only in the file system to enforce proper lock negotation.
Conflicted File – A conflicted file. These are typically files that had a commit/update conflict that you marked to resolve later.
Tree Conflicted File – A file that has a tree conflict. These are typically files that have local changes, but have since been moved, removed, or renamed in the repository since the last local copy update.
External File – A file that is external to the project. Linked external files cannot be committed to the repository.
Switched File – A file that has been switched. These are files which belongs to a different working copy than their local parent directory.

In a synchronization view (e.g. via Synchronize with Repository or Commit), as previously described, there are icons which indicate which direction a change is occurring in as well as additional information about that change. These are described below:

Outgoing
Commit Changes – A file whose contents have been modified and will be committed to the repository.
Commit Addition – A file that will be newly added to the repository. This may coincide with a file removal in cases where a file is moved or renamed..
Commit Removal – A file that will be removed from the repository. This may coincide with a file addition in cases where a file is moved or renamed.
Property Change – A file with property changes, in the Commit dialog. On the Synchronize tab, property changes are currently reflected as a normal file modification (Commit Changes).

Incoming
Remote Changes – A file that has content changes committed to the repository that will be applied to the local copy.
Pull Addition – A new file that will be added to the local copy from the repository. Like the outgoing file addition, this may be the result of a move or rename.
Pull Removal – A file that will be removed from the local copy because it has been removed from the repository. Like the outgoing file removal, this may be the result of a move or rename.

Conflict
Conflicting Versions – A file that has been changed in both the local copy and repository independently, causing a need for conflict resolution. Fixing this condition involves opening up the conflict view or forcibly overwriting changes locally or remotely.
Synchronization Tree Conflict – A file that has a tree conflict. This can occur when there are new changes to a file on one end (either local or remote), and the file is moved, removed, or renamed on the other.

Finally, the Synchronize with Repository option opens the Synchronize tab (  Synchronize Tab) with the following  buttons:

Synchronize Source – Synchronizes the local copy with the currently selected repository when clicked. Selecting from the drop-down allows switching between different remote code bases.
Show Incoming – Shows only incoming changes (remote → local).
Show Outgoing – Shows only outgoing changes (local → remote).
Show Incoming and Outgoing – Shows both incoming and outgoing changes (remote ↔ local).
Show Conflicts – Shows conflicting changes.
Update Incoming – Updates all local resources with incoming changes after prompt.
Commit Outgoing – Brings up the commit dialog to commit all outgoing changes.
Show Changesets – Breaks up the change lists by revisions.

There are a few other views which weren’t covered that have additional icons, but this should hopefully be a good start. Let me know if there is anything important missing, or any of these descriptions seem to differ from your actual experience.

 

Undo svn add without reverting local edits

svn rm –keep-local

Posted in Uncategorized | Leave a comment

Grid5000 Most Used commands

Rsync

Like scprsync is a tool for transfer of files between systems. Such tools are very useful on Grid5000, for example to synchronize your local source tree with the one on the cluster node you are using.

rsync has several advantages over scp :

  • its protocol is more efficient. scp considers one file after the other, which doesn’t perform very well on network links with high bandwidth but medium latency, like the typical Grid5000 inter-cluster link, or the link between your lab and your cluster node. Also, scp performs poorly (compared to rsync) when transfering many small files (your typical source tree).
  • when a remote copy is already present, rsync only transfers the differences between your local copy and the remote copy. This is very useful during development, because you often have to transfer only small changes (a bug fix).

Example

Transfers the local directory named “source” to the remote host in /tmp

rsync -avzP source remotelogin@remotehost:/tmp

Important: With scp, “scp source rlogin@rhost:/tmp” and “scp source/ rlogin@rhost:/tmp” are the same. With rsync, they aren’t :

  • With source, a directory named source is created in /tmp, with the files in it.
  • With source/, the files in source are copied directly in /tmp.
rsync --delete -avzP source remotelogin@remotehost:/tmp


–delete                delete extraneous files from dest dirs

rsync with SSH 

Copy a File from a Local Server to a Remote Server with SSH and Show Progress While Transferring Data with rsync

rsync –progress -avzhe “ssh -p 5596” hadoop.tar.gz hadoop@127.0.0.1:/hadoopfs/

http://www.tecmint.com/rsync-local-remote-file-synchronization-commands/

Job submission

 oarsub -I -l ‘nodes=6,walltime=0:20:0’ -e ~/workspace/mrbs/keys/id_rsa

Connecting to the other cores

cat $OAR_NODEFILE

idpot5.grenoble.grid5000.fr
idpot8.grenoble.grid5000.fr
idpot9.grenoble.grid5000.fr

oarsh idpot8
Posted in Uncategorized | Leave a comment

Hadoop-Most Common Exceptions

Exception

Exception in thread “main” java.io.IOException: Call to /IP:9000  failed on  local exception: java.io.EOFException

Possible Reasons:

  1. Node on which this program was running failed to connect to namenode.
  2. Version of hadoop on server side is not  compatible with the version you use in client  side.

 

 

 

Posted in Uncategorized | Leave a comment

Vim Most Used commands

Search and Replace

%s/opt/usr/g

Search and Replace including characters like’/’

%s/opt/usr\/local/g

Posted in Uncategorized | Leave a comment

Text Processing in Linux

Print the values in the second column of ratings.dat (:: separated) file to  movies.txt

awk -v ‘FS=::’ ‘{print $2}’ ratings.dat > movies.txt

Finding unique occurring lines in movies.txt

sort movies.txt | uniq > movies_u.txt

Split by 10 lines

split -l 10 movies_u.txt

Split by 10 lines, with 3 suffixes and prefix item_ids_

split -l 10 -a 3 movies_u.txt item_ids_

Count lines wc -l movies_u.txt

English letters small case: (sometimes they might be useful :P)

“a b c d e f g h i j k l m n o p q r s t u v w x y z”

Posted in Uncategorized | Leave a comment

SSH Login Without Password Using ssh-keygen & ssh-copy-id

ssh-keygen creates the public and private keys. ssh-copy-id copies the local-host’s public key to the remote-host’s authorized_keys file. ssh-copy-id also assigns proper permission to the remote-host’s home, ~/.ssh, and ~/.ssh/authorized_keys.

Step 1: Create public and private keys using ssh-key-gen on local-host

jsmith@local-host$ [Note: You are on local-host here]

jsmith@local-host$ ssh-keygen Generating public/private rsa key pair.
Enter file in which to save the key (/home/jsmith/.ssh/id_rsa):[Enter key]
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Pess enter key]
Your identification has been saved in /home/jsmith/.ssh/id_rsa.
Your public key has been saved in /home/jsmith/.ssh/id_rsa.pub.
The key fingerprint is:
33:b3:fe:af:95:95:18:11:31:d5:de:96:2f:f2:35:f9 jsmith@local-host

Step 2: Copy the public key to remote-host using ssh-copy-id

jsmith@local-host$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
jsmith@remote-host's password:
Now try logging into the machine, with "ssh 'remote-host'", and check in:

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

Note: ssh-copy-id appends the keys to the remote-host’s .ssh/authorized_key.

Step 3: Login to remote-host without entering the password

jsmith@local-host$ ssh remote-host
Last login: Sun Nov 16 17:22:33 2008 from 192.168.1.2
[Note: SSH did not ask for password.]

jsmith@remote-host$ [Note: You are on remote-host here]
Posted in Uncategorized | Leave a comment