Liunx Common Commands

Source: Internet
Author: User
Tags clear screen set background


Liunx Common Commands
================================================================================


1. Remotely copy files
---------------------------------------------------------------------------------
scp-r [email protected]:/home2/xyf/a20/android4.0./android/

2. Telnet
---------------------------------------------------------------------------------
SSH [email protected]

Convert L:/fs:ntfs//L is your disk character formatted USB drive, when your disk is larger than 4G, want to copy larger than 4G file

3. Log in to the drive configuration file
---------------------------------------------------------------------------------
Make Menuconfig Arch=arm

Select platform for ARM the default is x86.


4. Printing information
---------------------------------------------------------------------------------
ADB shell Logcat-b Radio > Logcat-radio.log-3g dongle

At the end of preinstall.sh, add the following command:

echo 8 >/PROC/SYS/KERNEL/PRINTK

Echo 1 >/sys/class/axppower/axpdebug
cat/proc/kmsg >/data/local/kmsg ' Date +%y%m%d_%h%m%s ' &

Logcat >/data/local/logcat ' Date +%y%m%d_%h%m%s ' &

ADB shell
ls | BusyBox grep DRM


The above command generates log information under/data/local/logcat and is named after the boot time.


5. After we have modified the tool SYS_CONFIG1, if we can not upgrade the entire firmware let it take effect
---------------------------------------------------------------------------------

After modifying the SYS_CONFIG1, if you can not upgrade the entire firmware let it take effect

1>. In Android Shell, Mount/dev/block/nanda to a node:
Mount-t Vfat/dev/block/nanda/mnt/nand

2>. Modify the build firmware after SYS_CONFIG1, and then locate Scrpt.bin and Script0.bin under Lichee\tools\pack\out\bootfs

3>. Then, after connecting with ADB, push Scritp.bin and Script0.bin to the root of the Mount node and replace the original file with the same name:
ADB push script*.bin/mnt/nand/

4>. Last sync restart

ADB shell
Sync
Reboot


6. How to replace the kernel separately
---------------------------------------------------------------------------------
1>. The Android Shell will mount/dev/block/nanda to a node:
Mount-t Vfat/dev/block/nanda/mnt/nand

2>. After connecting with ADB, push the bimage directly to the Linux directory of the Mount node and replace the Bimage:
ADB push Bimage/mnt/nand/linux

3>. Sync reboot

ADB shell
Sync
Reboot


7.git and Repo basic commands
---------------------------------------------------------------------------------

Repo
========================
1>. Repo status-View all git statuses under project
2>. Repo branch-> View project under so branch
3>. Repo Start < branch name >--all Create Repo Branch
4>. Repo Checkout < branch name >-> Toggle Branch
5>. Repo forall-c git remote-v, view remote branch
6>. Repo forall-c git pull < remote branch > < local branch >-Sync Remote Branch to local
7>. Repo forall-c git merge < merge bug Branch >
8>. Repo forall-c git branch-d < remove a branch name >
9>. Repo forall-c git checkout .-> check out what's on Git
10>. Repo forall-c git checkout-b branch name This command will perform new and toggle branch commands for project under Repo
11>. Repo forall-c git diff < branch name--< branch name +>--compare two branches differently

Repo forall-c ' pwd && git fetch exdroid ' updates the server and does not change local content
Repo forall-c ' pwd && git status ' Verify the status of each branch
Repo forall-c git checkout-b < branch name >-> Toggle All branches of the corresponding branch repo
Repo forall-c git remote-v-> See all the original branches
Repo forall-p-c ' git log--oneline--name-only--committer=cqq '//view files that have been modified
Repo forall-c git config core.filemode false//ignore permission modifications

Update, it is recommended that a backup branch be built before the update.
This way, even if there is a problem with the new code, you can switch the old Code sub-expenditure software, the new code is stable after the backup branch can be deleted
Repo Checkout Develop
Repo Forall-p-C git pull exdroid develop//android
Repo Forall-p-c git pull exdroid develop:develop//update tag with this command if not updated to tag
Repo forall-c ' pwd && git status '//display status
Repo Forall-p-C git pull Lichee develop//lichee
Repo Checkout Mybranch
Repo forall-c git merge Develop

Conflict markers, starting at: <<<<<<< HEAD

git cherry-pick commit-id//Pick Merge


Git
========================
1>. Git status-s
2>. View log information and modified content in git log--stat
3>. Git diff
4>. git diff--cached
5>. git diff HEAD
6>. Git show-> view history changes unrelated to Git
Git show <commit id>
git rev-parse < branch name >-> view current Conmit ID value
git Reflog, reference log
Git show head^-> View last-submitted information
Git show d921970^-> Second commit ^ equals ~
Git show head~3-> head^ ^^
Git remote show remotely library name

7>. git log--online-> view hash value for each commit
8>. Git br-v-> view the last commit of a branch
9>. git Add. --Add all the modified files under current Git
Ten. Git rm < file name >-> Delete del file
Git ci-m "comments" and submit modified files
git reset HEAD
git reset head^3
Git reset commit-> undo the specified version
git rm--cached <file>-> delete files in staging area, workspace unchanged
Checkout. Git.
Checkout git--<file>-> Replace the contents of the workspace with staging area content
git checkout HEAD->head content replace staging area and workspace content
GIT branch < new branch >
git branch-d < Delete branch >//if the branch is not merged, the deletion will fail
Git branch-d < deleted branches >///even if the branch is not merged
git reset--hard + id-> back to the future, and then all of them were erased.
. Git checkout–b new_branch local_branch//Switch to an already established local branch Local_branch, and use this branch to initialize a new branch new_branch.
git checkout–b new_branch remote_branch//switch to a remote branch remote_branch, and use this branch to initialize a new branch new_branch< local branch >.
git checkout–b new_branch commit_id//switch to a commit ID and create a new branch New_branch
Checkout–b git new_branch tag//switch to a tag and create a new branch New_branch
git config--global user.name "John Doe"
. git config user.name "John Doe"
git config--global user.email [email protected]
git config user.email [email protected]
Revert git commit-id//restore a specified version of a modification
Git show//show last commit content
The. Git show--name-only//displays only the modified file name, not the contents of the modified row
git tag//view tag a milestone
git tag v1.0//create a new tag
git tag-a v1.0.1-m "comments"//Annotated Tag
tag-n<num>//git to view tagged tags <num> see the maximum number of rows
A. Git reset--soft back to advance many times before git Commot--amend-m "new Comments" etc Undo Check out the p156 git guide

' Find-name ' "' or $ (find-name" ")
A. Git whatchange-num//view the files modified by the branch

A. Git clean-dn//confirm whether to delete
Max. Git clean-dxf//clear files not joined to version control

$. git config--list
-----------------------------------------------------------------------------------------

Git saves the progress of the work

Git stash Save
git checkout xxx

git checkout Xxx_
Git stash pop recovery


-----------------------

Problem point:

If no other git process are currently running, this probably means a
Git process crashed in this repository earlier. Make sure no other git
Process is running and remove the file manually to continue.

Method:
Rm-f./.git/index.lock

8. Find Command View
---------------------------------------------------------------------------------

1. Find./-name "string"

Find. -type F | Xargs sed-i ' s/a31st/xxx/g '

2. grep "string"./-rn

3. Cat/system/usr/device.info

4. Cat/data/device.info

9. Logcat
---------------------------------------------------------------------------------
Basic commands

1. ADB logcat-c clears all previous logs

2.ADB logcat-d This command is in the reverse of time. The log that you first operated and then knocked on the command was the log that you just manipulated and automatically exited log mode.

3.adb logcat-s "XXX" This is set to filter for example you just want to view Firstdemo's log to replace the last XXX

Filter

1.ADB Logcat activitymanager:i Myapp:d *:s

Eg:activitymanage:
I/activitymanager (585): Starting activity:intent {action=android.intent.action ...}

The last element of the expression above *:s, is to set all the labels as "silent", all the logs are only shown with "View" and "MyApp", another use of *:s is to be able to ensure that the log output is in accordance with the filter description limit, Also let the filter output to the log as an item.

2.ADB Logcat *:w
The above filter statement refers to the display of log information with priority warning or higher

3. ADB logcat-v thread-to [ADB] logcat [-v]

Here is the log format generated with thread:
Note that you only have the-V option to specify the output format options.

4. View the available log buffers

The Android log system has a loop buffer, and not all log systems have a default loop buffer. In order to get the log information, you need to start logcat with the-B option. If you want to use a loop buffer, you need to see the remaining loop buffer period:

radio-View the information about the buffer.

events-view the buffer associated with the event.

main-viewing the primary log buffer

[ADB] logcat [-b]

The following example shows how to view the log buffer containing radio and telephony information:

ADB logcat-b Radio


5. Logcat-v time-s "xxx"

10. Kernel Print Level
---------------------------------------------------------------------------------

echo 8 > PROC/SYS/KERNEL/PRINTK to see all kernel prints
Echo 1 >/sys/class/axppower/axpdebug

Logcat-v Time >/sdcard/log1 $
Cat/proc/kmsg >/SDCARD/KMSG1 & directed to SD card

Chiphd Search
---------------------------------------------------------------------------------
git clone ssh://[email Protected]/home2/builder/release/chiphd_script/zzzzz-chiphd
git clone ssh://[email protected]/home/droid05/git/clone.git/llf-chiphd.git
git clone ssh://[email protected]/home/droid05/git/clone.git/sugar-chiphd.git
git clone ssh://[email protected]/home/git/git_repo/chiphd_devices/a3xbox/4.2/mars_g1000.git
git clone ssh://[email protected]/home2/boxbuilder/git/project/chiphddevices.git
git clone ssh://[email protected]/git_repo/chiphd_devices/a31s/4.4/chiphddevices.git

git clone ssh://[email protected]/home2/boxbuilder/git/a3142/chiphddevices.git//a31 Zhong Nuo
Ssh://[email PROTECTED]/HOME2/HBC/GIT/WINNERS/WINNERS.GIT//F10


Back
------------
I15
git clone ssh://[email protected]/home2/hbc/git/i15/android.git
git clone ssh://[email protected]/home2/hbc/git/i15/lichee.git

I12
git clone ssh://[email protected]/home2/hbc/git/sugar-a20/android.git
git clone ssh://[email protected]/home2/hbc/git/sugar-a20/lichee.git


Script library file download full Blog SDK
git clone ssh://[email Protected]/home2/builder/release/chiphd_script
./download_chiphd_aosp_autoscan.sh--allwinner
CP chiphd_script/tar_repo.sh.


Public
git clone ssh://[email protected]/home2/xyf/git/h8/chiphddevices.git

12.git Patch
---------------------------------------------------------------------------------
1. Git format-patch-1 single commit for patch

Check the availability of patches before use:

git apply--check newpatch.patch check patch file First
git apply--stat newpatch.patch check for successful application


Reference patch

Patch_chiphd_ap 0001-add-osd-usb-insmod-and-rrmod.patch patched but not automatically submitted
git am--signoff < newpatch.patch patch, use the-s or--signoff option to add signed-off-by information to the commit message)

////////////////////////////////////////////////////////////////////
Create patch, 1B6D is hash value
git diff 1b6d > My.patch
git format-patch 1b6d//More formal
Git format-patch-3//Create the first 3 commit patches in sequence

Hit patch
git Apply < My.patch
Before actually patching, you can use Git apply--check to see if the patch can be applied cleanly and smoothly to the current branch
git apply--check 0001-seeing-if-this-helps-the-gem.patch
git apply 0001-seeing-if-this-helps-the-gem.patch//Then patch


13. Create Project Engineering
-------------------------------------------------------------------------------------
createproject.sh

14.
-------------------------------------------------------------------------------------
Tar zcvf. /a13_eclipse.src.tar.gz ' Cat. Classpath | grep classpathentry | Sed ' s%.*path= ' \ ([^ "]*\)". *$%\1% ' | Sed ' s%net_out%% '

15.
---------------------------------------------------------------------------------------
Undo Check out the p156 git guide
Introduction git reset--soft back to advance several times "new notes" etc


. Tar packet filtering
---------------------------------------------------------------------------------------
Tar zcvf xxx.tar.gz/etc--exclude= + file + folder is for the current directory
Tar zcvf. /11.tar.gz./--EXCLUDE=1/2/3--exclude=.git

17. Get Android source code containing only *.java
---------------------------------------------------------------------------------------
1. CP Development/ide/eclipse/.classpath.
2. tfiles=$ (sed-n '/path= "/P '/.classpath | sed ' s%.*path=" \ ([^ "]*\]". *$%\1% ')
3. LS $TFiles 1>/dev/null error, delete the diverted
4. Tar zcvf. /a13_eclipse.src.tar.gz $TFiles. classpath

After decompression, import Eclipse to view the source code and debug.

Introduction to SED
------- ----------------------
Sed-i ' s/\r//' + filename replacement \ n

Shell Shell Debug http://www.cnblogs.com/softwaretesting/archive/2012/02/06/2339671.html

1.echo
-------------------------
Word background color range: 40-49
40: Black
41: Crimson
42: Green
43: Yellow
44: Blue
45: Purple
46: Dark Green
47: White
-----------------------
Word Color: 30-39
30: Black
31: Red
32: Green
33: Yellow
34: Blue
35: Purple
36: Dark Green
37: White
-----------------------
ANSI Control code

\33[0m Close All Properties
\33[01m Setting High brightness
\33[04m Underline
\33[05m Flashing
\33[07M Reverse Display
\33[08m blanking
\33[30m--\33[37m setting foreground color
\33[40m--\33[47m Set background color
\33[na the cursor to move n rows
\33[NB cursor down n rows
\33[NC cursor right shifts n rows
\33[nd cursor left n rows
\33[Y;XH Setting the cursor position
\33[2J Clear Screen
\33[k clears the contents from the cursor to the end of the line
\33[s Save Cursor position
\33[u Restore cursor Position
\33[?25l Hide Cursor
\33[?25h Display cursor
----------------------------

eg

Echo-e "\033[31m xxx \033[0m"
Echo-e "\e[1;32m xxx \e[0m"

2.
-----------------------------------

Getprop sys.mem.opt
-----------------------------------
A23 1G and 512M Adaptive,
ADB shell
Getprop sys.mem.opt
The result of 1G is false
512M result is True

20.ssh
---------------------------------
Use Ssh-keygen to set up SSH without password login


Git is a distributed Code management tool, remote code management is SSH-based, so to use the remote git requires SSH configuration.

The SSH configuration for GitHub is as follows:
One

Set the user name and email for git:
$ git config--global user.name "Xuhaiyan"
$ git config--global user.email "[Email protected]"

Second, the process of generating SSH key:
1. See if you already have an SSH key: CD ~/.ssh
If there is no key then there will be no such folder, there is a backup to delete
2. Survival key:
$ ssh-keygen-t rsa-c "[Email protected]"
Press 3 to enter, the password is empty.
Your identification has been saved In/home/tekkub/.ssh/id_rsa.
Your public key has been saved in/home/tekkub/.ssh/id_rsa.pub.
The key fingerprint is:
..................

Finally, two files were obtained: Id_rsa and Id_rsa.pub

3. Add the encryption key to the Ssh:ssh-add file name
Enter the password before you need it.
4. Add the SSH key on GitHub, which adds the public key in "Id_rsa.pub".

Open https://github.com/, log in to xuhaiyan825, and then add SSH.

5. Test: SSH [email protected]

The authenticity of host ' github.com (207.97.227.239) ' can ' t be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Is you sure want to continue connecting (yes/no)? Yes
Warning:permanently added ' github.com,207.97.227.239′ (RSA) to the list of known hosts.
Error:hi tekkub! You ' ve successfully authenticated, and GitHub does not provide shell access
Connection to github.com closed.

Third, start using GitHub
1. Get the source code:

$ git clone [email protected]:billyanyteen/github-services.git

2. So there's a repo on your machine.
3.git different from SVN is that git is distributed and there is no server concept. All the people have a repo on the machine, each submission is to their own machine repo
Warehouse initialization:

Git init

Generate a snapshot and deposit the project index:

git add

Files, git rm,git mv, etc...
Project Index submission:

Git commit

4. Collaborative programming:
Merge the local repo with repo from the remote origin,
Push local update to remote:

Git push Origin Master

Update remote updates to Local:

Git pull Origin Master

Add:
To add a remote repo:

$ git remote add upstream git://github.com/pjhyett/github-services.git

To rename a remote repo:

$ git://github.com/pjhyett/github-services.git to "upstream"

21.VI encryption
--------------------------------

Using the name X to save the file is encrypted.
eg
: X
Please enter your password

Decryption method:
: Set key=//setting key is not empty
: W
: X
Decryption complete

Forget the password, this has not been solved.


Tar unpacking compression command set --------------------------------

23.apktools
--------------------------------
dochiphdpreapk ~/a31box_g2000/android/device/softwinner/xx/preapk

24.touch--------------------------------
Update all C and C + +
Find $path-name ' *. [hhcc]* ' | Xargs touch-c


The issue of ADB occupancy
--------------------------------
One, command: ADB Nodaemon server to see which port is occupied

Second, command: Netstat-ano | Findstr "5037" lists the processes on which the ports are occupied

Third, in the task Manager to find the corresponding port-occupied process, and then kill the process.

or kill the process with a command: Ntsd-c q-p ""


Ln-s Original Path link path

Liunx Common Commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.