Recent posts tagged bash

Fabien B. • 1 day • in Discussions • 2 min read forumDiscussion group7 participants post-cover-36357
  • ai
  • llm
  • architecture
  • discuss
BashSnippets • 3 days • in Articles • 1 min read
The reflex when /etc says no is to put sudo in front. From a script: $ sudo echo "maxconn=200" > /etc/demo.conf pd.sh: line 2: /etc/demo.conf: Permission denied exit=1 $ echo "maxconn=200" | sudo -n tee /etc/demo.conf sudo: a password is required ex...
post-cover-33583
  • bash
  • linux
  • sysadmin
  • devops
BashSnippets • 4 days • in Articles • 1 min read
Five lines whose only job is to refuse a deploy when the token is missing. Run with the token unset: $ cat deploy-guard.sh !/bin/bash if -n $DEPLOYTOKEN ; then echo "token present, deploying" else echo "no token, refusing" >&2; exit 1 fi $ env ...
post-cover-33582
  • bash
  • linux
  • devops
  • shellcheck
BashSnippets • Nov 19 • in Articles • 1 min read
rm -rf "$TARGET/" looks correct. The quotes are right and the glob sits outside them, where it has to. I put it in a two-line script in a scratch directory and asked what happens when TARGET is empty, with echo in front so rm never ran: the command l...
post-cover-29100
  • bash
  • linux
  • shellcheck
  • devops
BashSnippets • Nov 18 • in Articles • 1 min read
A four-line cleanup script, cd /srv/drop, rm .log, echo "cleanup done", run on a scratch tmpfs. At 80,290 files it emptied the directory. At 80,291: $ /srv/cleanup.sh /srv/cleanup.sh: line 4: /usr/bin/rm: Argument list too long cleanup done exit=0 $...
post-cover-30659
  • bash
  • linux
  • sysadmin
  • devops
inevolin • Nov 18 • in Articles • 6 min read
!Claude Code, Sonnet 5.5, runs the tests of 54 repos and names the ones that fail. With a plain bash loop it takes 53.0 seconds. With indo and the Agent Skill it takes 16.1 seconds, 3.3 times faster. Median of 3 runs each. Both setups found the right...
  • ai
  • claude-code
  • bash
  • open-source
BashSnippets • Nov 17 • in Articles • 1 min read
Two rsync commands one character apart both exit 0 and put the same file in different places. I ran them side by side in a scratch directory, rsync 3.5.0, with one file at projects/app/main.sh: $ rsync -a projects backup-a/ $ find backup-a -type f b...
post-cover-29099
  • bash
  • linux
  • devops
  • sysadmin
BashSnippets • Nov 12 • in Articles • 1 min read
On August 6 my laptop booted to a blank terminal. lightdm has Restart=always, and systemctl status said active running. Xorg had entered the NVIDIA init about 140 ms before the device nodes existed and hung there for fourteen hours: state S, 20 ms of...
post-cover-29098
  • bash
  • linux
  • sysadmin
  • devops
BashSnippets • Nov 11 • in Articles • 1 min read
My dev server came up on 3001 for months because something had 3000. As a normal user, ss -ltnp 'sport = :3000' showed two rows, 0.0.0.0:3000 and :::3000, with nothing under Process. I had seen output like that before and moved on. Run back through ...
post-cover-30658
  • linux
  • security
  • docker
  • bash
BashSnippets • Nov 10 • in Articles • 1 min read
On August 28 my laptop sat at 88 % disk. I deleted a 44.6 GB video intermediate I could rebuild any time. du on the folder dropped 44 GB. df on the filesystem moved 5. XFCE's thumbnailer, tumblerd, still had the file open, and a deleted file's blocks...
post-cover-29097
  • bash
  • linux
  • devops
  • sysadmin
BashSnippets • Nov 5 • in Articles • 1 min read
EADDRINUSE right after you stopped the server usually has one cause: the process you launched is not the process holding the socket. I reproduced it on my own machine with the wrapper shape npm run dev uses, a shell that starts the real server as a c...
post-cover-29095
  • bash
  • linux
  • devops
  • sysadmin
BashSnippets • Nov 3 • in Articles • 1 min read
Setting up SSH keys has a trap: every success signal can be green while the thing you cared about stays broken. ssh-copy-id exiting 0 means a line was appended to authorizedkeys — nothing more. A passwordless login afterwards means some auth method w...
post-cover-28029
  • bash
  • linux
  • ssh
  • security
BashSnippets • Oct 29 • in Articles • 1 min read
A world-writable file can be rewritten by every account on the machine — including the service account your web server runs as. Code executing as www-data through a compromised plugin doesn't need root: any chmod 777 you left behind during past debug...
post-cover-28028
  • bash
  • linux
  • security
  • sysadmin
BashSnippets • Oct 28 • in Articles • 1 min read
A 64M scratch tmpfs, a worker process holding its log open on file descriptor 3, and the usual reflex when space runs low: rm the log. du on the directory dropped from 48M to 0. df stayed at 48M used. The next 32M write failed with No space left on d...
post-cover-30657
  • bash
  • linux
  • sysadmin
  • devops
ja.lourenco • Oct 27 • in Articles • 1 min read
Context and Problem An AWS EKS Cluster was attacked, and its secrets were compromised. The Kubernetes Secrets were not encrypted, anyone who works with Kubernetes know they are only base64-encoded by defaulthttps://kubernetes.io/docs/concepts/confi...
post-cover-32727
  • devops
  • security
  • bash
  • kubernetes
BashSnippets • Oct 27 • in Articles • 1 min read
Most "the filter looks right but the script misbehaves" bugs come down to three silent failure modes. First, a missing -r. jq outputs JSON by default, so a string arrives with its quotes attached — your variable holds "web-01", quotes included, and ...
post-cover-28027
  • bash
  • jq
  • json
  • devops
Marcos Vilela • Oct 26 • in Articles • 4 min read
Mantenho todos os meus repositórios em uma única pasta — cerca de 150, entre trabalho para clientes, templates e experimentos. Cada um deles é uma pequena armadilha: um nodemodules dentro de app/ e um .terraform dentro de infra/terraform/. Nenhum dos...
post-cover-32582
  • bash
  • terraform
  • devops
  • node
BashSnippets • Oct 22 • in Articles • 1 min read
If grep returns empty on a file you know contains matches, suspect the pattern before the file. Default grep uses Basic Regular Expressions BRE, where |, +, ?, and are literal characters unless backslash-escaped. So grep "error|failed" app.log searc...
post-cover-28026
  • bash
  • linux
  • grep
  • regex
BashSnippets • Oct 21 • in Articles • 1 min read
A demo script called report, two directories on PATH, and one mv between them, all on a scratch tmpfs: $ report report 2.1: 14 jobs ok exit=0 $ mv /opt/jobs/bin/report /opt/jobs/newbin/report $ ls -l /opt/jobs/newbin/report rwxrwxr-x 1 root root 42 ...
post-cover-30653
  • bash
  • linux
  • devops
  • sysadmin
BashSnippets • Oct 20 • in Articles • 1 min read
The trap with rsync is that its dangerous flag combinations don't fail — they complete a different operation than the one you intended, and exit 0. --delete makes the destination match the source, so a mistyped or freshly moved source directory means...
post-cover-28025
  • bash
  • linux
  • rsync
  • backup
chevron_left
🔥 75 posts • 👩‍💻 9 active writers

✨ Want to write in this topic?
Share your learning. Get discovered. Build your profile.
Join CoderLegion

💡 Why developers use CoderLegion
Track learning • Share posts • Get ranked publicly
Create your profile