CN103699361A - Linux command execution method for Android platform - Google Patents

Linux command execution method for Android platform Download PDF

Info

Publication number
CN103699361A
CN103699361A CN201310636028.XA CN201310636028A CN103699361A CN 103699361 A CN103699361 A CN 103699361A CN 201310636028 A CN201310636028 A CN 201310636028A CN 103699361 A CN103699361 A CN 103699361A
Authority
CN
China
Prior art keywords
command execution
linux
command
android
input
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201310636028.XA
Other languages
Chinese (zh)
Inventor
王亮
刘富强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Haiersoft Co Ltd
Original Assignee
Qingdao Haiersoft Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Haiersoft Co Ltd filed Critical Qingdao Haiersoft Co Ltd
Priority to CN201310636028.XA priority Critical patent/CN103699361A/en
Publication of CN103699361A publication Critical patent/CN103699361A/en
Pending legal-status Critical Current

Links

Abstract

The invention relates to a Linux command execution method for an Android platform. The Linux command execution method comprises the following steps of: (1) firstly, obtaining a command execution process through Runtime. getRuntime (); (2) obtaining input and output streams of the command execution process; (3) sending the command to the process through the output streams; (4) reading return results from the process through the input streams, wherein the process runs in a thread, and continuously reads the input streams. Through the method, the Linux command is input through Android on equipment conveniently, and results after the execution of a system are obtained. Without a PC and a data line, the whole process can be carried out entirely on a mobile phone, and the equipment can be operated anytime and anywhere.

Description

The Linux command execution of Android platform
Technical field
The Linux command executing method that the present invention relates to a kind of Android platform, is mainly used in mobile phone and panel computer.
Background technology
Android system is developed based on (SuSE) Linux OS, the kernel of android is exactly the kernel of the Linux that uses, so be the shell-command that can carry out Linux platform in android.Traditional method is to connect mobile phone or the dull and stereotyped PC of arriving by data line, then with the command-line tool ADB on PC, carrys out fill order, and this method restrictive condition is more, uses inconvenient.
Summary of the invention
The Linux command executing method that the object of this invention is to provide a kind of Android platform, to solve the use PC connection device that prior art exists and to use ADB to connect the problem of fill order inconvenience.
Technical scheme of the present invention is: a kind of Linux command executing method of Android platform, and step is as follows:
(1) first, by Runtime.getRuntime (), get the process of command execution;
(2) then obtain inlet flow and the output stream of process;
(3) by output stream, order is sent to process;
(4) by inlet flow, from process, read and return results, this process is carried out in thread, constantly reads inlet flow.
The invention has the beneficial effects as follows: by the present invention, can by the android on equipment, input Linux order easily, and get the result after system is carried out.No longer need the auxiliary of PC, no longer need data line, whole process can be carried out completely on mobile phone, whenever and wherever possible to operate, very convenient.
Embodiment
The Linux command executing method of a kind of Android platform of the present invention, step is as follows:
1. first, by Runtime.getRuntime () .exec (" ls "), get the process of command execution.This step is how to make Android system carry out the method for Linux order.
2. then obtain inlet flow and the output stream of process.This step be how input command to the method for system.
3. by output stream, order is sent to process.This step is how to obtain the method for the return data after command execution.
4. by inlet flow, from process, read and return results, this process is carried out in thread, constantly reads inlet flow.
Innovative point of the present invention is, the method of use Runtime.getRuntime () completes the input and output of the Linux order of Android platform, can be on android mobile device directly input operation order obtain rreturn value, no longer rely on PC and data line.

Claims (1)

1. a Linux command executing method for Android platform, step is as follows:
(1) first, by Runtime.getRuntime (), get the process of command execution;
(2) then obtain inlet flow and the output stream of process;
(3) by output stream, order is sent to process;
(4) by inlet flow, from process, read and return results, this process is carried out in thread, constantly reads inlet flow.
CN201310636028.XA 2013-12-03 2013-12-03 Linux command execution method for Android platform Pending CN103699361A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310636028.XA CN103699361A (en) 2013-12-03 2013-12-03 Linux command execution method for Android platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310636028.XA CN103699361A (en) 2013-12-03 2013-12-03 Linux command execution method for Android platform

Publications (1)

Publication Number Publication Date
CN103699361A true CN103699361A (en) 2014-04-02

Family

ID=50360902

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310636028.XA Pending CN103699361A (en) 2013-12-03 2013-12-03 Linux command execution method for Android platform

Country Status (1)

Country Link
CN (1) CN103699361A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113032018A (en) * 2019-12-25 2021-06-25 上海博泰悦臻电子设备制造有限公司 Improved method for reading command and related device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1229211A (en) * 1998-03-12 1999-09-22 富士通株式会社 Microprocessor, operation process execution method and recording medium
US6460135B1 (en) * 1998-10-02 2002-10-01 Nec Corporation Data type conversion based on comparison of type information of registers and execution result

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1229211A (en) * 1998-03-12 1999-09-22 富士通株式会社 Microprocessor, operation process execution method and recording medium
US6460135B1 (en) * 1998-10-02 2002-10-01 Nec Corporation Data type conversion based on comparison of type information of registers and execution result

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
LANF.DARWIN: "《Android应用开发攻略》", 31 March 2013, 机械工业出版社 *
佚名: "Android执行Linux外部命令", 《HTTP://BLOG.SINA.COM.CN/S/BLOG_49B531AF0102E102.HTML》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113032018A (en) * 2019-12-25 2021-06-25 上海博泰悦臻电子设备制造有限公司 Improved method for reading command and related device
CN113032018B (en) * 2019-12-25 2024-03-01 博泰车联网科技(上海)股份有限公司 Improved method for read command and related device

Similar Documents

Publication Publication Date Title
WO2013003227A8 (en) System and methods for driverless operation of usb device
WO2011153093A3 (en) Systems, methods, and apparatus to virtualize tpm accesses
WO2013006265A3 (en) Intermediation of hypervisor file system and storage device models
ATE546774T1 (en) MAKE A CHANGE TO A VIRTUAL CONFIGURATION TOPOLOGY
WO2015134655A3 (en) Systems and methods for intelligent controls for optimal resource allocation for data center operations
RU2015109474A (en) VECTOR EXCLUSION CODE
WO2010062514A3 (en) Technique for communicating interrupts in a computer system
EP2711845A3 (en) PCI express switch with logical device capability
WO2018209106A3 (en) System and method for the capture of mobile behavior, usage, or content exposure
CN103729042A (en) PCIE (peripheral communication interface express) intelligent switching method based on PCIE hot plug function
CN103699361A (en) Linux command execution method for Android platform
CN102981675A (en) Multi-point touch data processing method and multi-point touch data processing system thereof
GB2494578A (en) Fast remote communication and computation between processors
WO2019126797A3 (en) System and method for executing instructions
CN203825526U (en) Mainboard applied to audio processing equipment
CN209570925U (en) Board equipment for TEE test
CN208012754U (en) A kind of data collecting card suitable for optical fiber vibration sensing
MX2016007019A (en) Information processing method and device.
CN203911987U (en) Data processing system based on cloud computing
CN104331356A (en) Display device for computer data exchange speed
JP2018005947A5 (en) Computers for mechanical systems and control
CN105159755A (en) Simulation processing system of multiprocessor
CN204215164U (en) A kind of automated warehousing simulator based on ARM
CN203794380U (en) Special elevator LCD display controller based on STM8S chip
CN102486737A (en) Realization method of BIOS (Basic Input/Output System) in Southbridge SATA (Serial Advanced Technology Attachment) controller of Loongson blade

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20140402