Skip Navigation

Handy one-liners I actually use daily as a sysadmin

Thought I would share some commands I genuinely use all the time. Not the usual "top 10 linux commands" listicle stuff — these are the ones that have actually saved me time repeatedly.

Find what is eating your disk space (human-readable, sorted):

 bash
    
du -h --max-depth=1 /var | sort -hr | head -20

  

Watch a log file with highlighting for errors:

 bash
    
tail -f /var/log/syslog | grep --color -E "error|warn|fail|$"


  

The |$ trick highlights your keywords while still showing all lines.

Quick port check without installing nmap:

 bash
    
: </dev/tcp/192.168.1.1/22 && echo open || echo closed


  

Pure bash, no extra tools needed.

Find files modified in the last hour (great for debugging):

 bash
    
find /etc -mmin -60 -type f

  

Kill everything on a specific port:

 bash
    
fuser -k 8080/tcp

  

Quick HTTP server from any directory:

 bash
    
python3 -m http.server 8000


  

Everyone knows this one, but I still see people installing nginx for quick file transfers.

Check SSL cert expiry from the command line:

 bash
    
echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null | openssl x509 -noout -dates

  

What are your go-to one-liners? Always looking to add to my toolkit.

Comments

6

Comments

6