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 *               LISTEN      1145/cupsd
tcp        0      0*               LISTEN      1509/postgres
tcp        0      0         ESTABLISHED 2137/firefox-bin
tcp        0      0        ESTABLISHED 2137/firefox-bin
tcp        1      0        CLOSE_WAIT  1966/clock-applet


-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 at port 10000 in fullscreen mode:

rdesktop -f

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