Home > Máy tính > Useful Linux commands

Useful Linux commands

1. Check version of your linux box:

cat /etc/issue
uname -a
cat /etc/redhat-release
cat /proc/version

2. Apache uptime:

httpd fullstatus | grep uptime
Server uptime: 4 hours 25 minutes 7 seconds

httpd status

service httpd status

3. MySQL uptime:

mysqladmin version | grep Uptime
Uptime: 1 hour 26 min 5 sec

4. Reboot machine:

shutdown -r +1 “computer is rebooting in 1 minute”

5. View active incoming connections

sudo netstat -natp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1145/cupsd
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      1509/postgres
tcp        0      0 10.0.1.2:39585          74.125.71.95:80         ESTABLISHED 2137/firefox-bin
tcp        0      0 10.0.1.2:43888          69.73.143.41:443        ESTABLISHED 2137/firefox-bin
tcp        1      0 10.0.1.2:36116          60.254.175.57:80        CLOSE_WAIT  1966/clock-applet

where:

-t|–tcp : view TCP connections only

-a, –all, –listening   display all sockets (default: connected)

-p, –programs           display PID/Program name for sockets

-n, –numeric            don’t resolve names

6. Remote desktop to Windows

rdesktop [options] server[:port]

For ex, to create a remote desktop session to computer 10.0.1.3 at port 10000 in fullscreen mode:

rdesktop -f 10.0.1.3:10000

  1. No comments yet.
  1. No trackbacks yet.