Wednesday, September 28, 2011

General Purpose utilities commands in Linux


1. Calender
cal: Command to see calender for any specific month or a complete year
Usage: 
$ cal [ [month] year]
Example:
$ cal april 2009
Output:
April 2009
Su Mo Tu We Th Fr Sa
 1  2  3  4
5   6  7  8  9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30

2. Date
date: displays the current date
Usage:
$ date
Output:
Tue Apr 21 21:33:49 IST 2009
user$ date +"%D %H:%M:%S"
04/21/09 21:35:02
Options:
d - The da of the month (1-31)
y - The last two digits of the year
H,M,S - Hour Minute and second respectively
D - the date in mm/dd/yy

3. echo
echo: Print message on the terminal
Usage:
echo ""
Example:
$ echo "Welcome to the workshop"
Output:
Welcome to the workshop

4. printf
printf: Print the formatted message on the terminal
Usage:
printf ""
Example:
$ printf "the amount is %d\n" 100
Output:
the amount is 100

5. Calculator
bc: A text based calculator
Usage:
$ bc
2*10+20-9+4/2 [Input]
33 [Output]
[ctrl+d] [Quit]

xcalc is graphical based calculator

6. script
script command records your session and stores it in a file
Usage:
$ script
Script started, file is typescript
$ echo "this is a sample script"
this is a sample script
$ [ctrl+d]
Script done, file is typescript

By default if you dont specify any file name the contents will be stored in file name typescipt
Usage:
$ cat typescript
Script started on Tuesday 21 April 2009 10:07:00
$ echo "this is a sample script"
this is a sample script
$
Script done on Tuesday 21 April 2009 10:07:34 PM

7. passwd
passwd command allows you to change your password
Usage:
$ passwd
Changing password for user123.
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

8. WHO: Who are the users?
who command tells you the users currently logged on to the system
Usage:
$ who
root     :0           Sep  4 22:47
root     pts/1        Sep  4 22:48 (:0.0)

9. man - The reference Manual
man displays the documentation for a command
Usage:
man
Example:
$ man ls
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the
none of -cftuvSUX nor --sort.

Thursday, April 7, 2011

Basic Android Terminal and ADB Shell Command List

1. Restart Android Phone
adb shell reboot
2. Restart Android into Recovery Mode
adb shell reboot recovery
3. Convert back to ext2 partition

adb shell === ENTER

tune2fs-O ^ has_journal / dev/block/mmcblk0p2 === carriage return

e2fsck / dev/block/mmcblk0p2 === carriage return (optional, can be a problem area in section 2, when used)

4. Pulling applications from Android phone to computer
adb pull /system/sd/app app

adb pull /system/sd/app-private app-private
5. Pushing applications back to android phone from the computer
adb push app /system/sd/app

adb push app-private /system/sd/app-private
6. Delete existing apps on Android SD
adb shell rm -r /system/sd/app

adb shell rm -r /system/sd/app-private
7. Repair gravity System or switch to screen

Sometimes frequent brushing of phone can cause gravity system or switch to screen failure. Just follow the steps below-
Restart the phone into Recovery mode, press "Alt + X" into the console
Open cmd and enter the following command

mount / data === carriage return

rm / data / misc / akmd * / data / misc / rild *
8. Ext2/ext3/ext4 formatted partition
adb remount

adb shell

rm-r / system / sd / *
9. Remove/ system / app under the application
adb remount

adb rm / system / app / Stocks.apk
10. If the start Time is too Long
adb logcat
11. Through Terminal Partition SD card

It will erase everything on your SD card

$ su

# cd /data

# wget http://64.105.21.209/bin/lib/droid/sdsplit

# chmod 555 sdsplit

# /data/sdsplit -fs *size* (add -nc to the end for JFv1.5ADP)

12. From the Recovery Screen, send an update file to your SD card.
adb shell mount /sdcard

adb shell rm /sdcard/update.zip

adb push *filename* /sdcard/update.zip

13. Restoring a nandroid backup via Fastboot

Start command-prompt/terminal cd to the nandroid folder and enter following commands

fastboot erase boot

fastboot erase recovery

fastboot flash system system.img

fastboot flash boot boot.img

fastboot flash userdata data.img

fastboot flash recovery recovery.img

fastboot reboot