Linux: Difference between revisions

From roonics
Jump to navigation Jump to search
Line 21: Line 21:


Example output:
Example output:
<pre style="color: silver; background: black;">
<pre style="color: silver; background: black;width: 800px">
CentOS Linux release 7.5.1804 (Core)
CentOS Linux release 7.5.1804 (Core)
NAME="CentOS Linux"
NAME="CentOS Linux"

Revision as of 18:29, 12 March 2019

Linux

Useful Commands

Show what is listening on what port

netstat -tulpn | grep LISTEN

Example output:

tcp        0      0 0.0.0.0:5666            0.0.0.0:*               LISTEN      685/nrpe
tcp        0      0 127.0.0.1:199           0.0.0.0:*               LISTEN      958/snmpd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      962/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1179/master
tcp6       0      0 :::5666                 :::*                    LISTEN      685/nrpe
tcp6     129      0 :::2224                 :::*                    LISTEN      663/ruby
tcp6       0      0 :::22                   :::*                    LISTEN      962/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      1179/master

Show what version of Linux is running

cat /etc/*release

Example output:

CentOS Linux release 7.5.1804 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.5.1804 (Core)
CentOS Linux release 7.5.1804 (Core)

Show which directory is consuming how much space

du -h --max-depth=1

Example output:

13M     ./src
268K    ./.unison
20K     ./.ssh
0       ./synctest
0       ./.pki
56M     ./openssl-1.1.0f
4.0K    ./.config
68M     ./.cache
4.0K    ./.local
104M    ./vendor
262M    .