Thursday, August 20, 2009

commands i use while programing

VIM :-

:set nonu -remove line numbers
:sp file_name ctrl+ww to switch between split sreen
:$ --------------------- go to end of file
:1 ---------------------- go to starting of file 1 number specifies line number
:%s/OLD/NEW/g -- replace OLD string with NEW string globally (g) and in total file %s
:%s/^/NEW/g -- every line at the starting NEW string will be added.
1,30s/rr/aa/gi ----1,30 represent 1 to 30 lines s stands for string rr serch string pattern and aa is replace string g is globally i is case insenditive


ctags * should be enabled at comd prompt
cntl + ] goto function defination
cntl + o come back
cscope -R --- cntl+d exit ,tab to move to bellow cmds

Enabling and running core dump:
add below two line in bashrc file and restart shell.
ulimit -c unlimited
echo core.%e.%p.%s.%t > /proc/sys/kernel/core_pattern
Now if any core dump file is generated run the below command with proper file name.
gcc executable coredump.xxx

CMDS:-

route --gives route details for ur terminal
route add default gw to add default gateway in route table.
nm obj_file | grep function_name_to_find


diff file1 file2 --- list lines differed
vi -t functionname goes to that function. (ctags * must be used)



svn:

svn co svn+ssh://phaneendra@/repos/project

svn add dir1 dir2 file1 ....
svn ci

svn import dir/file svn+ssh://phaneendra@/repos/project

svn diff

svn ci file_name

if you want to changes code base user name or in some situations your useradmin changed you user name. Now you want to checkin code which your checked out with different name.
now you have two options
1)
Checkout with your new name and see diffs between the code you modified(checked out with old name) and make changed to new check out code base and then check in. (off-course very very bad idea)

2)Best way is use bellow command at trunk (main directory of checkout code)

svn switch svn+ssh://old_user_name@ip/repos/trunk svn+ssh://new_user_name@ip/repos/trunk --relocate
it asks for new user password provide it. Your work is done.


to open .chm files in ubuntu

# apt-get install gnochm

$ gnochm file.chm

Cross compilation:-
source env-setup /usr/local//
This environment variable should be executed before cross compiling or put it in bashrc file and open new terminal and start working.



wed :-

http://cscope.sourceforge.net/large_projects.html
http://www.network-theory.co.uk/ (for gcc and valgring)
http://www.experts-exchange.com/Programming/System/Linux/
http://www.securitytube.net/Programming-Video-List.aspx

No comments: