If you want to know how many packages are installed on your Debian based system without using something like neofetch or screenfetch:
dpkg -l | wc -l
If you want to know how many packages are installed on your Debian based system without using something like neofetch or screenfetch:
dpkg -l | wc -l
One thing I really miss from Debian in Fedora is apt search
tells you which packages you already have installed.
dnf list installed
Itβs hard to describe exactly why I like seeing which packages are installed when I go package hunting. In part itβs because iβm always jumping through VMs and I can lose track of whatβs on there.
There could be a wrapper that pulls dnf list installed
, matches it to dnf search
and appends [Installed] to matching package lines.
There is also dnf info
in Fedora. It works similar like apt policy
. So at least you can see if is installed or not.
If you want to know who you are because you forgot:
whoami
And because it is Terminal Tuesday you should look up:
calendar
Call me immature, but when terminal output has tasteful, non-kitschy colors, I enjoy my CLI experience like 10x better. I think any and all commands (perhaps to be made into .bashrc aliases) which colorize the output are big wins, to share around.
For example, I really like glances, instead of htop now (thanks, @Mr_McBride). Even though glances takes a lot more RAM, its use of color is much more tasteful, IMHO. I hope 2021 is a year of tasteful colorization of lots and lots of common CLI utilities in Linux.
+1 for glances
add nethogs to that.
As promised, a solution in < 10 lines. Using grep with PCRE RegEx.
Introducing BAAM - [B]ASH [A]ssociative [A]rrarys in [M]ulti-dimensions
BAAM (){ # BAAM - [B]ASH [A]ssociative [A]rrarys in [M]ulti-dimensions
REGEX_STR='(^|[^\t])\t{1}'$2'((?=\t{2}[^\t])|:)\K.*?'
LEVEL=1
for PROP_NAME in "${@:3}"; do
REGEX_STR+='\t{'$((LEVEL++))'}'$PROP_NAME'((?=\t{'$(($LEVEL+1))'}[^\t])|:)\K.*?'
done
REGEX_STR+='[^\t](?=$|\t{1,'$LEVEL'}[^\t])'
echo $(echo "$1" | grep -oPe "$REGEX_STR")
}
Example of use:
#!/usr/bin/env bash
# BAAM uses BAAML, a TAB deliminated multidimensional markup
# Option 1. Inline: Pass arbitrary text containing BAAML markup into a variable
{ MY_DATA=$(</dev/stdin); } <<\EOF
SpaceX
headquarters
address:Rocket Road
city:Hawthorne
state:California
links
website:https://www.spacex.com/
flickr:https://www.flickr.com/photos/spacex/
twitter:https://twitter.com/SpaceX
elon_twitter:https://twitter.com/elonmusk
name:SpaceX
founder:Elon Musk
founded:2002
employees:8000
EOF
# Option 2. Load: cat BAAML markup into a variable
# MY_DATA="`cat ./my_baaml.txt`"
MY_DATA=${MY_DATA//$'\n'/} # Remove newlines so grep can search it in one go
# Define search function
BAAM (){ # BAAM - [B]ASH [A]ssociative [A]rrarys in [M]ulti-dimensions
REGEX_STR='(^|[^\t])\t{1}'$2'((?=\t{2}[^\t])|:)\K.*?'
LEVEL=1
for PROP_NAME in "${@:3}"; do
REGEX_STR+='\t{'$((LEVEL++))'}'$PROP_NAME'((?=\t{'$(($LEVEL+1))'}[^\t])|:)\K.*?'
done
REGEX_STR+='[^\t](?=$|\t{1,'$LEVEL'}[^\t])'
echo $(echo "$1" | grep -oPe "$REGEX_STR")
}
# Call BAAM wtih MY_DATA and each array property to reach the desired value
echo $(BAAM "$MY_DATA" SpaceX links website)
#Output: https://www.spacex.com/
If youβd like to see the process of me creating BAAM and BAAML:
Best way to simulate multidimensional arrays "objects" in BASH? - #27 by Ulfnic
This is ground floor for the project and I intend to take it a lot further. Time allowing iβll be adding lots of features, documentation and testing.
0 voters
Votes should be ranked or multiple choice in future.
For the coin flip: When DL is published, the 1st letter of the first word used at/after the 5 minute mark will decide which one I do. A to M = chatroom, N to Z = GeoIP
I demand a recount.
If you have ECC memory youβll probably know because itβs not a norm for personal computers. Itβs usually in servers as they need max reliability and there can be a lot of memory churn (made that term up, might be real).
Inspired by natermerβs Reddit comment below after Linus expressed his disappointment with Intelβs ongoing stance on ECC. (Learn more in TWIL episode 133)
"I 100% have found dozens of production servers that were on the verge of failing and the only warning signs were ECC memory correction errors.
Itβs a big deal."
How to read errors:
# Is my memory ECC!?
sudo dmidecode -t memory | grep "Type Detail:"
# Unregistered means no
# Get a reader for EDAC (Error Detection and Correction) drivers in the Kernel
sudo dnf install edac-utils # Fedora/CentOS/RHEL
sudo apt install edac-utils # Debian/Ubuntu
# Check if EDAC drivers are loaded and which memory controllers you have
edac-util --status
# Report memory controller data, error count should show up in the output
edac-util --report
Monitoring software often reads EDAC too so itβs worth confirming if your solution is checking for ECC errors.
I think the correct term is garbage collection, but that may just be the term used on the development side.
After reading this I wanted to try using curl
, but I cannot integrate it on my system (KDE Neon on kernel 5.4.0-60).
This is curl I got. How do I use it on Linux?
Tuesday again. Some inxi magic. You can make inxi show you the weather in your location, pretty cool. Of course not so cool as all those tricks by Ulfnic.
inxi -w
Weather: Temperature: 0.7 C (33 F) Conditions: Overcast Clouds Current Time: Di 12 Jan 2021 22:19:03 CET (Europe/Berlin)
Source: WeatherBit.io
Inxi is very powerful for all sorts of information about your system.
curl wttr.in
Highlighting a brilliant project by lemnos which lets you change your terminalβs theme on the fly from a selection of 274 themes.
Option 1. I want this installed for use by my user account
# Download to user's custom executable location
mkdir -p ~/.local/bin/
curl -o ~/.local/bin/theme.sh 'https://raw.githubusercontent.com/lemnos/theme.sh/master/theme.sh'
# Confirm no shenanigans
nano ~/.local/bin/theme.sh
# Make executable to current user
chmod u+x ~/.local/bin/theme.sh
Option 2. I want this installed for use by every account
Note: I changed the installation destination from /usr/bin
to /usr/local/bin
to follow filesystem standards.
# Download to system's custom executable location
sudo curl -o /usr/local/bin/theme.sh 'https://raw.githubusercontent.com/lemnos/theme.sh/master/theme.sh'
# Confirm no shenanigans
nano /usr/local/bin/theme.sh
# Make executable to all users
sudo chmod +x /usr/local/bin/theme.sh
# Output CLI instructions
theme.sh
Pick a theme interactively:
theme.sh -i # Enter interactive mode to pick a theme: # Use: theme.sh -i2 for terminals limited to 16 colors.
# Use the arrow keys or type to search # Enter to select a theme # Ctrl + C to quit
Before:
After:
Add this command to your .bashrc to make a theme permanent:
nano ~/.bashrc
# Add the following replacing "tempus-autumn" w/ your desired theme:
theme.sh tempus-autumn
# Save & quit
# Open a new terminal