<?xml version="1.0" encoding="utf-8" standalone="yes"?><feed xmlns="http://www.w3.org/2005/Atom" xml:base="https://foundata.com/" xml:lang="en"><title>Lslogins on foundata</title><id>https://foundata.com/en/tags/lslogins/feed-atom.xml</id><link rel="self" type="application/atom+xml" hreflang="en" href="https://foundata.com/en/tags/lslogins/feed-atom.xml" title="atom"/><link rel="alternate" type="text/html" hreflang="en" href="https://foundata.com/en/tags/lslogins/" title="html"/><link rel="alternate" type="application/rss+xml" hreflang="en" href="https://foundata.com/en/tags/lslogins/feed-rss.xml" title="rss"/><link rel="alternate" type="application/atom+xml" hreflang="de" href="https://foundata.com/de/tags/lslogins/feed-atom.xml" title="atom, Deutsch"/><link rel="alternate" type="text/html" hreflang="de" href="https://foundata.com/de/tags/lslogins/feed-atom.xml" title="html, Deutsch"/><link rel="alternate" type="application/rss+xml" hreflang="de" href="https://foundata.com/de/tags/lslogins/feed-atom.xml" title="rss, Deutsch"/><updated>2024-12-30T19:57:00Z</updated><author><name>foundata GmbH</name><email>webmaster@foundata.com</email><uri>https://foundata.com/</uri></author><rights>© 2023-2026, foundata GmbH (https://foundata.com)</rights><icon>https://foundata.com/images/feed-icon.67ff83c698af1511552374e80cf5f6ff26d497ef21f04186cf058859d535ca75.svg</icon><logo>https://foundata.com/images/feed-logo.9138f24a120dabc7e3d34003662131cc9c7f2ff153ec39d2f6dea3a48c35b4bf.svg</logo><entry><title type="html">System insights with command-line tools: lslogins and lsmod</title><id>tag:foundata.com,2024-12-30:/en/blog/2024/system-insights-command-line-lslogins-lsmod/</id><published>2024-12-30T19:57:00Z</published><updated>2024-12-30T19:57:00Z</updated><link href="https://foundata.com/en/blog/2024/system-insights-command-line-lslogins-lsmod/?utm_source=feed-atom" rel="alternate" type="text/html"/><link href="https://foundata.com/de/blog/2024/systemeinblicke-kommandozeile-lslogins-lsmod/?utm_source=feed-atom" rel="alternate" type="text/html" hreflang="de"/><link href="https://foundata.com/en/blog/2024/system-insights-command-line-lsof-lsblk/?utm_source=feed-atom" rel="related" type="text/html" title="System insights with command-line tools: lsof and lsblk"/><link href="https://foundata.com/en/blog/2024/system-insights-command-line-lscpu-lsusb/?utm_source=feed-atom" rel="related" type="text/html" title="System insights with command-line tools: lscpu and lsusb"/><link href="https://foundata.com/en/blog/2024/system-insights-command-line-dmidecode-lspci/?utm_source=feed-atom" rel="related" type="text/html" title="System insights with command-line tools: dmidecode and lspci"/><link href="https://foundata.com/en/blog/2024/cve-2024-6387-regresshion-openssh-rce-vulnerability/?utm_source=feed-atom" rel="related" type="text/html" title="OpenSSH Vulnerability: regreSSHion (CVE-2024-6387), Remote Code Execution (RCE)"/><link href="https://foundata.com/en/blog/2024/quectel-em05-g-thinkpad-t14-gen4-fedora-linux/?utm_source=feed-atom" rel="related" type="text/html" title="Quectel EM05-G (LTE module) with ThinkPad T14 Gen4 on Fedora 39 and 40"/><author><name>Andreas Haerter</name><uri>https://andreashaerter.com/</uri></author><summary type="html">An article introducing the command line tools `lslogins` and `lsmod`.</summary><content type="html" xml:base="https://foundata.com/"><![CDATA[<p><em>Note: This article was originally released <a href="https://fedoramagazine.org/system-insights-command-line-lslogins-lsmod/" target="_blank" rel="noreferrer noopener">in the Fedora Magazine</a>.</em></p>
<p>Continuing our <a href="https://foundata.com/en/blog/2024/system-insights-command-line-lscpu-lsusb/">exploration</a> <a href="https://foundata.com/en/blog/2024/system-insights-command-line-dmidecode-lspci/">of</a> <a href="https://foundata.com/en/blog/2024/system-insights-command-line-lsof-lsblk/">commands</a> that provide insights into the inner workings of your Linux system, we turn our focus to more simple ones like <code>lslogins</code> and <code>lsmod</code>. These tools offer information about user accounts and <a href="https://en.wikipedia.org/wiki/Monolithic_kernel#Loadable_modules" target="_blank" rel="noreferrer noopener">kernel modules</a>, respectively.</p>
<h2 id="lslogins-look-into-user-accounts" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#lslogins-look-into-user-accounts" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="lslogins-look-into-user-accounts"><code>lslogins</code>: Look into User Accounts</a></h2><p><code>lslogins</code> is a command that extracts and displays detailed information about user accounts on your system. It pulls data from <code>/etc/passwd</code> and <code>/etc/shadow</code> files, along with system logs, to give you a comprehensive overview. It is especially useful to look for login failures and to list group memberships.</p>
<h3 id="basic-usage" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#basic-usage" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="basic-usage">Basic Usage</a></h3><p>Run the command without arguments to display a summary of all user accounts:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">lslogins
</span></span></code></pre></div><p>This provides an overview including UID (User ID), GID (Group ID), user name, and last login details.</p>
<h3 id="common-options-and-usage-example" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#common-options-and-usage-example" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="common-options-and-usage-example">Common options and usage example</a></h3><ul>
<li><code>-u</code>: Display only user accounts and <code>root</code> (filtering out system accounts with UIDs below 1000).</li>
<li><code>-G</code>: Display information about exiting groups.</li>
<li><code>-g &lt;group&gt;</code>: Show users of a specific group (e.g. <code>wheel</code> which usually has <code>sudo</code>-permissions on a Red Hat system).</li>
<li><code>-e</code>: Display in an export-able key-value output format, separated by space.</li>
<li><code>-L</code>: List last logins and password information (empty, logged, nologin).</li>
</ul>
<p>Examples, listing the last logins and password information (empty, logged, nologin) of non-system user accounts on my laptop as well as group memberships:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ lslogins -L -p -u
</span></span><span class="line"><span class="cl"> UID USER      LAST-TTY LAST-HOSTNAME LAST-LOGIN PWD-EMPTY PWD-LOCK PWD-DENY NOLOGIN HUSHED PWD-METHOD
</span></span><span class="line"><span class="cl">   <span class="m">0</span> root                                                                          <span class="m">0</span>
</span></span><span class="line"><span class="cl"><span class="m">1000</span> ahaerter  tty2     tty2               01:16                                   <span class="m">0</span>      <span class="m">0</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">$ lslogins -G -u
</span></span><span class="line"><span class="cl"> UID USER       GID GROUP     SUPP-GIDS  SUPP-GROUPS
</span></span><span class="line"><span class="cl">   <span class="m">0</span> root         <span class="m">0</span> root
</span></span><span class="line"><span class="cl"><span class="m">1000</span> ahaerter  <span class="m">1000</span> user      971,10,977 docker,wheel
</span></span></code></pre></div><h2 id="lsmod-listing-kernel-modules-for-further-inspection" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#lsmod-listing-kernel-modules-for-further-inspection" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="lsmod-listing-kernel-modules-for-further-inspection"><code>lsmod</code>: Listing Kernel modules for further inspection</a></h2><p>The Linux kernel is <a href="https://en.wikipedia.org/wiki/Tanenbaum%E2%80%93Torvalds_debate" target="_blank" rel="noreferrer noopener">fundamentally monolithic</a> in design, but it also provides the capability to load and unload modules at runtime. A kernel module is generally understood as a component or an extension of the kernel. For example, hardware drivers (e.g., Wi-Fi cards, sound cards, etc.) are usually implemented as modules. The <code>lsmod</code> command provides a nice overview of all currently loaded kernel modules.</p>
<h3 id="basic-usage-1" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#basic-usage-1" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="basic-usage-1">Basic usage</a></h3><p>Simply type:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">lsmod
</span></span></code></pre></div><p>This displays a table with three columns:</p>
<ol>
<li>Module: The name of the kernel module.</li>
<li>Size: The memory size (in bytes) the module occupies.</li>
<li>Used By: Lists the dependent modules or kernel features.</li>
</ol>
<p>Example output:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ lsmod
</span></span><span class="line"><span class="cl">Module                  Size  Used by
</span></span><span class="line"><span class="cl">overlay               <span class="m">241664</span>  <span class="m">0</span>
</span></span><span class="line"><span class="cl">tun                    <span class="m">73728</span>  <span class="m">2</span>
</span></span><span class="line"><span class="cl">snd_usb_audio         <span class="m">614400</span>  <span class="m">0</span>
</span></span><span class="line"><span class="cl">snd_usbmidi_lib        <span class="m">57344</span>  <span class="m">1</span> snd_usb_audio
</span></span><span class="line"><span class="cl">snd_ump                <span class="m">49152</span>  <span class="m">1</span> snd_usb_audio
</span></span><span class="line"><span class="cl">snd_rawmidi            <span class="m">57344</span>  <span class="m">2</span> snd_usbmidi_lib,snd_ump
</span></span><span class="line"><span class="cl">hid_jabra              <span class="m">16384</span>  <span class="m">0</span>
</span></span><span class="line"><span class="cl">uinput                 <span class="m">20480</span>  <span class="m">0</span>
</span></span><span class="line"><span class="cl">rfcomm                <span class="m">102400</span>  <span class="m">16</span>
</span></span><span class="line"><span class="cl">snd_seq_dummy          <span class="m">12288</span>  <span class="m">0</span>
</span></span><span class="line"><span class="cl">snd_hrtimer            <span class="m">12288</span>  <span class="m">1</span>
</span></span><span class="line"><span class="cl">wireguard             <span class="m">122880</span>  <span class="m">0</span>
</span></span><span class="line"><span class="cl">curve25519_x86_64      <span class="m">36864</span>  <span class="m">1</span> wireguard
</span></span><span class="line"><span class="cl">libcurve25519_generic    <span class="m">45056</span>  <span class="m">2</span> curve25519_x86_64,wireguard
</span></span><span class="line"><span class="cl">ip6_udp_tunnel         <span class="m">16384</span>  <span class="m">1</span> wireguard
</span></span><span class="line"><span class="cl">udp_tunnel             <span class="m">36864</span>  <span class="m">1</span> wireguard
</span></span><span class="line"><span class="cl">nf_conntrack_netbios_ns    <span class="m">12288</span>  <span class="m">1</span>
</span></span><span class="line"><span class="cl">nf_conntrack_broadcast    <span class="m">12288</span>  <span class="m">1</span> nf_conntrack_netbios_ns
</span></span><span class="line"><span class="cl">nft_fib_inet           <span class="m">12288</span>  <span class="m">1</span>
</span></span><span class="line"><span class="cl">nft_fib_ipv4           <span class="m">12288</span>  <span class="m">1</span> nft_fib_inet
</span></span><span class="line"><span class="cl">nft_fib_ipv6           <span class="m">12288</span>  <span class="m">1</span> nft_fib_inet
</span></span><span class="line"><span class="cl">nft_fib                <span class="m">12288</span>  <span class="m">3</span> nft_fib_ipv6,nft_fib_ipv4,nft_fib_inet
</span></span><span class="line"><span class="cl"><span class="o">[</span>...<span class="o">]</span>
</span></span></code></pre></div><h3 id="usage-examples" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#usage-examples" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="usage-examples">Usage examples</a></h3><p>While <code>lsmod</code> doesn’t have options, pairing it with other commands enhances its utility:</p>
<ul>
<li>Combine with <code>modinfo</code>: Get detailed information about a specific module, including its author, license, and description.</li>
<li>Debug with <code>dmesg</code>: Correlate kernel log messages with loaded modules to diagnose boot-time issues.</li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">modinfo &lt;module_name&gt;
</span></span><span class="line"><span class="cl">sudo dmesg <span class="p">|</span> grep &lt;module_name&gt;
</span></span></code></pre></div><h2 id="conclusion" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#conclusion" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="conclusion">Conclusion</a></h2><p>Commands like <code>lslogins</code> and <code>lsmod</code> can give you easy insights into user management and kernel behavior. Try them out today, and think about combining their output with other tools to appreciate their capabilities.</p>
]]></content><category scheme="taxonomy:tags" term="toolbox" label="toolbox"/><category scheme="taxonomy:tags" term="lslogins" label="lslogins"/><category scheme="taxonomy:tags" term="lsmod" label="lsmod"/></entry></feed>