{"id":30531,"date":"2019-10-31T21:36:03","date_gmt":"2019-10-31T18:36:03","guid":{"rendered":"https:\/\/prohoster.info\/blog\/termux-shag-za-shagom-chast-2\/"},"modified":"2019-10-31T21:36:03","modified_gmt":"2019-10-31T18:36:03","slug":"termux-shag-za-shagom-chast-2","status":"publish","type":"post","link":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/termux-shag-za-shagom-chast-2","title":{"rendered":"Termux Step by Step (Part 2)","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>In <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/444950\/\">the previous part<\/a><\/noindex> We have familiarized ourselves with the basic commands of Termux, set up an SSH connection to the PC, learned to create aliases, and installed several useful utilities. This time we are about to take another step further, as we:<\/p>\n<p><\/p>\n<ul>\n<li>learn about Termux:API<\/li>\n<li>will install Python and nano, and also write 'Hello, world!' in Python.<\/li>\n<li>learn about bash scripts, and write a script using Termux:API<\/li>\n<li>using a bash script, Termux:API, and Python, we will write a simple program <noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/li>\n<\/ul>\n<p><\/p>\n<p>Since we now understand what the entered commands do, from the next step onward I won't describe each action in detail, but I will clarify where difficulties may arise.<\/p>\n<p><\/p>\n<p>I often use aliases, so the shortcuts used in this section are shown here:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">alias updg='apt update &amp;&amp; apt upgrade'\nalias py='python'<\/code><\/pre>\n<p><\/p>\n<p>The plan is ready, we can get started! And of course, don\u2019t forget about the 'magic Tab' (<noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/444950\/\">See Part 1<\/a><\/noindex>).<\/p>\n<p><\/p>\n<h2>Step 4<\/h2>\n<p><\/p>\n<h3>Diving into the Termux:API rabbit hole<\/h3>\n<p><\/p>\n<p><i>API, how much meaning this word holds for the heart of a coder<\/i><\/p>\n<p><\/p>\n<p>If we set aside the topic of Termux:API, all our steps could be reduced to a simple retelling of a brochure like 'Linux for Dummies', as was rightly noted in the comments to the first part.<\/p>\n<p><\/p>\n<p>First, we will install Termux:API from the Google Play Market (after that, it's a good idea to restart Termux):<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Termux Step by Step (Part 2)\" src=\"\/wp-content\/uploads\/2019\/03\/415e25a8ddefc5d4f1741c97d742eeb1.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>Next, we need to install the API package in the Termux console:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">updg # Don't forget about aliases\napt install termux-api<\/code><\/pre>\n<p><\/p>\n<p>For experiments, I am using Android 5.1.1; for Android 7 users, you need to 'protect' Termux:API by going to 'Settings' &gt; 'Protected apps', otherwise API calls like <code>termux-battery-status<\/code>, will hang. (See <noindex><a rel=\"nofollow\" href=\"https:\/\/wiki.termux.com\/wiki\/Termux:API\">the project wiki<\/a><\/noindex>)<\/p>\n<p><\/p>\n<p>Now let's get to know the acquired capabilities better. The most up-to-date and detailed description of Termux:API can be found at <noindex><a rel=\"nofollow\" href=\"https:\/\/wiki.termux.com\/wiki\/Termux:API\">the project wiki<\/a><\/noindex>. I will try to select the most illustrative and interesting examples that will help build your skills for independent work later.<\/p>\n<p><\/p>\n<h3>Several examples of Termux:API <\/h3>\n<p><\/p>\n<ul>\n<li>termux-battery-status<br \/>\nReturns battery status<br \/>\n<img decoding=\"async\" alt=\"Termux Step by Step (Part 2)\" src=\"\/wp-content\/uploads\/2019\/03\/9a5f793d1b028905b3ee9ceab0fbcdec.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/li>\n<li>termux-brightness<br \/>\nSets screen brightness from 0 to 255<br \/>\n<img decoding=\"async\" alt=\"Termux Step by Step (Part 2)\" src=\"\/wp-content\/uploads\/2019\/03\/23e5f3726607921d7f52d5d0de543968.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/li>\n<li>termux-toast<br \/>\nDisplays a temporary popup notification<br \/>\n<img decoding=\"async\" alt=\"Termux Step by Step (Part 2)\" src=\"\/wp-content\/uploads\/2019\/03\/5c75ad9b678773801ea9975b23422384.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/li>\n<li>termux-torch<br \/>\nTurns on the flashlight<br \/>\n<img decoding=\"async\" alt=\"Termux Step by Step (Part 2)\" src=\"\/wp-content\/uploads\/2019\/03\/7695202f5972e93e5b7a8f4bd952882c.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/li>\n<li>termux-wifi-scaninfo<br \/>\nReturns information about the last Wi-Fi network scan<br \/>\n<img decoding=\"async\" alt=\"Termux Step by Step (Part 2)\" src=\"\/wp-content\/uploads\/2019\/03\/f10669f8e7dff1046ab4f9b7d68228e0.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/li>\n<\/ul>\n<p><\/p>\n<p>It is not hard to notice that the returned values are strings, dictionaries, lists of dictionaries, in general, data types that Python works with perfectly, so the next step is to install it.<\/p>\n<p><\/p>\n<h2>Step 5<\/h2>\n<p><\/p>\n<h3>Let's install Python and nano<\/h3>\n<p><\/p>\n<p>To install Python, we type in the terminal:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">updg\napt install python\napt install python2<\/code><\/pre>\n<p><\/p>\n<p>Now we have Python 2 and 3 installed.<\/p>\n<p><\/p>\n<p>During the work on the article, I discovered another text editor, nano, which I like more than vim, so let's install it:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">apt install nano<\/code><\/pre>\n<p><\/p>\n<p>It's easier to use than vim, and nano has a more user-friendly interface. <i>On Android devices, vim is still more convenient.<\/i><\/p>\n<p><\/p>\n<h3>HelloWorld in Python on Termux<\/h3>\n<p><\/p>\n<p>In general, this point could have been skipped, but installing Python in Termux and not writing HelloWorld seems like a faux pas to me.<\/p>\n<p><\/p>\n<p>I don\u2019t aim to teach anyone Python, so those unfamiliar can simply copy the code (or start learning independently, as there is plenty of literature), while those who know can try to create something themselves. Meanwhile, I'll 'under the noise' also show a method for entering text in the terminal without an editor.<\/p>\n<p><\/p>\n<pre><code class=\"bash\">cat &gt;hello-world.py     \n# If you do not specify a source (reminding you cat 1.txt &gt; 2.txt)\n# then cat will take data from the standard input,\n# in simpler terms, what you type on the keyboard.\n\nstr = 'Hello, world!' # assigning the value \"Hello, world!\" to the variable str\nprint (str) # displaying the value from the variable str on the screen\n\n# Ctrl + D to finish input and save the file (hello-world.py)\n\npy hello-world.py # running the file (py is an alias for python)<\/code><\/pre>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Termux Step by Step (Part 2)\" src=\"\/wp-content\/uploads\/2019\/03\/e9086da1ce27f723681f142dad11d878.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>If during input you did not notice an error and already pressed Enter, you cannot move to the previous line; to do this, finish the input by pressing Ctrl + D (you can also interrupt it with Ctrl + Z) and repeat everything from the beginning. Since we used '&gt;', the file will be completely overwritten. For this reason, I do not recommend using this method of input if you are not sure you will write the code correctly the first time.<\/p>\n<p><\/p>\n<h2>Step 6<\/h2>\n<p><\/p>\n<h3>Bash scripts<\/h3>\n<p><\/p>\n<p>Bash scripts are a wonderful way to automate tasks in the terminal. A script is a file with a .sh extension (the extension is not mandatory) containing a set of terminal commands, some of which we have already learned. Here is <noindex><a rel=\"nofollow\" href=\"https:\/\/tproger.ru\/translations\/bash-cheatsheet\/\">a list of most commands<\/a><\/noindex>, everything should work, but note that this is a list for 'adult' Linux, not for Termux, but just plain <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/325522\/\">fantastic material on bash scripts<\/a><\/noindex>.<\/p>\n<p><\/p>\n<p>Using scripts, you can automate almost all monotonous tasks. Let's write a simple bash script that outputs a value from a variable created by the script itself. I'll use cat again, but you can use a regular text editor, and those eager to practice can use echo.<\/p>\n<p><\/p>\n<pre><code class=\"bash\">cat &gt;test.sh\n\nexport str=\"Hello, Habr!\"\n# export creates a variable str\n# and assigns it the value \"Hello, Habr!\"\n# Do not put spaces before or after \u2018=\u2019\n\necho $str # To access variables, put \u2018$\u2019 before them\n\n# Ctrl + D\n\n# .\/test.sh to run the script, but if you do it now, there will be an error\n# to avoid the error, you need to make the test.sh file executable\n\nchmod +x test.sh\n# chmod changes access rights (+ add \/ - remove)\n# \u2018+x\u2019 means we are making the file executable\n\n.\/test.sh # We run our script<\/code><\/pre>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Termux Step by Step (Part 2)\" src=\"\/wp-content\/uploads\/2019\/03\/7c56f1aaf938a711f3a30dd3eed3eec7.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<h3>Bash script with Termux:API<\/h3>\n<p><\/p>\n<p>Let's write something different from the infamous HelloWorlds, but equally useless. Our script will:<\/p>\n<p><\/p>\n<ol>\n<li>execute the API termux-battery-status request<\/li>\n<li>save the obtained data in the file test.txt<\/li>\n<li>output the data from the file to the screen<\/li>\n<li>execute the previously written program hello-world.py<\/li>\n<li>write the data received from the program into the file test.txt<\/li>\n<li>output the data from the file to the screen<\/li>\n<li>copy data from the file to the clipboard<\/li>\n<li>output the clipboard content to the screen<\/li>\n<li>display a popup message with the data from the clipboard<\/li>\n<\/ol>\n<p><\/p>\n<p>First, let's create a working folder and copy hello-world.py there as test.py. We'll create the files test.sh and test.txt in this folder:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">mkdir bashscript\n\ncat hello-world.py &gt;&gt; bashscript\/test.py\n\ncd bashscript\/\n\ntouch test.sh test.txt # touch creates files\n\nchmod +x test.sh<\/code><\/pre>\n<p><\/p>\n<p>Now let's write the script into test.sh using any convenient method:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">#!\/bin\/bash\n\n# \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c #! (\u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0448\u0435\u0431\u0430\u043d\u0433)\n# \u043f\u043e\u0441\u043b\u0435 \u0438\u0434\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043d\u0430 \u0448\u0435\u043b\u043b \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0441\u043a\u0440\u0438\u043f\u0442\n\nclear # \u043e\u0447\u0438\u0441\u0442\u0438\u043c \u043e\u043a\u043d\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430\n\ntermux-battery-status &gt; test.txt # \u043f\u0443\u043d\u043a\u0442\u044b 1 \u0438 2 \u0438\u0437 \u043d\u0430\u043c\u0435\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430\n\ncat test.txt # \u043f\u0443\u043d\u043a\u0442 3\n\npython test.py &gt; test.txt # \u043f\u0443\u043d\u043a\u0442 4 \u0438 5\n\ncat test.txt # \u043f\u0443\u043d\u043a\u0442 6\n\ncat test.txt | termux-clipboard-set # \u043f\u0443\u043d\u043a\u0442 7\n# | \u044d\u0442\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440. \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0432\u044b\u0445\u043e\u0434\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0434\u0440\u0443\u0433\u043e\u0433\u043e\n\ntermux-clipboard-get # \u043f\u0443\u043d\u043a\u0442 8\n\ntermux-clipboard-get | termux-toast # \u043f\u0443\u043d\u043a\u0442 9<\/code><\/pre>\n<p><\/p>\n<p>Now, in the bashscript folder, we write <code>.\/test.sh<\/code> and watch in the terminal on the Android device:<\/p>\n<p><\/p>\n<p><img decoding=\"async\" alt=\"Termux Step by Step (Part 2)\" src=\"\/wp-content\/uploads\/2019\/03\/44c6632c7a3903dad1113017dc81ee61.jpg\" style=\"display:block;margin: 0 auto;\" \/><\/p>\n<p><\/p>\n<p>We have written the planned bash script. You can enhance its output with progress information for each action (using echo), which I'll leave for the readers.<\/p>\n<p><\/p>\n<h2>Step 7<\/h2>\n<p><\/p>\n<h3>Let's do something useful<\/h3>\n<p><\/p>\n<p><i>Relatively useful<\/i><\/p>\n<p><\/p>\n<p>Formulate the technical specifications<br \/>\nThe application should place a random string from a file into the clipboard upon startup and notify this with a popup message.<\/p>\n<p><\/p>\n<p>We'll base it on a bash script, extracting a random string from the file using a Python subroutine. Let's outline the script's plan:<\/p>\n<p><\/p>\n<ol>\n<li>Run the subroutine<\/li>\n<li>Copy the output of the subprogram to the clipboard<\/li>\n<li>Display a popup message<\/li>\n<\/ol>\n<p><\/p>\n<p>Let's define the names of the application's directory and files:<\/p>\n<p><\/p>\n<ul>\n<li>folder rndstr in the home directory\n<ul>\n<li>source \u2014 the file from which we will take the lines<\/li>\n<li>rndstr.py \u2014 a subprogram that outputs a random line from the source file to the console<\/li>\n<li>rndstr.sh \u2014 the script file<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><\/p>\n<p>Create the application's directory and move into it to create the files there.<\/p>\n<p><\/p>\n<p>The first two steps of the script plan can be combined into a pipeline, ultimately using Termux:API we get:<\/p>\n<p><\/p>\n<pre><code class=\"bash\">#!\/bin\/bash\n\npython ~\/rndstr\/rndstr.py | termux-clipboard-set # 1 \u0438 2 \u043f\u0443\u043d\u043a\u0442\u044b \u043f\u043b\u0430\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u044b\n\ntermux-toast \"OK\" # 3 \u043f\u0443\u043d\u043a\u0442. \u0412\u044b\u0432\u043e\u0434\u0438\u043c \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \"\u041e\u041a\"<\/code><\/pre>\n<p><\/p>\n<p>You can place any text logically divided into lines in the source file; I decided to include quotes:<\/p>\n<p>\n<b class=\"spoiler_title\">Listing of the source file<\/b><\/p>\n<pre><code class=\"plaintext\">Sincerity is not truth. L. Lavelle\nEndure and restrain yourself. Epictetus\nOnly what is selfless is noble. J. La Bruy\u00e8re\nBe wisely daring. B. Gracian\nKindness is better than beauty. G. Heine\nFor great deeds, tireless perseverance is essential. F. Voltaire\nIf you want to be always please, serve yourself. B. Franklin\nExcessive modesty is nothing but hidden pride. A. Chenier\nVery intelligent people start to be distrusted when they show embarrassment. F. Nietzsche\nPoverty indicates a lack of means, not a lack of nobility. D. Boccaccio\nOne must beware of taking modesty to the point of humiliation. A. Bakihanov\nHe who renounces much can afford much. J. Chardon\nWhen we are paid for a noble act, it is taken from us. N. Chamfort\nNot receiving at all is not scary, but losing what one received is painful. Claudius Aelian\nIt is easier to patiently endure that which we cannot change. Horace\nYou tire of waiting, but how much worse would it be if there were nothing left to wait for. B. Shaw\nEverything comes in time if people know how to wait. F. Rabelais\nWith our patience, we can achieve more than with force. E. Burke\nWe must learn to endure what cannot be avoided. M. Montaigne\nHe who is bold in deed will not be frightened by words. Sophocles\nI do not like to fight; I like to win. B. Shaw\nA cornered and pressed cat turns into a tiger. M. Cervantes\nA worthy person does not follow in the footsteps of others. Confucius\nA great mind will demonstrate its strength not only in the ability to think, but in the ability to live. R. Emerson\nFame is an unprofitable commodity. It is expensive and poorly maintained. O. Balzac\nRestraint and appropriateness in conversations are worth more than eloquence. F. Bacon\nHe who cannot be silent cannot speak. Seneca the Younger\nGood manners consist of small sacrifices. F. Chesterfield\nA good person is not one who can do good, but one who cannot do evil. V. Klyuchevsky\nDo not make irrevocable judgments! Augustine\nNothing too much! Solon<\/code><\/pre>\n<p><\/p>\n<p>We need to create a subprogram that extracts a random string from the source file.<br \/>\nLet's outline the algorithm for the subprogram's operation:<\/p>\n<p><\/p>\n<ol>\n<li>Open the source file<\/li>\n<li>Count the number of lines in the opened file<\/li>\n<li>Close the file (there's no need to keep it open for longer than necessary)<\/li>\n<li>Generate a random integer within the number of lines in the source file<\/li>\n<li>Open the source file<\/li>\n<li>Output the line corresponding to the generated number<\/li>\n<li>Close the file<\/li>\n<\/ol>\n<p><\/p>\n<p>Implementing the algorithm in Python (I'm writing for Python 3.7):<\/p>\n<p><\/p>\n<pre><code class=\"python\">import random  # import for generating random numbers\nimport os  # for getting the path\n\npath = os.path.abspath(__file__)  # get the direct path to the file rndstr.py\npath = os.path.dirname(path)  # convert to the directory path\npath = path + 'source'  # convert to the path for the source file\n\nf = open(path)  # open the file\ni = 0  # reset the counter\nfor str in f: i+=1  # count the lines in the file\nf.close  # close the file\n\nj = int(round(i * random.random()))  # generate a random integer from 0 to i\n\nf = open(path)  # open the file\ni = 0  # reset the counter\nfor str in f:  # iterate through the lines from the file\n    if i == j:  # if the line counter equals the generated number\n        print (str, end='')  # output the line without a new line\n        break  # exit the loop\n    i+=1  # increment the counter by 1\nf.close  # close the file<\/code><\/pre>\n<p><\/p>\n<p>After the files are created and written, execution permissions need to be granted to the file <code>rndstr.sh<\/code>, and create an alias for quick execution.<\/p>\n<p><\/p>\n<pre><code class=\"bash\">alias rnst=\"~\/rndstr\/rndstr.sh\"<\/code><\/pre>\n<p><\/p>\n<p>Now by typing in the terminal <code>rnst<\/code> we'll get a random aphorism in the clipboard, which, for example, can be used in correspondence.<\/p>\n<p><\/p>\n<p>Well, we've written something useful, relatively useful.<\/p>\n<p><\/p>\n<h3>P.s.<\/h3>\n<p><\/p>\n<p>I intentionally did not provide screenshots in the last step and did not elaborate on some actions, only outlining the contents of the files, so that readers would have the opportunity to work independently.<\/p>\n<p><\/p>\n<p>With this 'Termux step by step', I think it\u2019s time to wrap up. Of course, these are just the very first steps, but now you can move forward on your own.<\/p>\n<p><\/p>\n<p>Initially, I planned to show in this series how to use nmap, sqlmap, but even without me, there are already many articles on this topic. If you'd like me to continue the 'Termux step by step' series, there\u2019s a poll below, and in the comments, you can suggest what else to write about.<\/p>\n<p class=\"for_users_only_msg\">Only registered users can participate in the survey. <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/auth\/login\/\">Please log in<\/a><\/noindex>, please.<\/p>\n<h2 class=\"default-block__polling-title\">Continue \"Termux step by step\"?<\/h2>\n<ul class=\"content-list content-list_polling\">\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    Yes<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    No<\/p>\n<\/li>\n<\/ul>\n<p>    2 users have voted. There are no abstentions.<br \/>\n<br \/>Source: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/445868\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0441 \u0432\u0430\u043c\u0438 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u0441 \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438 Termux&#8217;\u0430, \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 SSH \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u041f\u041a, \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c alias&#8217;\u044b \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0443\u0442\u0438\u043b\u0438\u0442. \u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0448\u0430\u0433\u043d\u0443\u0442\u044c \u0435\u0449\u0435 \u0434\u0430\u043b\u044c\u0448\u0435, \u043c\u044b \u0441 \u0432\u0430\u043c\u0438: \u0443\u0437\u043d\u0430\u0435\u043c \u043f\u0440\u043e Termux:API \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c Python \u0438 nano, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c &#171;Hello, world!&#187; \u043d\u0430 Python \u0443\u0437\u043d\u0430\u0435\u043c \u043f\u0440\u043e bash-\u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":22529,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-30531","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0441 \u0432\u0430\u043c\u0438 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u0441 \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438 Termux&#039;\u0430, \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 SSH \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u041f\u041a, \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c alias&#039;\u044b \u0438.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/termux-shag-za-shagom-chast-2\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47Termux \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c (\u0427\u0430\u0441\u0442\u044c 2) | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0441 \u0432\u0430\u043c\u0438 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u0441 \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438 Termux&#039;\u0430, \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 SSH \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u041f\u041a, \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c alias&#039;\u044b \u0438.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/termux-shag-za-shagom-chast-2\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T18:36:03+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T18:36:03+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Termux Step by Step (Part 2) | ProHoster","description":"In the previous part, we got acquainted with the basic commands of Termux, set up an SSH connection with a PC, and learned how to create aliases.","canonical_url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/termux-shag-za-shagom-chast-2","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47Termux \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c (\u0427\u0430\u0441\u0442\u044c 2) | ProHoster","og:description":"\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0441 \u0432\u0430\u043c\u0438 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u0441 \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438 Termux'\u0430, \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 SSH \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u041f\u041a, \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c alias'\u044b \u0438.","og:url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/termux-shag-za-shagom-chast-2","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T18:36:03+00:00","article:modified_time":"2019-10-31T18:36:03+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"30531","title":null,"description":null,"keywords":null,"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-21 01:39:20","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 13:16:48","updated":"2026-08-11 12:50:36","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/30531","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/comments?post=30531"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/30531\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media\/22529"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media?parent=30531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/categories?post=30531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/tags?post=30531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}