Sunday, March 27, 2011

xorg.conf of RHEL 5.0


# Xorg configuration created by pyxf86config
Section “ServerLayout”
Identifier “Default Layout”
Screen 0 “Screen0” 0 0
InputDevice “Keyboard0” “CoreKeyboard”
InputDevice “Synatics” “CorePointer”
EndSection

Section “InputDevice”
Identifier “Keyboard0”
Driver “kbd”
Option “XkbModel” “pc105”
Option “XkbLayout” “us”
EndSection

Section “InputDevice”
Identifier “Synaptics”
Driver “synaptics”
Option “Device” “/dev/input/mice”
Option “Protocol” “auto-dev”
Option “Emulate3Buttons” “yes”
EndSection

Section “Device”
Identifier “Videocard0”
Driver “via”
EndSection

Section “Screen”
Identifier “Screen0”
Driver “Videocard0”
Monitor “Monitor0”
DefaultDepth 24

SubSection “Display”
Viewport 0 0
Depth 24
Modes “1024x768” “800x600”
EndSubSection
EndSection

Section “Monitor”
Identifier “Monitor0”
HorizSync 31.5 – 48.5
VertRefresh 59.0 – 75.0
EndSection
# ---- END ----

Tuesday, March 1, 2011

know your home folder in LINUX

[From wikipedia]

A Home directory is a file system directory on a multi-user operating system containing files for a given user of the system.

The benefits of home folder are :
1. Separating user data from system-wide data avoids redundancy and makes backups of important files relatively simple.
2. user himself, person or program (trojan, virus etc) having user's privileges only be able to alter the files in the user's home directory and some files belonging to workgroups the user is a part of, but not actual system files.
[end]

In Linux,

Tilde '~' represent the user's home folder, that is '/home/user'.

To go back to user's home folder from any location simply enter 'cd' command.

To know the present working directory use 'pwd' command.



On using 'ls -a' command in the user's home folder (depending on version of Linux) following file/files can be found:
.bashrc
.profile

.bash_profile



These files can be used to override the global settings and these settings will only applicable to the current user (that means settings for all the other users remain unchanged). At logon time, bash shell read these files, that means any changes made to them will reflect when you logged on next time. But you can also made those changes to current terminal (without logout) only by manually executing them, for example if changed made to .bashrc, command will be '. ~/.bashrc'.

Following are some important settings:

1. Environment variables

2. Shell's display prompt

3. Aliases of commonly used commands



Environment variable can be view using 'env' command. You can create your own or can edit existing environment variable. While editing existing environment variable make sure you should always append to it with colon ':' or some application/program may not work.

for example to export new environment variable DOC, representing /home/user/Documents/mystuff.
open the above mentioned file and add this line.
export DOC=/home/user/Documents/mystuff
OR more appropriate approach.
export DOC=$HOME/Documents/mystuff

In the above example $HOME is already existing env var and DOC is new created. It can be check using command 'echo $DOC' ie $DOC can be used in place of ~/Documents/mystuff.


You can customize the prompt displayed in terminal by changing 'PS1' environment variable. for example is you do not want absolute path to be shown in prompt then,
PS1=”\u@\h:\W$ “

[NOTE capital 'W', will show current folder while small 'w' show absolute path]
execute it on terminal to see the effect, if want it permanent, copy it to one of the above mentioned file.

If your terminal support, you can have colorful prompt. for example,
PS1=”\033[32;1m\u@\h\033[m:\033[34;1m\W\033[m$ ”


Alias can be created for commonly used long commands, like
if you frequently use 'ls' command to print the result in long format, reverse sorted with time 'ls -lrt', make following entry in the mentioned file.
alias ll='ls -lrt'
now you can use 'll' command instead of 'ls -lrt'

NOTE:
1. As a precaution you can create a new normal user to test the commands mentioned above or you may end up with a non-workable login.
2. Always remember to keep backup before editing any file. Precaution is better than cure.