Wednesday, April 4, 2012

Copy content of one file to another file

Using "CAT" shell command we can copy content of one file to other file.

cat file1 >> file2

Note: Double redirect (>>) appends the contents of file1 to file2.
         Single redirect ( > ) overwrites the contents of file2 with the 
         contents of file1.

Monday, March 26, 2012

Modifying APN settings in embedded linux


Below ppp-on-dialer script has to be modified to change the APN settings.
Field after "IP" is the APN settings. In the below example AP is airtelgprs.com

#!/bin/sh
#
# This is part 2 of the ppp-on script. It will perform the connection
# protocol for the desired connection.
#
exec chat -v      \
 TIMEOUT  10    \
 ABORT  '\nBUSY\r'   \
 ABORT  '\nNO ANSWER\r'   \
 ''  'ATZ'    \
 'OK'  'ATQ0 V1 E1 S0=0 &C1 &D2' \
 'OK'  'AT+CGDCONT=1,"IP","airtelgprs.com"' \
 'OK'  'ATDT*99***1#'   \
 CONNECT  '' 

To view the dial up connection status

To view the dial up connection status execute the below command in the shell.


# tail -f /var/log/messages

Tuesday, July 26, 2011

How to set the environment variables in the linux


The below command set the environment for the current session only. Once the terminal is closed the environment variables need to set again for new session.


export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/home/ubuntu/EasyARM/work/crosstool/mini2440/usr/local/arm/4.3.2/bin


Similarly the path varies from other toolchains.





How to extract the .tar.bz2 file


Launch your terminal, access the directory containing your file using the "cd" command, then issue this command:

tar -xjf filename.tar.bz2

Monday, November 22, 2010

To know the current kernel version

Hi,
We can find the installed kernel version by executing the below command
rpm -qa | grep 'kernel'
Possible response could be-
abrt-addon-kerneloops-1.1.0-1.fc13.i686
kernel-2.6.33.3-85.fc13.i686

Display the detected serial ports

Hi,
To know which are all the serial ports detected and available we can
execute the below command.
dmesg | grep tty
and the possible response is:
console [tty0] enabled
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
00:09: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
00:0a: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A

The dmesg command is used to write the kernel messages to standard output(which by default is the display screen).

We can also write the output into a file let us say ttyInfo.log
For this we need to modify the above command as below
dmesg | grep tty >> ttyInfo.log