<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vlad-Raul Guran</title>
    <description>The latest articles on DEV Community by Vlad-Raul Guran (@vladguran).</description>
    <link>https://dev.to/vladguran</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4197983%2F908f38b3-3e7f-4de1-ad7d-2d22b24ab158.png</url>
      <title>DEV Community: Vlad-Raul Guran</title>
      <link>https://dev.to/vladguran</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vladguran"/>
    <language>en</language>
    <item>
      <title>Git Advanced Workflows &amp; Recovery Cheat Sheet</title>
      <dc:creator>Vlad-Raul Guran</dc:creator>
      <pubDate>Fri, 23 Oct 2026 14:21:48 +0000</pubDate>
      <link>https://dev.to/vladguran/git-advanced-workflows-recovery-cheat-sheet-3b1p</link>
      <guid>https://dev.to/vladguran/git-advanced-workflows-recovery-cheat-sheet-3b1p</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Rewrite history safely, run parallel workflows, and recover almost any lost work. Targets &lt;strong&gt;Git 2.45+&lt;/strong&gt;; every feature used here has been available since Git 2.38 or earlier.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Quick Reference
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Show every HEAD move&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git reflog&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Undo last reset/rebase/merge&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git reset --hard ORIG_HEAD&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Restore a file from any commit&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git restore --source=&amp;lt;sha&amp;gt; -- path&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unstage, keep edits&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git restore --staged path&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fold staged changes into an old commit&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;git commit --fixup=&amp;lt;sha&amp;gt;&lt;/code&gt; then &lt;code&gt;git rebase -i --autosquash &amp;lt;base&amp;gt;&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Move a branch to a new base&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git rebase --onto &amp;lt;newbase&amp;gt; &amp;lt;oldbase&amp;gt; &amp;lt;branch&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Compare two versions of a series&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git range-diff &amp;lt;base&amp;gt; &amp;lt;old-tip&amp;gt; &amp;lt;new-tip&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Find the regression commit&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;git bisect start &amp;lt;bad&amp;gt; &amp;lt;good&amp;gt;&lt;/code&gt; then &lt;code&gt;git bisect run &amp;lt;cmd&amp;gt;&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Work on a second branch in parallel&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git worktree add ../hotfix -b hotfix origin/main&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Safe force-push&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git push --force-with-lease --force-if-includes&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Undo a pushed merge&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git revert -m 1 &amp;lt;merge-sha&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Copy a commit, recording its origin&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git cherry-pick -x &amp;lt;sha&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Find when a string appeared or vanished&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git log -S'needle' --oneline&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Show the history of a function&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git log -L :funcName:path/file.c&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Find lost commits and blobs&lt;/td&gt;
&lt;td&gt;&lt;code&gt;git fsck --lost-found&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Core Patterns
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Reflog: undo almost anything
&lt;/h3&gt;

&lt;p&gt;Every move of HEAD and of each branch tip is logged locally. By default, unreachable entries are kept for 30 days and reachable ones for 90 days. If a command "destroyed" commits, they are almost certainly still in the reflog.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git reflog                               &lt;span class="c"&gt;# HEAD history, newest first&lt;/span&gt;
git reflog show feature/login            &lt;span class="c"&gt;# one branch's tip history&lt;/span&gt;
git log &lt;span class="nt"&gt;-g&lt;/span&gt; &lt;span class="nt"&gt;--oneline&lt;/span&gt; &lt;span class="nt"&gt;--date&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;relative     &lt;span class="c"&gt;# reflog with relative timestamps&lt;/span&gt;
git reset &lt;span class="nt"&gt;--hard&lt;/span&gt; HEAD@&lt;span class="o"&gt;{&lt;/span&gt;1&lt;span class="o"&gt;}&lt;/span&gt;                &lt;span class="c"&gt;# go back to where HEAD was before the last move&lt;/span&gt;
git reset &lt;span class="nt"&gt;--hard&lt;/span&gt; ORIG_HEAD               &lt;span class="c"&gt;# set by reset, rebase, merge, and am&lt;/span&gt;
git branch rescue HEAD@&lt;span class="o"&gt;{&lt;/span&gt;5&lt;span class="o"&gt;}&lt;/span&gt;               &lt;span class="c"&gt;# recover without touching the current branch&lt;/span&gt;
git switch &lt;span class="nt"&gt;-c&lt;/span&gt; rescue &lt;span class="s1"&gt;'main@{2.hours.ago}'&lt;/span&gt;  &lt;span class="c"&gt;# time-based ref syntax&lt;/span&gt;
&lt;span class="c"&gt;# Deleted branch: `git branch -d` prints "(was abc1234)". Otherwise:&lt;/span&gt;
git reflog | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-A1&lt;/span&gt; &lt;span class="s1"&gt;'moving from feature/login'&lt;/span&gt;  &lt;span class="c"&gt;# the 2nd (older) line is the old tip&lt;/span&gt;
git branch feature/login &amp;lt;sha&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Dangling objects: dropped stashes and lost staged work
&lt;/h3&gt;

&lt;p&gt;A stash is a commit. A file you staged with &lt;code&gt;git add&lt;/code&gt; is stored as a blob. Both survive &lt;code&gt;git stash drop&lt;/code&gt; or &lt;code&gt;git reset --hard&lt;/code&gt; until garbage collection removes them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Find a dropped or cleared stash (its subject looks like "WIP on &amp;lt;branch&amp;gt;" or "On &amp;lt;branch&amp;gt;")&lt;/span&gt;
git fsck &lt;span class="nt"&gt;--no-reflog&lt;/span&gt; | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'/dangling commit/ {print $3}'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  | xargs git log &lt;span class="nt"&gt;--no-walk&lt;/span&gt; &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'%h %cr %s'&lt;/span&gt;
git stash apply &amp;lt;sha&amp;gt;
&lt;span class="c"&gt;# Find work that was staged but never committed, then lost to reset --hard&lt;/span&gt;
git fsck &lt;span class="nt"&gt;--lost-found&lt;/span&gt;                    &lt;span class="c"&gt;# writes to .git/lost-found/{commit,other}/&lt;/span&gt;
git show &amp;lt;blob-sha&amp;gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; recovered.txt
&lt;span class="c"&gt;# Edits that were never staged were never stored. Git cannot recover them.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;This is the free part.&lt;/strong&gt; The full Git Advanced Workflows &amp;amp; Recovery Cheat Sheet (production commands, best practices, common pitfalls and a debugging checklist on 2–4 dense pages) is available as a PDF, pay what you want: &lt;a href="https://guranova.gumroad.com/l/cilot" rel="noopener noreferrer"&gt;https://guranova.gumroad.com/l/cilot&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;More sheets: &lt;a href="https://vladguran.github.io/dev-cheatsheets/" rel="noopener noreferrer"&gt;https://vladguran.github.io/dev-cheatsheets/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was written with AI assistance.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>cheatsheet</category>
      <category>developertools</category>
      <category>versioncontrol</category>
    </item>
    <item>
      <title>kubectl Troubleshooting &amp; Daily Commands Cheat Sheet</title>
      <dc:creator>Vlad-Raul Guran</dc:creator>
      <pubDate>Thu, 22 Oct 2026 13:02:49 +0000</pubDate>
      <link>https://dev.to/vladguran/kubectl-troubleshooting-daily-commands-cheat-sheet-3597</link>
      <guid>https://dev.to/vladguran/kubectl-troubleshooting-daily-commands-cheat-sheet-3597</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Production-grade triage, debugging, and recovery with kubectl, targeting &lt;strong&gt;kubectl / Kubernetes v1.31+&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Quick Reference
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Wide pod status&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl get pods -o wide -n &amp;lt;ns&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Full object state and events&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl describe pod &amp;lt;pod&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Recent warnings&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl events -n &amp;lt;ns&amp;gt; --types=Warning&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Logs from the crashed container&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl logs &amp;lt;pod&amp;gt; -c &amp;lt;ctr&amp;gt; --previous&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tail logs across a label&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl logs -l app=web --prefix --since=15m -f&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shell into a container&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl exec -it &amp;lt;pod&amp;gt; -c &amp;lt;ctr&amp;gt; -- sh&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ephemeral debug container&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl debug -it &amp;lt;pod&amp;gt; --image=busybox:1.36 --target=&amp;lt;ctr&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Node shell&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl debug node/&amp;lt;node&amp;gt; -it --image=busybox:1.36&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Resource usage&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl top pod -n &amp;lt;ns&amp;gt; --sort-by=memory&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rollout progress&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl rollout status deploy/&amp;lt;name&amp;gt; --timeout=5m&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Roll back&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl rollout undo deploy/&amp;lt;name&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Local tunnel&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl port-forward svc/&amp;lt;svc&amp;gt; 8080:80&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RBAC check&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl auth can-i &amp;lt;verb&amp;gt; &amp;lt;resource&amp;gt; --as=&amp;lt;user&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Preview changes&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl diff -f &amp;lt;file&amp;gt;.yaml&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wait for readiness&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kubectl wait --for=condition=Ready pod -l app=web --timeout=120s&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Core Patterns
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Triage a failing pod
&lt;/h3&gt;

&lt;p&gt;Walk from coarse to fine: status, then conditions and events, then logs from the &lt;em&gt;previous&lt;/em&gt; container instance. Most crash causes appear in &lt;code&gt;describe&lt;/code&gt; before you read any logs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;NS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;prod&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;POD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;web-7d9f8c6b5-x2k4p
kubectl get pod &lt;span class="nv"&gt;$POD&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="nv"&gt;$NS&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; wide          &lt;span class="c"&gt;# STATUS, RESTARTS, NODE, IP&lt;/span&gt;
kubectl describe pod &lt;span class="nv"&gt;$POD&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="nv"&gt;$NS&lt;/span&gt;             &lt;span class="c"&gt;# Conditions, State/Last State, Events&lt;/span&gt;
kubectl events &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="nv"&gt;$NS&lt;/span&gt; &lt;span class="nt"&gt;--for&lt;/span&gt; pod/&lt;span class="nv"&gt;$POD&lt;/span&gt;         &lt;span class="c"&gt;# events scoped to this pod&lt;/span&gt;
kubectl logs &lt;span class="nv"&gt;$POD&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="nv"&gt;$NS&lt;/span&gt; &lt;span class="nt"&gt;--all-containers&lt;/span&gt; &lt;span class="nt"&gt;--previous&lt;/span&gt; &lt;span class="nt"&gt;--tail&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;200
kubectl get pod &lt;span class="nv"&gt;$POD&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="nv"&gt;$NS&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; yaml          &lt;span class="c"&gt;# full spec plus status&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Decode why a container died
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;lastState.terminated&lt;/code&gt; holds the reason and exit code. Exit code 137 means SIGKILL, usually &lt;code&gt;OOMKilled&lt;/code&gt;. Exit code 143 means SIGTERM. Exit code 1 means an application error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get pod &lt;span class="nv"&gt;$POD&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="nv"&gt;$NS&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'{range .status.containerStatuses[*]}{.name}{"\t"}{.restartCount}{"\t"}{.lastState.terminated.reason}{"\t"}{.lastState.terminated.exitCode}{"\n"}{end}'&lt;/span&gt;

&lt;span class="c"&gt;# Waiting reasons: CrashLoopBackOff, ImagePullBackOff, CreateContainerConfigError&lt;/span&gt;
kubectl get pod &lt;span class="nv"&gt;$POD&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="nv"&gt;$NS&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="nv"&gt;jsonpath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'{.status.containerStatuses[*].state.waiting}'&lt;/span&gt;

&lt;span class="c"&gt;# Pods with the most restarts, cluster-wide&lt;/span&gt;
kubectl get pods &lt;span class="nt"&gt;-A&lt;/span&gt; &lt;span class="nt"&gt;--sort-by&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'.status.containerStatuses[0].restartCount'&lt;/span&gt; | &lt;span class="nb"&gt;tail&lt;/span&gt; &lt;span class="nt"&gt;-15&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;This is the free part.&lt;/strong&gt; The full kubectl Troubleshooting &amp;amp; Daily Commands Cheat Sheet (production commands, best practices, common pitfalls and a debugging checklist on 2–4 dense pages) is available as a PDF, pay what you want: &lt;a href="https://guranova.gumroad.com/l/wktiwb" rel="noopener noreferrer"&gt;https://guranova.gumroad.com/l/wktiwb&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;More sheets: &lt;a href="https://vladguran.github.io/dev-cheatsheets/" rel="noopener noreferrer"&gt;https://vladguran.github.io/dev-cheatsheets/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was written with AI assistance.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>kubectl</category>
      <category>devops</category>
      <category>sre</category>
    </item>
    <item>
      <title>ADB Command Cheat Sheet: Android &amp; Google TV Debugging, Debloating, and Device Control</title>
      <dc:creator>Vlad-Raul Guran</dc:creator>
      <pubDate>Wed, 21 Oct 2026 09:48:51 +0000</pubDate>
      <link>https://dev.to/vladguran/adb-command-cheat-sheet-android-google-tv-debugging-debloating-and-device-control-5ame</link>
      <guid>https://dev.to/vladguran/adb-command-cheat-sheet-android-google-tv-debugging-debloating-and-device-control-5ame</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Every ADB command you actually use for phones and Android/Google TV over USB or Wi-Fi. Targets &lt;strong&gt;Android SDK Platform-Tools 35+ (&lt;code&gt;adb version&lt;/code&gt; → 1.0.41)&lt;/strong&gt; with devices on &lt;strong&gt;Android 11–15&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Quick Reference
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;List devices with model info&lt;/td&gt;
&lt;td&gt;&lt;code&gt;adb devices -l&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Target a specific device&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;adb -s &amp;lt;serial&amp;gt; &amp;lt;cmd&amp;gt;&lt;/code&gt; (or &lt;code&gt;export ANDROID_SERIAL=&amp;lt;serial&amp;gt;&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pair over Wi-Fi (Android 11+)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;adb pair &amp;lt;ip&amp;gt;:&amp;lt;pair-port&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Connect over Wi-Fi&lt;/td&gt;
&lt;td&gt;&lt;code&gt;adb connect &amp;lt;ip&amp;gt;:&amp;lt;port&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Install or update an APK&lt;/td&gt;
&lt;td&gt;&lt;code&gt;adb install -r -g app.apk&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Install split APKs&lt;/td&gt;
&lt;td&gt;&lt;code&gt;adb install-multiple base.apk split_*.apk&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Uninstall an app&lt;/td&gt;
&lt;td&gt;&lt;code&gt;adb uninstall &amp;lt;pkg&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;List third-party packages&lt;/td&gt;
&lt;td&gt;&lt;code&gt;adb shell pm list packages -3&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Launch an app by package&lt;/td&gt;
&lt;td&gt;&lt;code&gt;adb shell monkey -p &amp;lt;pkg&amp;gt; -c android.intent.category.LAUNCHER 1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Force-stop an app&lt;/td&gt;
&lt;td&gt;&lt;code&gt;adb shell am force-stop &amp;lt;pkg&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Clear app data&lt;/td&gt;
&lt;td&gt;&lt;code&gt;adb shell pm clear &amp;lt;pkg&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stream errors only&lt;/td&gt;
&lt;td&gt;&lt;code&gt;adb logcat *:E&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Take a screenshot to the host&lt;/td&gt;
&lt;td&gt;&lt;code&gt;adb exec-out screencap -p &amp;gt; shot.png&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Send a remote or hardware key&lt;/td&gt;
&lt;td&gt;&lt;code&gt;adb shell input keyevent KEYCODE_HOME&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Copy files&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;adb push local /sdcard/&lt;/code&gt; · &lt;code&gt;adb pull /sdcard/file .&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Core Patterns
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Wireless Connection (Phones &amp;amp; Google TV)
&lt;/h3&gt;

&lt;p&gt;Android 11+ uses TLS pairing through &lt;strong&gt;Wireless debugging&lt;/strong&gt;. Older devices, and many TVs, use the legacy TCP mode. That mode either starts from USB, or is enabled by turning on USB/network debugging on the TV itself.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Android 11+: Developer options &amp;gt; Wireless debugging &amp;gt; Pair device with pairing code&lt;/span&gt;
adb pair 192.168.1.50:37123        &lt;span class="c"&gt;# pairing port + 6-digit code shown on device&lt;/span&gt;
adb connect 192.168.1.50:41567     &lt;span class="c"&gt;# DIFFERENT port: shown on main Wireless debugging screen&lt;/span&gt;
adb mdns services                  &lt;span class="c"&gt;# discover advertised devices on the LAN&lt;/span&gt;

&lt;span class="c"&gt;# Legacy (any version): start on USB, then switch to TCP&lt;/span&gt;
adb &lt;span class="nt"&gt;-s&lt;/span&gt; &amp;lt;usb-serial&amp;gt; tcpip 5555
adb connect 192.168.1.50:5555

&lt;span class="c"&gt;# Google TV / Android TV: Settings &amp;gt; System &amp;gt; About &amp;gt; tap "Android TV OS build" 7x,&lt;/span&gt;
&lt;span class="c"&gt;# enable USB debugging in Developer options, then:&lt;/span&gt;
adb connect 192.168.1.60:5555      &lt;span class="c"&gt;# accept the RSA prompt on the TV screen&lt;/span&gt;
adb disconnect 192.168.1.60:5555
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. App Lifecycle: Install, Launch, Measure, Reset
&lt;/h3&gt;

&lt;p&gt;Script the full cycle so every QA run starts from a known state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adb &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; &lt;span class="nt"&gt;-t&lt;/span&gt; app-debug.apk               &lt;span class="c"&gt;# replace, grant runtime perms, allow test APKs&lt;/span&gt;
adb shell pm path com.example.app                &lt;span class="c"&gt;# where the APK lives&lt;/span&gt;
adb shell dumpsys package com.example.app | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="s1"&gt;'versionName|versionCode'&lt;/span&gt;
adb shell cmd package resolve-activity &lt;span class="nt"&gt;--brief&lt;/span&gt; com.example.app   &lt;span class="c"&gt;# find launcher activity&lt;/span&gt;
adb shell am start &lt;span class="nt"&gt;-S&lt;/span&gt; &lt;span class="nt"&gt;-W&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; com.example.app/.MainActivity        &lt;span class="c"&gt;# cold start + timing&lt;/span&gt;
adb shell am start &lt;span class="nt"&gt;-a&lt;/span&gt; android.intent.action.VIEW &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"myapp://item/42"&lt;/span&gt;   &lt;span class="c"&gt;# deep link&lt;/span&gt;
adb shell am force-stop com.example.app
adb shell pm clear com.example.app               &lt;span class="c"&gt;# wipe data + revoke perms&lt;/span&gt;
adb shell pm grant com.example.app android.permission.POST_NOTIFICATIONS
adb shell pm revoke com.example.app android.permission.CAMERA
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Launch week:&lt;/strong&gt; both sheets are 30% off until &lt;strong&gt;Thu, Oct 23, 10:00 UTC&lt;/strong&gt;, applied automatically at checkout.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;This is the free part.&lt;/strong&gt; The full ADB Command Cheat Sheet: Android &amp;amp; Google TV Debugging, Debloating, and Device Control (production commands, best practices, common pitfalls and a debugging checklist on 2–4 dense pages) is available as a PDF, pay what you want: &lt;a href="https://guranova.gumroad.com/l/kdxze" rel="noopener noreferrer"&gt;https://guranova.gumroad.com/l/kdxze&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;More sheets: &lt;a href="https://vladguran.github.io/dev-cheatsheets/" rel="noopener noreferrer"&gt;https://vladguran.github.io/dev-cheatsheets/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was written with AI assistance.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>adb</category>
      <category>android</category>
      <category>googletv</category>
      <category>androiddevelopment</category>
    </item>
  </channel>
</rss>
