Tuesday, September 25, 2012

Run command on remote machine using ssh without logging

To run any command on remote machine using ssh without loggin, use following ssh user@remote_ip command_to_execute

If you want to run remote graphical app locally on linux machine, you can use
ssh -X user@remote_ip command_to_execute

Debug Linux kernel startup issue or measure kernel bootup time

To debug Linux kernel startup issue or to measure kernel bootup time you can append kernel command line with initcall_debug.
 

Print Hex numbers with leading zeros in python

To print Hex numbers with leading zeros in python, I have used following code,




for i in range(0,32):
    print '0x%0.8X' %(1<<);


Search string in multiple files in linux

Search string in multiple files in linux, use following function in .bashrc file of linux.

srcfind() {
if [ $# -gt 0 ]; then {
find . -type f -name "$1" -print0 |xargs -0 -r grep -n --color "$2" "$3" "$4" "$5" 2>/dev/null;
} else {
echo "Usage: srcfind filetype string_to_find option_for_grep";
} fi;
}