Saturday, 13 December 2014

Change owner

To change owner of a folder and its content:

chown -R newOwner:newGroup  /path

How to attach in Eclipse the source code of Java language

If you need to browse the original code of the Java language, you need to attached its sources to the installed JRE preference page, as by default it is not attached when you specify your working JRE.

In Eclipse, select Windows -> Preferences -> Java -> Installed JREs , expands rt.jar, select “Source attachment” and find the src.zip from your disk drive.

That should be right under the JDK folder , for example:  C:\Program Files (x86)\jdk7

Wednesday, 23 July 2014

Change display resolution in Linux

Change display resolution in Linux

This also reflects upon the display size in vSphere client, which was the reason I needed to changed the resolution, it was a bit too big and had to scroll the screen and wanted to reduce its size.

To change the VGA card display resolution in RHEL5

1) First check all the possible resolutions supported by your graphics card using the following command.

            "xrandr"

It will display all possible resolutions.


2) Change resolution.

Suppose your graphics card support 1024x768 resolution then you can change it using the following command.

"xrandr -s 1024x768"



If you don't have "1024x768" in that “xrandr” output, try below one this might be help to get “1024x768”.


In “/etc/X11/xorg.conf” file just check the entries


            SubSection "Display"
                        Viewport  0 0
                        Depth     24
                        Modes "1024x768"
            EndSubSection


Check the entry “Modes”. If it is not present just add this line and check.

Thursday, 10 July 2014

Close port on Linux

sudo netstat -lpn | grep 8080
will list the process on port 8080
example:
tcp      0     0   :::8080      :::*      LISTEN   21026/java

kill 21026

Friday, 4 July 2014

Copy a file

cp file file.bak
cp file /home/user/file.bak

Copy "file" and give the copy a name "file.back". Optionally place the copied file to another location by specifying a path.

Saturday, 10 May 2014

More Linux shell commands

less  fileName => opens the file a page at a time.  SHIFT+G will move to the end of the file.


tail -3 fileName => open the file at the end showing just the last 3 lines that end with new line


mkdir  -p   a/b/c   => create empty directory structure in the current directory. If /a/b/c is used, then it will be created in the root of the system, if you have permissions.


rmdir -pv a/b/c  => remove the whole folder structure, starting from the bottom to top. The structure to delete must be explicitly described (a/b/c).
-p is the same option as above (parent)
-v is verbose output of all steps the command performs



ls -R folderName   => list recursively the content of the folder structure inside the folderName
ls -d  */     -> list only the directories in the current folder. * is all, / is just subfolders one level below.
                      To go deeper, add more */*/



u  user
g group
o other
chmod u+x file  -> set exec right to the owner (user)
chmod u=x file    -> set only exec right to the user (owner) of the file
chmod ugo=r  file   -> set only read rights to all three, user, group, others
chmod g=wx  file   -> set write and exec rights for the group
chmod a-rwx file   -> remove all three rights for all three kinds of users (owner,group,other)
chmod 000  file   -> same as above
chmod u+rwx,g+r,o+r  file  ->  set user all rights, group read and other read.
                                               No space around the comma.




Friday, 7 February 2014

Some batch file commands

Funny but I've tried to change directory in a command prompt by simply typing:

CD D:\
and sure enough this does not work.
To change to new directory add /D  (case insensitive)
 
cd /d  d:\
 or just
D:

Some reserved variables:

%~dp0  -> this will contain the path to the script
%0      -> this will hold the path+the name of the script

%1 up to %9   -> this in the script will pick up arguments that may have been passed to the script when it was launched from command line