WebsiteTemplate/cheatsheets/sensors.html
2026-01-25 11:33:37 -04:00

173 lines
6.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self'; font-src 'self' data:; img-src 'self' data:; connect-src 'self'; base-uri 'self'; form-action 'self' https://defcon.social https://bsky.app;">
<meta http-equiv="X-Content-Type-Options" content="nosniff">
<link rel="stylesheet" href="../assets/css/style.css">
<link rel="icon" type="image/x-icon" href="../favicon.ico">
<script>
// Apply theme immediately to prevent flash
(function() {
const theme = localStorage.getItem('theme') ||
(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
document.documentElement.setAttribute('data-theme', theme);
})();
</script>
<title>sensors Cheatsheet - Cheatsheets - Launch Pad</title>
</head>
<body>
<button class="theme-toggle" id="themeToggle" aria-label="Toggle dark mode">
<svg class="theme-icon theme-icon-moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>
<svg class="theme-icon theme-icon-sun" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display: none;"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg>
</button>
<br/><br/>
<div class="name">
__ _______________________ _________._________________________
\_ _____/ \______ \ / _ \ / _____/ / _____/ | | \_ _____/
| __) | _/ / /_\ \ / \ ___ / \ ___ | | | __)_
| \ | | \ / | \ \ \_\ \ \ \_\ \ | |___ | \
\___ / |____|_ / \____|__ / \______ / \______ / |_______ \ /_______ /
\/ \/ \/ \/ \/ \/ \/
</div>
<div class="blog-page-header">
<div class="blog-header-content">
<a href="/cheatsheets" class="back-link" title="Back to Cheatsheets">
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42" viewBox="0 0 24 24" class="home-icon"><path fill="currentColor" d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/></svg>
</a>
<h1 class="blog-page-title">sensors Cheatsheet</h1>
</div>
</div>
<div class="blog-post-container">
<div class="blog-posts-container" style="max-width: 900px; margin: 0 auto;">
<div class="blog-post">
<div class="blog-post-content">
<p><a href="index.html">← Back to cheatsheets</a></p>
<p><a href="../index.html">← Home</a></p>
<hr>
<p>sensors is a command-line tool from lm-sensors package for monitoring hardware sensors. Displays temperature, voltage, fan speed, and other hardware sensor data.</p>
<hr>
<h2>Basic Usage</h2>
<ul>
<li>sensors - Display all sensor readings</li>
</ul>
<ul>
<li>sensors -u - Show raw sensor data</li>
</ul>
<ul>
<li>sensors -A - Show adapter information</li>
</ul>
<ul>
<li>sensors -j - Output in JSON format</li>
</ul>
<ul>
<li>sensors -f - Output in Fahrenheit</li>
</ul>
<ul>
<li>sensors -c &lt;config&gt; - Use specific config file</li>
</ul>
<hr>
<h2>Sensor Detection</h2>
<ul>
<li>sensors-detect - Detect and configure sensors</li>
</ul>
<ul>
<li>sensors-detect --auto - Auto-detect without prompts</li>
</ul>
<ul>
<li>sensors-detect --batch - Batch mode (no prompts)</li>
</ul>
<hr>
<h2>Configuration</h2>
<ul>
<li>sensors -s - Set sensor limits from config</li>
</ul>
<ul>
<li>sensors -c &lt;file&gt; - Use custom config file</li>
</ul>
<ul>
<li>sensors --set-adapter &lt;adapter&gt; - Set adapter</li>
</ul>
<hr>
<h2>Output Options</h2>
<ul>
<li>sensors -u - Raw/unformatted output</li>
</ul>
<ul>
<li>sensors -A - Show adapter names</li>
</ul>
<ul>
<li>sensors -j - JSON output</li>
</ul>
<ul>
<li>sensors -f - Fahrenheit instead of Celsius</li>
</ul>
<ul>
<li>sensors -h - Show help</li>
</ul>
<hr>
<h2>Common Examples</h2>
<h3>Basic Reading</h3>
<pre><code>sensors</code></pre>
<p>Display all sensor readings.</p>
<h3>Raw Data</h3>
<pre><code>sensors -u</code></pre>
<p>Show raw sensor data with chip names.</p>
<h3>JSON Output</h3>
<pre><code>sensors -j</code></pre>
<p>Output in JSON format for scripting.</p>
<h3>Fahrenheit</h3>
<pre><code>sensors -f</code></pre>
<p>Display temperatures in Fahrenheit.</p>
<h3>Detect Sensors</h3>
<pre><code>sudo sensors-detect</code></pre>
<p>Detect and configure hardware sensors.</p>
<h3>Auto Detect</h3>
<pre><code>sudo sensors-detect --auto</code></pre>
<p>Auto-detect sensors without prompts.</p>
<h3>Real-time Monitoring</h3>
<pre><code>watch -n 1 sensors</code></pre>
<p>Monitor temperatures in real-time, updating every second.</p>
<hr>
<h2>Tips</h2>
<ul>
<li>Run sensors-detect first to detect hardware sensors</li>
</ul>
<ul>
<li>Use -j for JSON output when scripting</li>
</ul>
<ul>
<li>Use -u to see raw chip data and sensor names</li>
</ul>
<ul>
<li>Use -f if you prefer Fahrenheit temperatures</li>
</ul>
<ul>
<li>Combine with watch for real-time monitoring: watch -n 1 sensors</li>
</ul>
<ul>
<li>Use sensors -s to apply limits from configuration</li>
</ul>
<ul>
<li>Check /etc/sensors3.conf for configuration options</li>
</ul>
<ul>
<li>Essential for monitoring CPU and system temperatures</li>
</ul>
<ul>
<li>Use watch sensors to monitor temperatures in real-time (updates every 2 seconds by default)</li>
</ul>
<ul>
<li>For custom update interval: watch -n 0.5 sensors (updates every 0.5 seconds)</li>
</ul>
</div>
</div>
</div>
</div>
<script async type="text/javascript" src="../blog/analytics.js"></script>
<script src="../theme.js"></script>
</body>
</html>