▲ 12 r/LinuxTeck+1 crossposts

Quick Linux Tip #45 Question: My Windows files have wrong encoding on Linux. How do I fix them all?

Try: `find . -name '*.txt' -exec sh -c 'iconv -f WINDOWS-1252 -t UTF-8 "$1" -o "$1.utf8" && mv "$1.utf8" "$1"' _ {} \;`

Info: `iconv` converts text encodings (`-f`=from, `-t`=to). Wrapping in `sh -c` enables chaining `iconv` and `mv` per file. The `_` acts as a placeholder for `$0` in the subshell.

Examples: https://www.linuxteck.com/linux-tips/fix-windows-file-encoding-linux/

$ `iconv -f UTF-16 -t UTF-8 windows.txt -o linux.txt` # Convert single file

$ `iconv -l | grep -i utf` # List all supported UTF encodings

$ `dos2unix *.txt` # Fix CRLF line endings only

Note: Always test on a backup copy first! Use `iconv -l` to see all supported charsets. Use `dos2unix` if you only need to fix line endings (CRLF to LF).

Follow r/LinuxTeck for more #LinuxTips click here : https://www.linuxteck.com/linux-tips/

u/Expensive-Rice-2052 — 5 days ago
▲ 23 r/LinuxTeck+1 crossposts

Quick Linux Tip #44 Question: My connections feel unreliable. How do I check for hidden packet loss?

Try: `ss -ti | grep -A3 'ESTAB' | head -20`

Info: `ss -ti` dumps TCP internal metrics. Look for `retrans:X/Y` (X current retransmits, Y total) and `rtt` (round-trip time). Non-zero retransmits signal packet loss or network congestion.

Examples:

$ `ss -ti state established '( dport = :443 )'` # Inspect HTTPS connections

$ `watch -n 1 'ss -s'` # Monitor overall socket summary

$ `netstat -s | grep -i 'retrans\|reset'` # Global TCP retransmission counters

Note: When retransmissions occur, `cwnd` (congestion window) shrinks automatically. Persistent retransmits across multiple endpoints point to network hardware issues rather than application bugs.

https://www.linuxteck.com/linux-tips/linux-tips-check-tcp-packet-loss-ss/

Follow r/LinuxTeck for #LinuxTips click here : https://www.linuxteck.com/linux-tips/

u/Expensive-Rice-2052 — 6 days ago
▲ 61 r/LinuxTeck+1 crossposts

Quick Linux Tip #43 Question: How do I extract config values from between BEGIN and END markers?

Try: `sed -n '/BEGIN CERTIFICATE/,/END CERTIFICATE/p' /etc/ssl/certs/server.crt`

Info: `sed -n` suppresses automatic printing. The pattern `'/START/,/END/p'` prints all lines between two matching delimiters (inclusive).

Examples:

$ `sed -n '/^\[database\]/,/^$/p' config.ini` # Extract section until empty line

$ `awk '/BEGIN/,/END/' file.txt` # Equivalent using awk

$ `sed -n '/ERROR/,+5p' logfile` # Print ERROR line plus next 5 lines

https://www.linuxteck.com/linux-tips/linux-tips-sed-extract-text-between-markers/

Note: Range matching `/X/,/Y/` works line-by-line from first match of X to next match of Y. The `+N` relative line count syntax is a GNU `sed` extension.

Follow u/LinuxTeck for more #LinuxTips click here

u/Expensive-Rice-2052 — 7 days ago
▲ 131 r/LinuxTeck+2 crossposts

Quick Linux Tip #41 Question: How do I find duplicate files even if they have different names?

Try: `find /home/linuxteck -type f -exec md5sum {} + | sort | uniq -w32 -D`

Info: `md5sum` hashes file contents, `sort` groups identical hashes, and `uniq -w32 -D` compares the 32-character hash to output all duplicate files.

Examples:

$ `find . -type f -exec md5sum {} + | sort | uniq -w32 -d` # Show 1 sample per duplicate set

$ `fdupes -r /home/linuxteck` # Dedicated tool (`apt install fdupes`)

$ `rdfind -deleteduplicates true /home/linuxteck` # Auto-delete duplicates safely

Note: For large directories, `fdupes` or `rdfind` are purpose-built and significantly faster. Use `sha256sum` instead of `md5sum` if collision risk is a concern.

Follow r/LinuxTeck for more LinuxTips click here

u/Expensive-Rice-2052 — 8 days ago

At what point does managed hosting become worth paying for instead of managing your own VPS?

Moving from shared hosting to a VPS gives you more control, but it also means handling updates, security, backups, monitoring and troubleshooting yourself.

For those who have used both, where do you draw the line? Do you prefer managing the server yourself, or is managed hosting worth the extra cost?

reddit.com
u/LinuxBook — 1 month ago