{"id":398307,"date":"2024-06-29T13:59:52","date_gmt":"2024-06-29T13:59:52","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=398307"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T13:59:52","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=398307","title":{"rendered":"<span>\u041f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u044e Unix \u0432 21 \u0432\u0435\u043a<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/574778\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/_b\/gj\/ap\/_bgjap__bc0v7wbfcg8_kyozrj0.png\" data-src=\"https:\/\/habrastorage.org\/webt\/_b\/gj\/ap\/_bgjap__bc0v7wbfcg8_kyozrj0.png\"\/><\/div>\n<p><\/a><br \/>  \u041e\u0434\u0438\u043d \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u0438 Unix \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u0443 \u0437\u0430\u0434\u0430\u0447\u0443, \u0438 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0432 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440. \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0437\u0430\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b \u0441\u0435\u0431\u044f \u0437\u0430 \u0434\u0435\u0441\u044f\u0442\u0438\u043b\u0435\u0442\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b. <\/p>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0436\u0435 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0442\u043e\u043c, \u0447\u0435\u0433\u043e \u043e\u0449\u0443\u0442\u0438\u043c\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c Linux \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u044d\u0442\u0438\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c.<a name=\"habracut\"><\/a><\/p>\n<p>  \u0412\u043f\u0435\u0440\u0432\u044b\u0435 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u044f Unix \u0431\u044b\u043b\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0441\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432 \u043f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0438 \u043a \u043d\u0430\u0443\u0447\u043d\u043e\u043c\u0443 \u0436\u0443\u0440\u043d\u0430\u043b\u0443 Bell Systems Technical Journal 1978 \u0433\u043e\u0434\u0430, \u0433\u0434\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/nk\/wr\/mq\/nkwrmqlvwb9lpequ91yu4ievl6c.png\" data-src=\"https:\/\/habrastorage.org\/webt\/nk\/wr\/mq\/nkwrmqlvwb9lpequ91yu4ievl6c.png\"\/><\/div>\n<p>  <i><font color=\"#999999\">\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435 \u043a Bell System Technical Journal<\/font><\/i><\/p>\n<blockquote><p>\u0421\u0440\u0435\u0434\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b Unix \u0432\u044b\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0441\u044f \u043e\u0441\u043e\u0431\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0438 \u043f\u0440\u043e\u0434\u0432\u0438\u0433\u0430\u044e\u0449\u0438\u0439 \u0435\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c:<\/p>\n<p>  (i) \u0414\u043e\u0431\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u0434\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043b\u0443\u0447\u0448\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0447\u0435\u043c \u043d\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u043c\u0438 \u00ab\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438\u00bb \u0441\u0442\u0430\u0440\u044b\u0435. <\/p>\n<p>  (ii) \u0412\u044b\u0432\u043e\u0434 \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0432\u0432\u043e\u0434\u043e\u043c \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u043e\u0439. \u041d\u0435 \u0437\u0430\u0441\u043e\u0440\u044f\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u043f\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439. \u0418\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u0433\u043e \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u044b\u0445 \u0438\u043b\u0438 \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0435 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u044c\u0441\u044f \u043a \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u0432\u0432\u043e\u0434\u0443.<\/p>\n<p>  (iii) \u041f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u043d\u043d\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043d\u0435\u0434\u0435\u043b\u044c. \u041d\u0435 \u0441\u043e\u043c\u043d\u0435\u0432\u0430\u044f\u0441\u044c \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u043f\u0440\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438 \u0437\u0430\u043d\u043e\u0432\u043e \u0438\u0445 \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u044b\u0432\u0430\u0442\u044c.<\/p>\n<p>  (iv) \u041f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0435\u043a\u0432\u0430\u043b\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u043c\u043e\u0449\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0447\u0442\u043e\u0431\u044b\u2026<\/p><\/blockquote>\n<p>  \u041f\u0443\u043d\u043a\u0442\u044b i \u0438 ii \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0442\u0441\u044f \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0438 \u043d\u0435\u0441\u043f\u0440\u043e\u0441\u0442\u0430. \u041d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0442\u0438 \u044d\u0442\u0443 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u044e \u0432 21 \u0432\u0435\u043a, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430 \u0434\u043b\u044f \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0435\u0441\u043b\u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c IP-\u0430\u0434\u0440\u0435\u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 Ethernet-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 Linux, \u0442\u043e \u0434\u0435\u043b\u0430 \u043e\u0431\u0441\u0442\u043e\u044f\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">$ ifconfig ens33 | grep inet | awk '{print $2}' | cut -d\/ -f1 | head -n 1<\/code><\/pre>\n<p>  \u0421\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0440\u0430\u0434\u0443\u0435\u0442 \u0433\u043b\u0430\u0437.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0434\u043e 2013 \u0433\u043e\u0434\u0430 \u0441\u0447\u0438\u0442\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043d\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0432\u044b\u0432\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435. \u0412 Unix\/Linux \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0442\u0435\u043a\u0441\u0442\u0430, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a <code>sed<\/code>, <code>awk<\/code>, <code>grep<\/code>, <code>tr<\/code>, <code>cut<\/code>, <code>rev <\/code>\u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0434 \u0438\u0445 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435. <\/p>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u043e \u0431\u043e\u043b\u044c \u0438 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u043b\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u0442\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u0440\u0441\u0438\u0442\u044c \u043d\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 (\u043b\u0438\u0448\u044c \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443) \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0438\u0437\u043b\u0438\u0448\u043d\u0435 \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u043b\u043e \u0436\u0438\u0437\u043d\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u043e\u0432. <\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0432 2013 \u0433\u043e\u0434\u0443 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 JSON, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u044b\u043b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u043a\u0430\u043a <a href=\"https:\/\/www.ecma-international.org\/publications\/files\/ECMA-ST-ARCH\/ECMA-404%201st%20edition%20October%202013.pdf\">ECMA-404<\/a>, \u0430 \u043f\u043e\u0437\u0434\u043d\u0435\u0435 \u0432 2017 \u0433\u043e\u0434\u0443 \u043a\u0430\u043a <a href=\"https:\/\/tools.ietf.org\/html\/rfc8259\">RFC 8259<\/a> \u0438 <a href=\"https:\/\/www.iso.org\/standard\/71616.html\">ISO\/IEC 21778:2017<\/a>. \u041d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f JSON \u043f\u043e\u0432\u0441\u0435\u043c\u0435\u0441\u0442\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0432 REST API \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0441\u0435\u0433\u043e, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0434\u0430\u043d\u043d\u044b\u0445 <a href=\"https:\/\/www.infoworld.com\/article\/3222851\/what-is-json-a-better-format-for-data-exchange.html\">\u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438<\/a> \u0434\u043e \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0435\u0442\u0430\u0446\u0438\u0438 \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 <a href=\"https:\/\/oasis-open.github.io\/cti-documentation\/stix\/gettingstarted.html\">STIX2 <\/a>\u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044f <a href=\"https:\/\/cloud.google.com\/appengine\/docs\/admin-api\/creating-config-files\">\u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/a>. <\/p>\n<p>  \u0412\u043e \u0432\u0441\u0435\u0445 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 JSON \u0438 \u0434\u0430\u0436\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u044d\u0442\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0434\u043b\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>jq<\/code>. JSON \u043f\u043e\u0432\u0441\u044e\u0434\u0443. \u0415\u0433\u043e \u043b\u0435\u0433\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0438 \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0431\u044b JSON \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0432 1970 \u0433\u043e\u0434\u0443, \u043a\u043e\u0433\u0434\u0430 \u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u043e\u0434\u0438\u043b\u0441\u044f, \u0442\u043e \u041a\u0435\u043d \u0422\u043e\u043c\u043f\u0441\u043e\u043d \u0438 \u0414\u0435\u043d\u043d\u0438\u0441 \u0420\u0438\u0447\u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0432\u044b\u0432\u043e\u0434\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u043e\u0447\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c \u0432 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0435 \u00ab\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043e\u0434\u043d\u0443 \u0437\u0430\u0434\u0430\u0447\u0443\u00bb.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0432\u044f\u0437\u0438, \u044f \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e, \u0447\u0442\u043e Linux \u0438 \u0432\u0441\u0435 \u0435\u0433\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 GNU \u0438 \u043d\u0435 GNU \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u044b\u0432\u043e\u0434\u0430 JSON. \u041c\u044b \u0443\u0436\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u044d\u0442\u043e\u0433\u043e \u0432 \u0442\u0435\u0445 \u0436\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u0430\u0445 <code>systemctl <\/code>\u0438\u043b\u0438 <code>ip<\/code>, \u0433\u0434\u0435 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u044d\u0442\u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043e\u043f\u0446\u0438\u044e <code>-j<\/code>.<\/p>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u044b Linux \u043f\u043e\u043a\u0430 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0432\u0435\u0440\u0441\u0438\u044e, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u0430 JSON (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, centOS). \u0418 \u0434\u0430\u0436\u0435, \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0435\u0441\u0442\u044c, \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0432\u0441\u0435\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438. <\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0438\u0436\u0435:<\/p>\n<p>  \u0412\u043e\u0442 <code>ip addr<\/code> \u0441 \u0432\u044b\u0432\u043e\u0434\u043e\u043c JSON:<\/p>\n<pre><code class=\"bash\">$ ip -j addr show dev ens33 [{ \"addr_info\": [{},{}] },{ \"ifindex\": 2, \"ifname\": \"ens33\", \"flags\": [\"BROADCAST\",\"MULTICAST\",\"UP\",\"LOWER_UP\"], \"mtu\": 1500, \"qdisc\": \"fq_codel\", \"operstate\": \"UP\", \"group\": \"default\", \"txqlen\": 1000, \"link_type\": \"ether\", \"address\": \"00:0c:29:99:45:17\", \"broadcast\": \"ff:ff:ff:ff:ff:ff\", \"addr_info\": [{ \"family\": \"inet\", \"local\": \"192.168.71.131\", \"prefixlen\": 24, \"broadcast\": \"192.168.71.255\", \"scope\": \"global\", \"dynamic\": true, \"label\": \"ens33\", \"valid_life_time\": 1732, \"preferred_life_time\": 1732 },{ \"family\": \"inet6\", \"local\": \"fe80::20c:29ff:fe99:4517\", \"prefixlen\": 64, \"scope\": \"link\", \"valid_life_time\": 4294967295, \"preferred_life_time\": 4294967295 }] } ]<\/code><\/pre>\n<p>  \u0410 \u0432\u043e\u0442 <code>ip route<\/code>, \u043d\u0435 \u0432\u044b\u0432\u043e\u0434\u044f\u0449\u0438\u0439 JSON, \u0434\u0430\u0436\u0435 \u0441 \u0444\u043b\u0430\u0433\u043e\u043c <code>-j<\/code>:<\/p>\n<pre><code class=\"bash\">$ ip -j route default via 192.168.71.2 dev ens33 proto dhcp src 192.168.71.131 metric 100  192.168.71.0\/24 dev ens33 proto kernel scope link src 192.168.71.131  192.168.71.2 dev ens33 proto dhcp scope link src 192.168.71.131 metric 100<\/code><\/pre>\n<p>  \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u0440\u043e\u0434\u0435 <code>kubectl <\/code>\u0438 <code>aws-cli<\/code> \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0432\u044b\u0432\u043e\u0434\u0430 JSON, \u0443\u043f\u0440\u043e\u0449\u0430\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430.<\/p>\n<p>  \u041d\u043e \u0435\u0441\u0442\u044c \u0438 \u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0432\u044b\u0432\u043e\u0434\u044f\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0434\u043b\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0442\u0435\u043a\u0441\u0442 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>netstat<\/code>, <code>lsblk<\/code>, <code>ifconfig<\/code>, <code>iptables <\/code>\u0438 \u0442.\u0434.).<\/p>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u0432 Windows PowerShell \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e Linux \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0443\u0447\u0438\u0442\u044c\u0441\u044f.<\/p>\n<h2><font color=\"#3AC1EF\">\u041f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044e<\/font><\/h2>\n<p>  \u0420\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043a\u043e \u0432\u0441\u0435\u043c GNU \u0438 \u043d\u0435-GNU \u043b\u0435\u0433\u0430\u0441\u0438-\u0443\u0442\u0438\u043b\u0438\u0442\u0430\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0432\u044b\u0432\u043e\u0434\u044f\u0449\u0438\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043d\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u044b\u0432\u043e\u0434\u0430 JSON. \u0412\u0441\u0435 API \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <code>\/proc<\/code> \u0438 <code>\/sys<\/code>, \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0444\u0430\u0439\u043b\u044b \u0432 JSON \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u043c\u0443 API, \u0432\u044b\u0432\u043e\u0434\u044f\u0449\u0435\u043c\u0443 \u0438\u0445 \u0432 \u044d\u0442\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/_b\/gj\/ap\/_bgjap__bc0v7wbfcg8_kyozrj0.png\" data-src=\"https:\/\/habrastorage.org\/webt\/_b\/gj\/ap\/_bgjap__bc0v7wbfcg8_kyozrj0.png\"\/><\/div>\n<p>  <i><font color=\"#999999\"><a href=\"https:\/\/github.com\/kellyjonbrazil\/jc\">github.com\/kellyjonbrazil\/jc<\/a><\/font><\/i><\/p>\n<p>  \u0422\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <code><a href=\"https:\/\/github.com\/kellyjonbrazil\/jc\">jc<\/a><\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0432\u044b\u0432\u043e\u0434 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u043a\u0430\u043a GNU, \u0442\u0430\u043a \u0438 \u043d\u0435 GNU \u043a\u043e\u043c\u0430\u043d\u0434, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 JSON. <\/p>\n<p>  \u041e\u043d \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0435\u0440 \u0434\u043b\u044f \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0445 \u0443\u0442\u0438\u043b\u0438\u0442 \u0438 \u0444\u0430\u0439\u043b\u043e\u0432, \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0443\u043b\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435. <\/p>\n<blockquote><p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0435\u0433\u043e <a href=\"https:\/\/jc-web-demo.herokuapp.com\/\">\u043e\u043d\u043b\u0430\u0439\u043d \u0434\u0435\u043c\u043e\u0432\u0435\u0440\u0441\u0438\u044e<\/a>.<\/p><\/blockquote>\n<p>  <\/p>\n<blockquote><p>\u042d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435, <a href=\"https:\/\/blog.kellybrazil.com\/2020\/08\/30\/parsing-command-output-in-ansible-with-jc\/\">\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u0430-\u0444\u0438\u043b\u044c\u0442\u0440\u0430<\/a> \u0434\u043b\u044f Ansible.  <\/p><\/blockquote>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">JC \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438<\/font><\/h2>\n<p>  \u041d\u0438\u0436\u0435 \u044f \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e, \u043a\u0430\u043a <code>jc <\/code>\u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043d\u0430\u043c \u0436\u0438\u0437\u043d\u044c, \u043f\u043e\u043a\u0430 GNU\/Linux \u043d\u0435 \u043f\u0440\u0438\u0432\u043d\u0435\u0441\u0443\u0442 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u044e Unix \u0432 \u0440\u0435\u0430\u043b\u0438\u0438 21 \u0432\u0435\u043a\u0430. \u0412\u043e\u0437\u044c\u043c\u0435\u043c \u0442\u043e\u0442 \u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c IP-\u0430\u0434\u0440\u0435\u0441\u0430 \u0438\u0437 \u0441\u0435\u0442\u0438 Ethernet:<\/p>\n<pre><code class=\"bash\">$ ifconfig ens33 | grep inet | awk '{print $2}' | cut -d\/ -f1 | head -n 1 192.168.71.138<\/code><\/pre>\n<p>  \u0410 \u0432\u043e\u0442, \u043a\u0430\u043a \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>jc <\/code>\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0432\u0440\u043e\u0434\u0435 <code>jq<\/code>:<\/p>\n<pre><code class=\"bash\">$ ifconfig ens33 | jc --ifconfig | jq -r '.[].ipv4_addr' 192.168.71.138<\/code><\/pre>\n<p>  \u041b\u0438\u0431\u043e: <\/p>\n<pre><code class=\"bash\">$ jc ifconfig ens33 | jq -r '.[].ipv4_addr' 192.168.71.138<\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0445 TCP-\u043f\u043e\u0440\u0442\u043e\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u044b:<\/p>\n<pre><code class=\"bash\">$ netstat -tln | tr -s ' ' | cut -d ' ' -f 4 | rev | cut -d : -f 1 | rev | tail -n +3 25 22<\/code><\/pre>\n<p>  \u041e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0440\u0442\u043e\u0432. \u0412\u043e\u0442 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <code>jc <\/code>\u0438 <code>jq<\/code>:<\/p>\n<pre><code class=\"bash\">$ netstat -tln | jc --netstat | jq '.[].local_port_num' 25 22<\/code><\/pre>\n<p>  \u041b\u0438\u0431\u043e:<\/p>\n<pre><code class=\"bash\">$ jc netstat -tln | jq '.[].local_port_num' 25 22<\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u044b \u043f\u043e\u0438\u0441\u043a \u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u0438-\u0443\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430. <\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b\u0432\u043e\u0434 JSON \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043b\u044e\u0431\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0432\u0440\u043e\u0434\u0435 Python \u0438\u043b\u0438 JavaScript \u0431\u0435\u0437 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u042d\u0442\u043e \u043d\u0430\u0448\u0435 \u0431\u0443\u0434\u0443\u0449\u0435\u0435, \u0434\u0440\u0443\u0437\u044c\u044f! <\/p>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 <code>jc <\/code>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0441\u0435\u0440\u044b: <code>arp<\/code>, <code>df<\/code>, <code>dig<\/code>, <code>env<\/code>, <code>free<\/code>, <code>\/etc\/fstab<\/code>, <code>history<\/code>, <code>\/etc\/hosts<\/code>, <code>ifconfig<\/code>, <code>iptables<\/code>, <code>jobs<\/code>, <code>ls<\/code>, <code>lsblk<\/code>, <code>lsmod<\/code>, <code>lsof<\/code>, <code>mount<\/code>, <code>netstat<\/code>, <code>ps<\/code>, <code>route<\/code>, <code>ss<\/code>, <code>stat<\/code>, <code>systemctl<\/code>, <code>systemctl list-jobs<\/code>, <code>systemctl list-sockets<\/code>, <code>systemctl list-unit-files<\/code>, <code>uname -a<\/code>, <code>uptime<\/code> \u0438 <code>w<\/code>.<\/p>\n<blockquote><p>\u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u0432 <code>jc <\/code> \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 <a href=\"https:\/\/github.com\/kellyjonbrazil\/jc#parsers\">\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0438 \u0442\u0438\u043f\u043e\u0432 \u0444\u0430\u0439\u043b\u043e\u0432<\/a>.  <\/p><\/blockquote>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043f\u043e\u0436\u0435\u043b\u0430\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438\u043b\u0438 \u0442\u0438\u043f\u0430 \u0444\u0430\u0439\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 <code>jc <\/code>\u0435\u0449\u0435 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442, \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 (<a href=\"https:\/\/blog.kellybrazil.com\/2019\/11\/26\/bringing-the-unix-philosophy-to-the-21st-century\/\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/a>), \u0430 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0440\u0435\u0448\u0438\u0442\u044c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043f\u0430\u0440\u0441\u0435\u0440\u043e\u043c, \u0442\u043e \u0442\u043e\u0436\u0435 \u0441\u043c\u0435\u043b\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0439\u0442\u0435\u0441\u044c.<\/p>\n<p>  <a href=\"http:\/\/ruvds.com\/ru-rub?utm_source=habr&amp;utm_medium=article&amp;utm_campaign=perevod&amp;utm_content=perenosim_filosofiyu_unix_v_21_vek\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ou\/g5\/kh\/oug5kh6sjydt9llengsiebnp40w.png\" data-src=\"https:\/\/habrastorage.org\/webt\/ou\/g5\/kh\/oug5kh6sjydt9llengsiebnp40w.png\"\/><\/a><\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/574778\/\"> https:\/\/habr.com\/ru\/articles\/574778\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/574778\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/_b\/gj\/ap\/_bgjap__bc0v7wbfcg8_kyozrj0.png\" data-src=\"https:\/\/habrastorage.org\/webt\/_b\/gj\/ap\/_bgjap__bc0v7wbfcg8_kyozrj0.png\"\/><\/div>\n<p><\/a><br \/>  \u041e\u0434\u0438\u043d \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u0438 Unix \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u0443 \u0437\u0430\u0434\u0430\u0447\u0443, \u0438 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0432 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440. \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0437\u0430\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b \u0441\u0435\u0431\u044f \u0437\u0430 \u0434\u0435\u0441\u044f\u0442\u0438\u043b\u0435\u0442\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b. <\/p>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0436\u0435 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0442\u043e\u043c, \u0447\u0435\u0433\u043e \u043e\u0449\u0443\u0442\u0438\u043c\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c Linux \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u044d\u0442\u0438\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-398307","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/398307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=398307"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/398307\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=398307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=398307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=398307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}