Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts
Sunday, October 28, 2018
Get environment variables passed to android/linux process
Friday, August 12, 2016
Delete single line from multiple files containing specific word
To delete line which contains alsa-lib word from all .xml file, use
for f in *.xml; do sed -i '/alsa-lib/d' $f ; done
How to change linux console/terminal column width
To change linux console/terminal column width use stty, e.g. to change width to 180 column use
stty cols 180
Tuesday, August 2, 2016
Cross Compiling Linux kernel for ARM
git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.gitTo get kernel-next branch clone
git clone https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
export PATH=$PATH:/path/to/linaro/binary/linaro/aarch64-unknown-linux-gnu_4.9-2014.05-01/bin
make ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-gnu- O=output defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-gnu- O=output -j8
make ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-gnu- O=output menuconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-gnu- O=output savedefconfigThis will create defconfig file in output directory. Copy this file to your arch/arm64/configs directory
Monday, December 29, 2014
Dump audio to wav format using mplayer
mplayer input.mp4 -vc null -vo null -ao pcm:fast:waveheader:file=audio.wav
Play raw audio using mplayer
To play raw pcm file using mplayer use below command, which plays a pcm file "audio.pcm" whose sample rate is 192000 KHz, 32 bit, stereo
mplayer -rawaudio rate=192000:channels=2:samplesize=4 -format s32le -demuxer rawaudio audio.pcm
Friday, December 19, 2014
How to use bash function defined in .bashrc file into bash script
First define function in .bashrc and then export it
d2h(){
echo "obase=16; $@"|bc
}
export -f d2h
Above function converts decimal to hex and then export it, so that it can be used from other bash scripts
Wednesday, February 20, 2013
Friday, February 15, 2013
Wednesday, December 19, 2012
Monday, October 22, 2012
Copy from remote machine to local machine securely without logging
scp username@remote_pc_ip:/path_to_remote_file path_to_local_file
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
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.
Search string in multiple files in linux
Search string in multiple files in linux, use following function in .bashrc file of linux.
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;
}
Monday, April 19, 2010
How to access Windows PC from Ubuntu Linux
If you want to access your windows PC from Linux, then install tsclient.
sudo apt-get install tsclient
Then enter Windows PC details in order to connect to Windows PC.
Use CTL+ALT+ENTER key combination to toggle between Fullscreen mode.
sudo apt-get install tsclient
Then enter Windows PC details in order to connect to Windows PC.
Use CTL+ALT+ENTER key combination to toggle between Fullscreen mode.
Wednesday, February 24, 2010
How to redirect stdout and stderr output to file
Sometimes you need to redirect output of some command to file. The command may print its messages both on stdout and stderr device, in this case simply redirecting stdout to file does not help. Use following command to redirect both stdout and stderr output to file.
$ command 1 > outputfilename.txt 2 > &1
$ command 1 > outputfilename.txt 2 > &1
Subscribe to:
Posts (Atom)