Mac - PHP - MYSQL - ( )


  PHP (um acrônimo recursivo para "PHP: Hypertext Preprocessor", originalmente Personal
  Home Page)   é uma linguagem interpretada livre, usada originalmente apenas para o
  desenvolvimento de aplicações presentes e atuantes no lado do servidor, capazes de
  gerar conteúdo dinâmico na World Wide Web.

* Página melhor visualizada no " navegador Chrome "



PHP no Mac

Abra um terminal no Mac - Open a terminal on Mac: Digite as 3 linhas abaixo - Type the 3 lines below: php -a ( enter ) echo "Hi there"; ( enter ) quit ( enter ) ------------------- php -a Interactive shell php > echo "Hi there"; Hi there php > php > quit sudo apachectl start ------------------- Turning on PHP Open Terminal and type  sudo nano /etc/apache2/httpd.conf  ctrl + w which will bring up a search Search for php and press enter remove # to uncomment the line below. LoadModule php7_module libexec/apache2/libphp7.so Ctrl + w which will bring up a search Search for authz_core_module and press enter remove # to uncomment the line below. LoadModule authz_core_module libexec/apache2/mod_authz_core.so ctrl + x + y ( save file and exit nano ) ------------------- Restarting apache. sudo apachectl restart You just turned PHP 7 on. Great work so far! ------------------- Let's test it... http://127.0.0.1/ ------------------- php -v PHP 7.1.19 (cli) (built: Aug 17 2018 20:10:18) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies ------------------- httpd -v Server version: Apache/2.4.34 (Unix) Server built: Aug 17 2018 18:35:43 ------------------- Let’s create the folder below to keep our php files. mkdir my_php_stuff ------------------- Let’s create the index.php file and add 4 lines below: nano my_php_stuff/index.php ctrl + x + y ( save and exit file ) ------------------- My Mac user name.................: juraa.p. ( Mac user name ) Folder where I keep my php stuff.: my_php_stuff ( folder ) ----- DocumentRoot "/users/juraa.p./my_php_stuff" < Directory "/users/juraa.p./my_php_stuff" > ------------------- Let's make the changes. sudo nano /etc/apache2/httpd.conf Press ctrl + w to bring up search Search for Library and press enter. You should see this: ctrl + x + y ( save file and exit nano ) ------------------- Restart apache. sudo apachectl restart ------------------- Go back to Safari and refresh the localhost. http://127.0.0.1/ ------------------- tail -f /var/log/apache2/access_log

127.0.0.1 - - [18/Jan/2019:15:47:58 -0200] "-" 408 - 127.0.0.1 - - [18/Jan/2019:15:48:24 -0200] "GET / HTTP/1.1" 500 - 127.0.0.1 - - [18/Jan/2019:15:48:25 -0200] "GET / HTTP/1.1" 500 - 127.0.0.1 - - [18/Jan/2019:15:48:45 -0200] "-" 408 - 127.0.0.1 - - [18/Jan/2019:15:48:45 -0200] "-" 408 - 127.0.0.1 - - [18/Jan/2019:15:51:34 -0200] "-" 408 - 127.0.0.1 - - [18/Jan/2019:15:51:35 -0200] "-" 408 - 127.0.0.1 - - [18/Jan/2019:15:53:25 -0200] "GET / HTTP/1.1" 200 95704 127.0.0.1 - - [18/Jan/2019:15:53:25 -0200] "GET /favicon.ico HTTP/1.1" 404 209 127.0.0.1 - - [18/Jan/2019:15:53:45 -0200] "-" 408 -

------------------- tail /var/log/system.log

Jan 18 15:51:31 MacBook-Pro-de-Jura suhelperd[547]: objc[547]: Class KeychainMasterHandler is implemented in both /usr/lib/libIASAuthReboot.dylib (0x7fffa6ef0110) and /System/Library/CoreServices/Software Update.app/Contents/Resources/suhelperd (0x102bca810). One of the two will be used. Which one is undefined. Jan 18 15:51:37 MacBook-Pro-de-Jura EmojiFunctionRowIM_Extension[440]: DEPRECATED USE in libdispatch client: dispatch source activated with no event handler set; set a breakpoint on _dispatch_bug_deprecated to debug Jan 18 15:51:54 MacBook-Pro-de-Jura loginwindow[98]: There are still active callers Jan 18 15:52:10 --- last message repeated 3 times --- Jan 18 15:52:10 MacBook-Pro-de-Jura com.apple.xpc.launchd[1] (com.apple.imfoundation.IMRemoteURLConnectionAgent): Unknown key for integer: _DirtyJetsamMemoryLimit Jan 18 15:52:56 --- last message repeated 1 time --- Jan 18 15:53:42 MacBook-Pro-de-Jura screencaptureui[589]: DEPRECATED USE in libdispatch client: dispatch source activated with no event handler set; set a breakpoint on _dispatch_bug_deprecated to debug

------------------- tail /var/log/apache2/error_log

[Fri Jan 18 15:48:20.980278 2019] [mpm_prefork:notice] [pid 10212] AH00163: Apache/2.4.34 (Unix) PHP/7.1.19 configured -- resuming normal operations [Fri Jan 18 15:48:20.980433 2019] [core:notice] [pid 10212] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' [Fri Jan 18 15:48:24.937849 2019] [php7:emerg] [pid 10216] [client 127.0.0.1:60834] PHP Parse error: syntax error, unexpected 'PHP' (T_STRING), expecting ',' or ';' in /users/juraa.p./my_php_stuff/index.php on line 2 [Fri Jan 18 15:48:25.777662 2019] [php7:emerg] [pid 10216] [client 127.0.0.1:60835] PHP Parse error: syntax error, unexpected 'PHP' (T_STRING), expecting ',' or ';' in /users/juraa.p./my_php_stuff/index.php on line 2 [Fri Jan 18 15:50:22.056005 2019] [mpm_prefork:notice] [pid 10212] AH00169: caught SIGTERM, shutting down


nmap


Installing nmap on my Mac. curl -O https://nmap.org/dist/nmap-7.70.dmg ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install nmap ------------------- sudo nmap -sS localhost | grep http Starting Nmap 7.70 ( https://nmap.org ) at 2019-01-18 16:00 -02 80/tcp open http

Example


Example using PHP + CSS + JavaScript nano my_php_stuff/example1.php
<html>

<head>

<STYLE TYPE="text/css">

 .html1 {
        background-color: black;
        text-align: left;
        color: white;
        width: 240px;
        font: bold 15pt Verdana;
        }

 .css1 {
        background-color: #004080;
        text-align: left;
      color: white;
        width: 240px;
      font: bold 15pt Verdana;
      }

 .css2 {
        background-color: green;
        text-align: left;
        color: white;
        width: 240px;
        font: bold 15pt Verdana;
        }

 .css3 {
        background-color: yellow;
        text-align: left;
        color: red;
        width: 240px;
        font: bold 15pt Verdana;
        }

 .big {
        font: bold 15pt Verdana;
        }


</STYLE>

<!-- ---------------------------- -->

<SCRIPT LANGUAGE="JavaScript">

var now = new Date();

var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();

function fourdigits(number)     {
        return (number < 1000) ? number + 1900 : number;
                                                                }
today =  days[now.getDay()] + ", " +
         months[now.getMonth()] + " " +
         date + ", " +
         (fourdigits(now.getYear())) ;

</script>

<!-- ---------------------------- -->


<title> PHP - CSS - JavaScript </title>

</head>

<body>

<h1>This line is <span class='html1'> HTML </span> </h1>

<p class="css1"> This line is <span class='css1'> CSS </span> </p>

<script>
  document.write("<span class='big'> Below line is JavaScript </span> <span class='big'> -
Weekday - Month - Day - Year </span>");
  document.write("<br><br> <span class='css2'> JavaScript e CSS </span> <br>");
  document.write(today);
</script>

<br><br><br>

<?php
  echo "This line is <span class=\"css3\"> PHP + JavaScript + CSS </span> <br><br>";

  $x = "PHP 1 <br>";
  $y = 'PHP 2 <br><br>';
  echo $x;
  echo "<br>";
  echo $y;
  echo "<br>";
  echo "<br>";

  date_default_timezone_set('America/Sao_Paulo');
  $date = date('m-d-Y H:i');
  echo "<span class='css3'>".$date."</span>";
?>

</body>

</html>
ctrl + x + y ( save file and exit nano ) ------------------- http://127.0.0.1/example1.php Download example1

MySql


MySQL is an Oracle-backed open source relational database management system (RDBMS) based on Structured Query Language (SQL). MySQL runs on virtually all platforms, including Linux, UNIX and Windows. Although it can be used in a wide range of applications, MySQL is most often associated with web applications and online publishing. MySQL is an important component of an open source enterprise stack called LAMP. LAMP is a web development platform that uses Linux as the operating system, Apache as the web server, MySQL as the relational database management system and PHP as the object-oriented scripting language. (Sometimes Perl or Python is used instead of PHP.) Installing MySQL Go to Click here to download mysql Scroll down until you see three download buttons and click on the one next to DMG Archive Scroll down and click No thanks, just start my download Click on the downloaded file, double click the pkg file, and go through the installation which should look like this: Go to System Preferences, at the bottom of the page double click on mysql If it is green it’s mysql it’s already running.. ------------------- Check mysql running process. ps aux | grep mysql _mysql 11319 0.1 2.4 4935152 402636 ?? Ss 5:50PM 0:04.23 /usr/local/mysql/bin/mysqld juraa.p. 11621 0.0 0.0 4268036 796 s000 S+ 6:04PM 0:00.00 grep mysql ------------------- sudo /usr/local/mysql/bin/mysql -u root -p my mac pass mysql pass Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 51 Server version: 5.5.40-0+wheezy1 (Debian) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +-------------------------+ | Database | +-------------------------+ | information_schema | | mysql | | performance_schema | +-------------------------+ 4 rows in set (0.00 sec) mysql> create database banco_dados; mysql> use banco_dados; Vamos criar a tabela amigos: mysql> create table amigos( codigo integer not null, nome varchar(50) not null, endereco varchar(60), cidade varchar(40), datanasc date, primary key(codigo)); Para inserir registros digite as linhas abaixo: insert into amigos values(1,'Jurandir','Rua Londres 13','Timbo','2011-1-1'); insert into amigos values(2,'Mike','Rua USA 131','Timbo','2018-11-1'); insert into amigos values(3,'Eric','Rua Italia 131','Blumenau','2017-4-1'); insert into amigos values(4,'Isa','Rua China 131','Blumenau','2018-8-1'); insert into amigos values(5,'Luisa','Rua Germany 131','Blumenau','2013-12-1'); mysql> show databases; +------------------------+ | Database | +------------------------+ | information_schema | | banco_dados | | mysql | | performance_schema | +------------------------+ mysql> use banco_dados; mysql> describe amigos; +-----------+---------------+--------+------+----------+---------+ | Field | Type | Null | Key | Default | Extra | +-----------+---------------+--------+------+----------+---------+ | codigo | int(11) | NO | PRI | NULL | | | nome | varchar(50) | NO | | NULL | | | endereco | varchar(60) | YES | | NULL | | | cidade | varchar(40) | YES | | NULL | | | datanasc | date | YES | | NULL | | +-----------+---------------+--------+------+----------+---------+ mysql> SELECT * FROM amigos; +--------+----------+-----------------+----------+------------+ | codigo | nome | endereco | cidade | datanasc | +--------+----------+-----------------+----------+------------+ | 1 | Jurandir | Rua Londres 13 | Timbo | 2011-01-01 | | 2 | Mike | Rua USA 131 | Timbo | 2018-11-01 | | 3 | Eric | Rua Italia 131 | Blumenau | 2017-04-01 | | 4 | Isa | Rua China 131 | Blumenau | 2018-08-01 | | 5 | Luisa | Rua Germany 131 | Blumenau | 2013-12-01 | +--------+----------+-----------------+----------+------------+ 5 rows in set (0.00 sec) mysql> SELECT * FROM amigos WHERE nome LIKE "mi%"; +--------+------+-------------+--------+------------+ | codigo | nome | endereco | cidade | datanasc | +--------+------+-------------+--------+------------+ | 2 | Mike | Rua USA 131 | Timbo | 2018-11-01 | +--------+------+-------------+--------+------------+ 1 row in set (0.00 sec) mysql> SELECT * FROM amigos WHERE cidade = "Blumenau"; +--------+-------+-----------------+----------+------------+ | codigo | nome | endereco | cidade | datanasc | +--------+-------+-----------------+----------+------------+ | 3 | Eric | Rua Italia 131 | Blumenau | 2017-04-01 | | 4 | Isa | Rua China 131 | Blumenau | 2018-08-01 | | 5 | Luisa | Rua Germany 131 | Blumenau | 2013-12-01 | +--------+-------+-----------------+----------+------------+ 3 rows in set (0.00 sec) mysql> SELECT * FROM amigos WHERE codigo BETWEEN 1 and 2; +--------+----------+----------------+--------+------------+ | codigo | nome | endereco | cidade | datanasc | +--------+----------+----------------+--------+------------+ | 1 | Jurandir | Rua Londres 13 | Timbo | 2011-01-01 | | 2 | Mike | Rua USA 131 | Timbo | 2018-11-01 | +--------+----------+----------------+--------+------------+ 2 rows in set (0.01 sec) mysql> UPDATE amigos SET datanasc='19671225' WHERE codigo=1; Query OK, 1 row affected (0.04 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> SELECT * FROM amigos; +--------+----------+-----------------+----------+------------+ | codigo | nome | endereco | cidade | datanasc | +--------+----------+-----------------+----------+------------+ | 1 | Jurandir | Rua Londres 13 | Timbo | 1967-12-25 | | 2 | Mike | Rua USA 131 | Timbo | 2018-11-01 | | 3 | Eric | Rua Italia 131 | Blumenau | 2017-04-01 | | 4 | Isa | Rua China 131 | Blumenau | 2018-08-01 | | 5 | Luisa | Rua Germany 131 | Blumenau | 2013-12-01 | +--------+----------+-----------------+----------+------------+ 5 rows in set (0.00 sec) mysql> mysql> show variables like '%socket%'; +-----------------------------------------+------------------+ | Variable_name | Value | +-----------------------------------------+------------------+ | mysqlx_socket | /tmp/mysqlx.sock | | performance_schema_max_socket_classes | 10 | | performance_schema_max_socket_instances | -1 | | socket | /tmp/mysql.sock | +-----------------------------------------+------------------+ 4 rows in set (0.01 sec) mysql> show variables like "%version%"; +--------------------------+------------------------------+ | Variable_name | Value | +--------------------------+------------------------------+ | immediate_server_version | 999999 | | innodb_version | 8.0.14 | | original_server_version | 999999 | | protocol_version | 10 | | slave_type_conversions | | | tls_version | TLSv1,TLSv1.1,TLSv1.2 | | version | 8.0.14 | | version_comment | MySQL Community Server - GPL | | version_compile_machine | x86_64 | | version_compile_os | macos10.14 | | version_compile_zlib | 1.2.11 | +--------------------------+------------------------------+ 11 rows in set (0.00 sec) mysql> quit ( sair do mysql ) ------------------- ps axww | grep mysqld 97 ?? Ss 0:55.10 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid --keyring-file-data=/usr/local/mysql/keyring/keyring --early-plugin-load=keyring_file=keyring_file.so 2646 s000 S+ 0:00.00 grep mysqld ------------------- apachectl configtest AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using MacBook-Pro-de-Jura.local. Set the 'ServerName' directive globally to suppress this message Syntax OK ------------------- Removendo banco de dados. drop database banco_dados; ------------------- Removendo tabela. drop table amigos; ------------------- Stopping / starting and restarting mysql server. sudo /usr/local/mysql/support-files/mysql.server stop sudo /usr/local/mysql/support-files/mysql.server start sudo /usr/local/mysql/support-files/mysql.server restart ------------------- Killing the mysql process. ps aux | grep mysql

_mysql 2739 0.3 2.4 4907988 395536 s000 S 9:29PM 0:01.73 /usr/local/mysql/bin/mysqld root 2655 0.0 0.0 4271688 1348 s000 S 9:29PM 0:00.02 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data juraa.p. 2784 0.0 0.0 4268036 796 s000 S+ 9:32PM 0:00.00 grep mysql

sudo kill -9 2655 ps aux | grep mysql _mysql 2739 0.3 2.4 4907988 395536 s000 S 9:29PM 0:01.95 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data sudo kill -9 2739 ps aux | grep mysql juraa.p. 2795 0.0 0.0 4268036 796 s000 S+ 9:33PM 0:00.00 grep mysql ------------------- Restart apache. sudo apachectl restart ------------------- httpd -t -D DUMP_INCLUDES

Included configuration files: (*) /private/etc/apache2/httpd.conf (539) /private/etc/apache2/extra/httpd-mpm.conf (545) /private/etc/apache2/extra/httpd-autoindex.conf (585) /private/etc/apache2/other/php7.conf AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using MacBook-Pro-de-Jura.local. Set the 'ServerName' directive globally to suppress this message

------------------- ps -aef | grep httpd 0 12792 1 0 9:33PM ?? 0:00.26 /usr/sbin/httpd -D FOREGROUND 70 12796 12792 0 9:33PM ?? 0:00.01 /usr/sbin/httpd -D FOREGROUND 70 12798 12792 0 9:33PM ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND 70 12802 12792 0 9:33PM ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND 501 12854 11282 0 9:40PM ttys000 0:00.00 grep httpd ------------------- netstat -at | grep LISTEN | grep *.http tcp46 0 0 *.http *.* LISTEN ------------------- sudo lsof -iTCP -sTCP:LISTEN -P -n | grep mysql

mysqld 97 _mysql 28u IPv6 0xaf66da76719c6609 0t0 TCP *:3306 (LISTEN) mysqld 97 _mysql 31u IPv6 0xaf66da76719c6bc9 0t0 TCP *:33060 (LISTEN)

------------------- sudo lsof -PiTCP -sTCP:LISTEN

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME core 47 root 12u IPv4 0xaf66da7671e06749 0t0 TCP localhost:30900 (LISTEN) core 47 root 14u IPv4 0xaf66da7671e07a49 0t0 TCP localhost:30800 (LISTEN) mysqld 97 _mysql 28u IPv6 0xaf66da76719c6609 0t0 TCP *:3306 (LISTEN) mysqld 97 _mysql 31u IPv6 0xaf66da76719c6bc9 0t0 TCP *:33060 (LISTEN) xartstora 220 root 3u IPv4 0xaf66da7671e070c9 0t0 TCP *:61500 (LISTEN) xartstora 220 root 4u IPv6 0xaf66da76719c7749 0t0 TCP *:61500 (LISTEN) rapportd 336 juraa.p. 3u IPv4 0xaf66da7680a8f749 0t0 TCP *:53119 (LISTEN) rapportd 336 juraa.p. 4u IPv6 0xaf66da7680e0fd09 0t0 TCP *:53119 (LISTEN) httpd 1652 root 4u IPv6 0xaf66da7680e0e609 0t0 TCP *:80 (LISTEN) httpd 1656 _www 4u IPv6 0xaf66da7680e0e609 0t0 TCP *:80 (LISTEN) httpd 1658 _www 4u IPv6 0xaf66da7680e0e609 0t0 TCP *:80 (LISTEN) httpd 1660 _www 4u IPv6 0xaf66da7680e0e609 0t0 TCP *:80 (LISTEN) httpd 1661 _www 4u IPv6 0xaf66da7680e0e609 0t0 TCP *:80 (LISTEN)

------------------- sudo lsof -iTCP -sTCP:LISTEN -P -n

Password: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME core 47 root 12u IPv4 0xaf66da7671e06749 0t0 TCP 127.0.0.1:30900 (LISTEN) core 47 root 14u IPv4 0xaf66da7671e07a49 0t0 TCP 127.0.0.1:30800 (LISTEN) mysqld 97 _mysql 28u IPv6 0xaf66da76719c6609 0t0 TCP *:3306 (LISTEN) mysqld 97 _mysql 31u IPv6 0xaf66da76719c6bc9 0t0 TCP *:33060 (LISTEN) xartstora 220 root 3u IPv4 0xaf66da7671e070c9 0t0 TCP *:61500 (LISTEN) xartstora 220 root 4u IPv6 0xaf66da76719c7749 0t0 TCP *:61500 (LISTEN) rapportd 336 juraa.p. 3u IPv4 0xaf66da7680a8f749 0t0 TCP *:53119 (LISTEN) rapportd 336 juraa.p. 4u IPv6 0xaf66da7680e0fd09 0t0 TCP *:53119 (LISTEN) httpd 1652 root 4u IPv6 0xaf66da7680e0e609 0t0 TCP *:80 (LISTEN) httpd 1656 _www 4u IPv6 0xaf66da7680e0e609 0t0 TCP *:80 (LISTEN) httpd 1658 _www 4u IPv6 0xaf66da7680e0e609 0t0 TCP *:80 (LISTEN) httpd 1660 _www 4u IPv6 0xaf66da7680e0e609 0t0 TCP *:80 (LISTEN) httpd 1661 _www 4u IPv6 0xaf66da7680e0e609 0t0 TCP *:80 (LISTEN)

------------------- Checking log files. tail /private/var/log/apache2/access_log tail /var/log/apache2/error_log tail /private/var/log/system.log -------------------

netstat -an | awk '$1 ~ /[Tt][Cc][Pp]/ && $NF ~ /ESTABLISHED/{i++}END{print "Connected:\t", i}'

Connected: 30 ------------------- netstat | awk '/EST/{print $5}' | sort 17.188.150.176.5223 17.188.166.17.5223 172.217.192.155.https 192.168.10.100.61448 9d.45.37a9.ip4.s.https cache.google.com.https cb-in-f188.1e100.5228 ec2-52-2-186-223.https ec2-52-4-104-97..https edge-star-shv-02.https edge-star-shv-02.https eze03s05-in-f238.https fe80::aede:48ff:.52032 fe80::aede:48ff:.61000 gru06s30-in-f14..https gru06s34-in-f14..https gru06s34-in-f3.1.https gru06s34-in-f3.1.https gru10s10-in-f14..https pop3.tpa.com.br.imap ------------------- This is a nice code I found over the internet :) I broke up the command line below to be better viewed. Please, make it one line when you run it. netstat -Watnlv | grep LISTEN | awk '{"ps -o comm= -p " $9 | getline procname;colred="\033[01;31m";colclr="\033[0m"; print colred "proto: " colclr $1 colred " | addr.port: " colclr $4 colred " | pid: " colclr $9 colred " | name: " colclr procname; }' | column -t -s "|" ------------------- I broke up the command line below to be better viewed. Please, make it one line when you run it. netstat -an | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | awk '{ printf("%s\t%s\t",$2,$1) ; for (i = 0; i < $1; i++) {printf("*")}; print "" }' 104.19.196.151.443 1 * 104.244.42.200.443 1 * 157.240.12.13.443 1 * 157.240.12.35.443 1 * 157.240.12.53.443 1 * 17.188.151.44.5223 1 * 17.188.166.21.5223 1 * 17.248.184.50.443 2 ** 172.217.162.98.443 1 * 172.217.28.142.443 1 * 172.217.28.238.443 1 * 172.217.29.1.443 1 * 172.217.29.227.443 2 ** 172.217.30.110.443 1 * 172.217.30.78.443 1 * 189.45.192.51.143 1 * 189.45.193.145.443 1 * 192.0.73.2.443 1 * 192.168.10.100.61342 1 * 209.197.3.15.443 2 ** 216.58.202.131.443 1 * 216.58.202.234.443 1 * 216.58.202.68.443 2 ** 216.58.202.74.443 1 * 216.58.222.106.443 1 * 216.58.222.67.443 1 * 52.2.186.223.443 1 * 52.20.134.37.443 2 ** 64.233.190.156.443 1 * 64.233.190.188.5228 1 * fe80 2 ** ------------------- netstat -ant | awk '{print $NF}' | grep -v '[a-z]' | sort | uniq -c 46 *.* 147 0 14 1 1 11 2 2 1 3 1 7 1 CLOSED 13 ESTABLISHED 9 LISTEN 1 TIME_WAIT ------------------- I broke up the command line below to be better viewed. Please, make it one line when you run it.

netstat -ntu | awk ' $5 ~ /^(::ffff:|[0-9|])/ { gsub("::ffff:","",$5); print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr

242 0 1 634cfe11935144cf 1 634cfe11935141e7 1 634cfe118f5027b7 1 634cfe118f4b992f 1 634cfe118f4b973f 1 634cfe118bad8c8f 1 634cfe118b8f40ef 1 634cfe118ae4e8af 1 634cfe118a4f63d7 1 634cfe11896db44f 1 634cfe11896da3d7 1 634cfe11896da2df 1 634cfe11896da1e7 1 634cfe11896d9837 1 634cfe11896ca167 1 634cfe11896c8a27 1 634cfe11896c8837 1 634cfe118969663f 1 634cfe1189696357 1 634cfe11896956bf 1 634cfe11896835c7 1 634cfe1189682eff 1 634cfe118965e44f 1 634cfe118964f0ef 1 634cfe11892c692f ------------------- Deleting log files. I want to delete wifi files. cd /var/log sudo ls -lh wifi.log.* Password: -rw-r----- 1 root admin 33K Jan 12 00:30 wifi.log.0.bz2 -rw-r----- 1 root admin 9.8K Jan 8 00:03 wifi.log.1.bz2 -rw-r----- 1 root admin 30K Nov 23 00:30 wifi.log.10.bz2 -rw-r----- 1 root admin 411B Jan 6 00:30 wifi.log.2.bz2 -rw-r----- 1 root admin 26K Jan 6 00:28 wifi.log.3.bz2 -rw-r----- 1 root admin 50K Dec 26 00:27 wifi.log.4.bz2 -rw-r----- 1 root admin 20K Dec 17 00:10 wifi.log.5.bz2 -rw-r----- 1 root admin 14K Dec 13 00:45 wifi.log.6.bz2 -rw-r----- 1 root admin 4.4K Dec 9 00:01 wifi.log.7.bz2 -rw-r----- 1 root admin 33K Dec 8 00:07 wifi.log.8.bz2 -rw-r----- 1 root admin 30K Dec 1 00:15 wifi.log.9.bz2 ls -lh wifi.log.* -rw-r----- 1 root admin 33K Jan 12 00:30 wifi.log.0.bz2 -rw-r----- 1 root admin 9.8K Jan 8 00:03 wifi.log.1.bz2 -rw-r----- 1 root admin 30K Nov 23 00:30 wifi.log.10.bz2 -rw-r----- 1 root admin 411B Jan 6 00:30 wifi.log.2.bz2 -rw-r----- 1 root admin 26K Jan 6 00:28 wifi.log.3.bz2 -rw-r----- 1 root admin 50K Dec 26 00:27 wifi.log.4.bz2 -rw-r----- 1 root admin 20K Dec 17 00:10 wifi.log.5.bz2 -rw-r----- 1 root admin 14K Dec 13 00:45 wifi.log.6.bz2 -rw-r----- 1 root admin 4.4K Dec 9 00:01 wifi.log.7.bz2 -rw-r----- 1 root admin 33K Dec 8 00:07 wifi.log.8.bz2 -rw-r----- 1 root admin 30K Dec 1 00:15 wifi.log.9.bz2 sudo rm wifi.log.* ------------------- ps aux | awk '{$1} {++P[$1]} END {for(a in P) if (a !="USER") print a,P[a]}' root 110 _usbmuxd 1 _nsurlstoraged 1 _applepay 2 _assetcache 1 juraa.p. 222 _locationd 6 _gamecontrollerd 1 _www 3 _mdnsresponder 1 _cmiodalassistants 1 _hidd 1 _timed 1 _spotlight 3 _appleevents 1 _displaypolicyd 1 _mysql 1 _fpsd 1 _analyticsd 1 _iconservices 1 _captiveagent 1 _windowserver 2 _coreaudiod 3 _networkd 1 _distnote 1 _netbios 1 _ctkd 1 _nsurlsessiond 1 _softwareupdate 1
"Wisdom is like a river, the deeper it is the less noise it makes"

Afim de aprender mais? Fale comigo: linux1.noip@gmail.com