User Tools

Site Tools


docs:linux_commands

This is an old revision of the document!


Table of Contents

Linux Commands

Quick summary of useful program in Linux for sysadmin purposes. To get a full description of each one have a look at their man pages, by doing man command


Files

plocate

Powerful file finder on the whole system, run after sudo updatedb. Need to be explicitly installed

Syntax:
plocate test.txt

Output:

/home/admin/test.txt

tree

Print a folder structure. Need to be explicitly installed

Syntax:
tree /home/admin/TreeFolder/

Output:

/home/admin/TreeFolder/
├── SubTreeFolder
│   └── SubTreeFile
└── TreeFile

namei

Follow a pathname until a terminal point is found. Need to be explicitly installed

Syntax:
namei /home/admin/

Output:

f: /home/admin/
 d /
 d home
 d admin

Logs

tail

Print last n rows of a file. Useful to have it printing live updates to a logfile and redirecting the output to analyze it later. The following example is for captirunig a SIP request to analyze it with Wireshark.

Syntax:
tail -f /etc/servicepattern/sipprocessor.log > test.log

Output: The file itself. In this example download the file and open it in Wireshark (or manually).


Networking

netstat

Let you see running program listening on ports. Many more options in the manpage, use it with grep to look for a specific port.

Syntax:
netstat -tulpn

Output:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN      345/systemd-resolve 
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      699/exim4           
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      3247/nginx: master  
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      345/systemd-resolve 
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      3247/nginx: master  
tcp        0      0 127.0.0.54:53           0.0.0.0:*               LISTEN      345/systemd-resolve 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      62083/sshd: /usr/sb 
tcp6       0      0 :::5355                 :::*                    LISTEN      345/systemd-resolve 
tcp6       0      0 :::5000                 :::*                    LISTEN      3905/node /home/adm 
tcp6       0      0 ::1:25                  :::*                    LISTEN      699/exim4           
tcp6       0      0 :::80                   :::*                    LISTEN      3247/nginx: master  
tcp6       0      0 :::22                   :::*                    LISTEN      62083/sshd: /usr/sb 
udp        0      0 127.0.0.54:53           0.0.0.0:*                           345/systemd-resolve 

Syntax:
netstat -tulpn | grep 5000

Output:

tcp6       0      0 :::5000                 :::*                    LISTEN      3905/node /home/adm

Lorenzo Cesana 2026/04/16 09:03

docs/linux_commands.1776330270.txt.gz · Last modified: by sysadm

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki