<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Terminal &amp;mdash; Bruno&#39;s ramblings</title>
    <link>https://infosec.press/brunomiguel/tag:Terminal</link>
    <description>A blog where I ramble about... well... stuff.</description>
    <pubDate>Sat, 02 May 2026 15:51:16 +0000</pubDate>
    <item>
      <title>💻 Small shell functions to make my life easier</title>
      <link>https://infosec.press/brunomiguel/small-shell-functions-to-make-my-life-easier</link>
      <description>&lt;![CDATA[Hackerman&#xA;&#xA;!--more--&#xA;&#xA;Check my external IP&#xA;&#xA;function myip {&#xA;&#x9;case &#34;$1&#34; in&#xA;&#x9;&#x9;4 | 6)&#xA;&#x9;&#x9;&#x9;&#x9;echo&#xA;&#x9;&#x9;&#x9;&#x9;tput bold; echo -e &#39;\e[0;93mIPv&#39;$1; tput sgr0&#xA;&#x9;&#x9;&#x9;&#x9;curl -s &#34;http://v$1.ipv6-test.com/api/myip.php&#34;&#xA;&#x9;&#x9;&#x9;&#x9;;;&#xA;&#x9;&#x9;)&#xA;&#x9;&#x9;&#x9;&#x9;echo&#xA;&#x9;&#x9;&#x9;&#x9;tput bold; echo -e &#39;\e[0;93mIPv4&#39;; tput sgr0&#xA;&#x9;&#x9;&#x9;&#x9;curl -4 -s &#34;http://ipv6-test.com/api/myip.php&#34;&#xA;&#x9;&#x9;&#x9;&#x9;echo -e &#34;\n&#34;&#xA;&#x9;&#x9;&#x9;&#x9;tput bold; echo -e &#39;\e[0;93mIPv6&#39;; tput sgr0&#xA;&#x9;&#x9;&#x9;&#x9;curl -6 -s &#34;http://ipv6-test.com/api/myip.php&#34;&#xA;&#x9;&#x9;&#x9;&#x9;;;&#xA;&#x9;esac&#xA;&#x9;echo&#xA;}&#xA;&#xA;Check the current weather&#xA;&#xA;CurrentWeather ()&#xA;{&#xA;&#x9;curl &#39;wttr.in/City?m&amp;lang=pt&amp;format=%l:+%C+%c+\nFeels:%f+\nTemp:%t\n&#39;&#xA;}&#xA;&#xA;System update and cleanup&#xA;&#xA;function sysupdate {&#xA;&#xA;&#x9;&#x9;local native() {&#xA;&#x9;&#x9;&#x9;tput bold;&#xA;&#x9;&#x9;&#x9;echo &#34;\n\e[0;93mUpdating native packages...&#34;&#xA;&#x9;&#x9;&#x9;tput sgr0;&#xA;&#x9;&#x9;&#x9;paru -Syyuv;&#xA;&#x9;&#x9;}&#xA;&#xA;&#x9;&#x9;local fltpk() {&#xA;&#x9;&#x9;&#x9;tput bold;&#xA;&#x9;&#x9;&#x9;echo &#34;\n\e[0;93mUpdating flatpaks...&#34;&#xA;&#x9;&#x9;&#x9;tput sgr0;&#xA;&#x9;&#x9;&#x9;flatpak update;&#xA;&#x9;&#x9;}&#xA;&#xA;&#x9;&#x9;local cleanup() {&#xA;&#x9;&#x9;&#x9;&#x9;array=($HOME/.cargo $HOME/.cache/go-build $HOME/.npm $HOME/.cache/paru $HOME/.cache/winetricks $HOME/.cache/wine $HOME/.cache/spotify $HOME/.cache/pnmp $HOME/.cache/pip $HOME/go)&#xA;&#xA;&#x9;&#x9;&#x9;&#x9;for ((i = 1; i &lt;= $#array; i++)) {&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;if [ -d $array[i] ]; then&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;tput bold;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;echo -e &#34;\n\e[0;93mDeleting $array[i]...&#34;;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;tput sgr0;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;rm -rfv -- $array[i];&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;fi&#xA;&#x9;&#x9;&#x9;&#x9;}&#xA;&#xA;&#x9;&#x9;&#x9;&#x9;tput bold;&#xA;&#x9;&#x9;&#x9;&#x9;echo -e &#34;\n\e[0;93mDeleting native package cache...&#34;;&#xA;&#x9;&#x9;&#x9;&#x9;tput sgr0;&#xA;&#x9;&#x9;&#x9;&#x9;paru -Sccc&#xA;&#x9;&#x9;}&#xA;&#xA;&#x9;&#x9;case &#34;$1&#34; in&#xA;&#x9;&#x9;&#x9;&#x9;-p)&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;native;;&#xA;&#x9;&#x9;&#x9;&#x9;-f)&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;fltpk;;&#xA;&#x9;&#x9;&#x9;&#x9;-c)&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;cleanup;;&#xA;&#x9;&#x9;&#x9;&#x9;-a)&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;native; fltpk; cleanup;;&#xA;&#x9;&#x9;&#x9;&#x9;-h | )&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;echo -e &#34;-p\t Update native packages\n-f\t Update Flatpaks\n-c\t Cleanup after system update. Also includes stuff from ~/.cache\n-h\t Show help&#34;;;&#xA;&#x9;&#x9;esac&#xA;}&#xA;&#xA;#Shell #Functions #CLI #Terminal]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://cld.pt/dl/download/94146fba-b263-4719-82d6-f99f4604ccbc/the_hackerman-3637828277.jpg" alt="Hackerman" title="Hackerman"></p>



<h3 id="check-my-external-ip">Check my external IP</h3>

<pre><code class="language-sh">function myip {
	case &#34;$1&#34; in
		4 | 6)
				echo
				tput bold; echo -e &#39;\e[0;93mIPv&#39;$1; tput sgr0
				curl -s &#34;http://v$1.ipv6-test.com/api/myip.php&#34;
				;;
		*)
				echo
				tput bold; echo -e &#39;\e[0;93mIPv4&#39;; tput sgr0
				curl -4 -s &#34;http://ipv6-test.com/api/myip.php&#34;
				echo -e &#34;\n&#34;
				tput bold; echo -e &#39;\e[0;93mIPv6&#39;; tput sgr0
				curl -6 -s &#34;http://ipv6-test.com/api/myip.php&#34;
				;;
	esac
	echo
}
</code></pre>

<h3 id="check-the-current-weather">Check the current weather</h3>

<pre><code class="language-sh">CurrentWeather ()
{
	curl &#39;wttr.in/City?m&amp;lang=pt&amp;format=%l:+%C+%c+\nFeels:%f+\nTemp:%t\n&#39;
}
</code></pre>

<h3 id="system-update-and-cleanup">System update and cleanup</h3>

<pre><code class="language-sh">function sysupdate {

		local native() {
			tput bold;
			echo &#34;\n\e[0;93mUpdating native packages...&#34;
			tput sgr0;
			paru -Syyuv;
		}

		local fltpk() {
			tput bold;
			echo &#34;\n\e[0;93mUpdating flatpaks...&#34;
			tput sgr0;
			flatpak update;
		}

		local cleanup() {
				array=($HOME/.cargo $HOME/.cache/go-build $HOME/.npm $HOME/.cache/paru $HOME/.cache/winetricks $HOME/.cache/wine $HOME/.cache/spotify $HOME/.cache/pnmp $HOME/.cache/pip $HOME/go)

				for ((i = 1; i &lt;= $#array; i++)) {
					if [ -d $array[i] ]; then
						tput bold;
						echo -e &#34;\n\e[0;93mDeleting $array[i]...&#34;;
						tput sgr0;
						rm -rfv -- $array[i];
					fi
				}

				tput bold;
				echo -e &#34;\n\e[0;93mDeleting native package cache...&#34;;
				tput sgr0;
				paru -Sccc
		}

		case &#34;$1&#34; in
				-p)
						native;;
				-f)
						fltpk;;
				-c)
						cleanup;;
				-a)
						native; fltpk; cleanup;;
				-h | *)
						echo -e &#34;-p\t Update native packages\n-f\t Update Flatpaks\n-c\t Cleanup after system update. Also includes stuff from ~/.cache\n-h\t Show help&#34;;;
		esac
}
</code></pre>

<p><a href="/brunomiguel/tag:Shell" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Shell</span></a> <a href="/brunomiguel/tag:Functions" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Functions</span></a> <a href="/brunomiguel/tag:CLI" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">CLI</span></a> <a href="/brunomiguel/tag:Terminal" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">Terminal</span></a></p>
]]></content:encoded>
      <guid>https://infosec.press/brunomiguel/small-shell-functions-to-make-my-life-easier</guid>
      <pubDate>Tue, 16 Jan 2024 01:12:50 +0000</pubDate>
    </item>
  </channel>
</rss>