====== 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 [[https://linux.die.net/man/|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 save live updates to a logfile by redirecting the output. The following example is capturing all SIP request to analyze them later with [[https://www.wireshark.org/|Wireshark]].\\ Syntax:\\ ''tail -f /etc/servicepattern/sipprocessor.log > test.log'' Output:\\ In this example, none.\\ 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@becloudsolutions.com|Lorenzo Cesana]] 2026/04/16 09:07//