0% found this document useful (0 votes)
47 views44 pages

Terminal Fedora x23

The document provides a comprehensive guide to using the Fedora terminal, covering basic commands for file management, user permissions, network configuration, and package management. It includes instructions for using tools like BleachBit for system cleaning, as well as commands for multimedia installation and encryption. Additionally, it outlines methods for checking system status, managing services, and performing speed tests.

Uploaded by

prototype199191
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views44 pages

Terminal Fedora x23

The document provides a comprehensive guide to using the Fedora terminal, covering basic commands for file management, user permissions, network configuration, and package management. It includes instructions for using tools like BleachBit for system cleaning, as well as commands for multimedia installation and encryption. Additionally, it outlines methods for checking system status, managing services, and performing speed tests.

Uploaded by

prototype199191
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

[ $ = user ] [ # = root ]

Terminal Fedora

Basics User Bleach Bit Clean Repository

Encryption/
Network Monitor Permissions Generic
Decryption
Compression/
Date/Time Speed Test SELinux Mode Multimedia
Extraction

Snapstore Ejection Color Profile Efibootmgr Multipart Archive

Fedora WS GPG
HRV Python VeraCrypt
Check
Basics

query current dir


{ $ pwd }

go to dir
{ $ cd "name" }

query files and folders in current dir


{ $ ls }

query all files and folders in current dir


{ $ ls -a }

create new folder in current dir


{ $ mkdir "name" }

remove a folder in current dir


{ $ rm -r "name" }

read the manual of a command


{ $ man "command name" }

create new file


{ $ touch "name" }

open new file in editor


{ $ nano "filename" }

read contents of file


{ $ cat "filename" }
copy file from one loc to another
{ $ cp "filename" path }

locate a file
{ $ locate "filename" }

get quick info on command


{ $ whatis "commandname" }

search system files using wildcards


{ # find / -name '*filename*' }

remove system files


{ # rm -rf /path/to/file }

find all running processes


{ $ top }

kill a running process


{ $ kill "PID" }

for a history of commands typed


{ $ history }

to clear command history


{ $ history -c }

to clear terminal screen


{ $ clear }

shutdown after in minutes


{ $ shutdown "number" }
cancel scheduled shutdown
{ $ shutdown -c }

reboot now
{ $ shutdown -r now }
User

gain access to superuser via a root shell


{ # -i }

to exit root shell


{ $ exit }

add new user


{ $ useradd "username" }

add password
{ $ passwd "username" }

switch user
{ $ su "username" }

check active sessions for all users


{ $ who } {$w}

find active processes for a username


{ $ ps -u username }

delete a user account


{ # userdel -r username }

manually delete folder


{ # rm -r /home/username(path) }
Bleachbit
Interface

System > Rotated Logs, Cache, Temporary Files, Trash

Thumbnails > Cache

Dnf > Clean All

Whitelist Folders

/etc
/var/lib
/boot
/lib
/lib64
/usr/lib
/usr/lib64
/bin
/sbin
/usr/bin
/usr/sbin
/proc
/sys
/dev
/etc/yum.repos.d
Clean

remove unused packages


{ # dnf autoremove }

clear cache
{ # dnf clean all }

restrict journald/ctl logs to


{ # journalctl --vacuum-time=2weeks }

restrict logging size to


{ # journalctl --vacuum-size=150M }
Repository

check flatpack version


{ $ flatpak --version }

install packages
{ # dnf install <package-name> }

search packages
{ # dnf search <package-name> }

package updates
{ # dnf update }

package upgrades
{ # dnf upgrade }

checking installed repositories


{ # dnf repolist }

checking installed packages


{ # dnf list }

piping the output through grep to search for packages with names
containing "rpmfusion/'name'"
{ # dnf list | grep rpmfusion }

dnf wildcard search


{ # dnf search <keyword>* }

verifying flathub activation


{ $ flatpak remotes }

checking installed flatpaks


{ $ flatpak list }

flatpak help
{ $ flatpak --help }

installing applications from flathub


{ $ flatpak install flathub <app id "com.adobe.Reader"> }

flatpak to launch apps


{ $ flatpak run com.adobe.Reader"app id" }

finding the app id


{ $ flatpak search <package-name> }

removing rpm fusion apps


{ # dnf remove <package_name> }

removing flatpak apps


{ $ flatpak uninstall com.adobe.Reader }

listing installed packages


{ $ dnf list }

searching within the list


{ $ dnf list | grep <application_name> }

repository location .repo


/etc/yum.repos.d

system cache dir


/var/cache/dnf

additional dnf.conf options


{ # nano /etc/dnf/dnf.conf }

max_parallel_downloads=20
defaultyes=True

rpm fusion configuration site


https://rpmfusion.org/Configuration

enable access to both the free and the nonfree rpm repository
fedora with dnf
{ # dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-
free-release-$(rpm -E %fedora).noarch.rpm
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-
release-$(rpm -E %fedora).noarch.rpm }

openh264 library
{ # dnf config-manager setopt fedora-cisco-openh264.enabled=1 }

tainted free-repos
{ # dnf install rpmfusion-free-release-tainted }

{ # dnf install libdvdcss }

tainted nonfree-repos
{ # dnf install rpmfusion-nonfree-release-tainted }

flatpak repo
{ $ flatpak remote-add --if-not-exists flathub
https://dl.flathub.org/repo/flathub.flatpakrepo }
Network

get the hostname


{ $ hostname }

edit hostname in rootshell


{ # nano /etc/hostname } (ctrl o, ctrl x)

color username,hostname$, bashrc


open the ~/.bashrc file
{ # nano ~/.bashrc }

# color of username@hostname

export PS1="\[\e[0;30m\]\u@\h:\W\$ \[\e[0m\]"

apply changes after terminal restart


{ # source ~/.bashrc }

display information about network interfaces


{ $ ifconfig }

check for active internet through interfaces eno1,lo and wlp0s26u1u3


in rootshell
{ $ ping -I wlp0s26u1u4 google.com }

{ $ ping -I enp0s25 google.com }

disable connections to a network interface


{ $ ifconfig wlp0s26u1u4 down }
{ $ ifconfig enp0s25 down }

enable connections to a network interface


{ $ ifconfig wlp0s26u1u4 up }

{ $ ifconfig enp0s25 up }

change ip for the interface


{ $ ifconfig wlp0s26u1u4 192.168.1.18(new ip) }

{ $ ifconfig enp0s25 192.168.1.18 }

restart the network connection


{ $ systemctl restart NetworkManager }

hostname for the running network interface


{ $ hostname -i }
Monitor

install wireshark
{ # dnf install wireshark }

run wireshark as root


{ # wireshark }

display information about wireless network interfaces


{ # iw dev }

installing aircrack
{ # dnf install aircrack-ng }

check the interface of the WiFi


{ # airmon-ng }

check the interfering processes


{ # airmon-ng check }

kill these processes


{ # airmon-ng check kill }

put the interface into monitor mode


{ # airmon-ng start wlp0s26u1u4 }

return to the original interface


{ # airmon-ng stop wlp0s26u1u4mon }

restart the network connection


{ $ systemctl restart NetworkManager }
output to only show lines related to network controllers
{ $ lspci | grep -i network }

details about the various network adapters or connections available


on your machine
{ $ ip link show }

check for active connection


{ $ ping google.com }

information about the NetworkManager service


{ $ systemctl status NetworkManager }

information about all Wi-Fi network interfaces (adapters) detected on


your system and displays a
{ $ nmcli device wifi list }

tools
{ # wavemon } { # nmon }
Permissions

navigate terminal to linux folder


{ $ cd "foldername" }

navigate terminal to win folder right click - open in terminal list all
permissions for folders and files in current dir
{ $ ls -l }

permissions syntax rwxrwxrwx - rwx(user-u)rwx(group-g)rwx(other-o)


change all permissions to rwx
{ $ chmod ugo+rwx filename(ext)/foldername }

change all permissions to null


{ $ chmod ugo-rwx filename(ext)/foldername }

change permissions for individual sections


{ $ chmod u/g/o+/- r/w/x filename(ext)/foldername }

open file
{ $ ./filename }

give permissions to all sec


{ $ chmod +x/r/w filename(ext)/foldername }
Encryption

encrypt using gpg in rootshell


{ $ gpg -c /path/filename(ext) } +
passphrase test encryption
{ $ nano filename(ext) }

decrypt using gpg


{ $ gpg -d filename(ext) } + passphrase
Generic

search for word in a file


{ $ grep "searchterm" "filename(ext)" }

list the number of matches


{ $ grep "searchterm" "filename(ext)" -c }

last few lines of a file


{ $ tail -n 3(number)filename(ext) }

| - Pipe for concatenation


search within a command's data
{ $ ifconfig(cmd name) | grep "searchterm" }

adding command output to a file


{ $ ifconfig(cmd name) > "filename(ext)/path }

adding search output to a file


{ $ ifconfig(cmd name) | grep "searchterm" > "filename(ext)/path }

kernel version
{ $ uname -r }

path to desktop applications .desktop files and exec=command


/usr/share/applications
/var/lib/flatpak/exports/share/applications

usb power wakeup until next reboot


{ # echo enabled | # tee /sys/bus/usb/devices/*/power/wakeup }
{ # cat /sys/bus/usb/devices/*/power/wakeup }
Extract/Compress

compress file(s)
{ $ tar czvf sampl.tar.gz samplet.txt (filename {/path} ) filename
filename... }

extract from archive


{ $ tar xzvf sampl.tar.gz(filename {/path} ) }

extract to folder/path
{ $ tar xzvf sampl.tar.gz -C /home/zxy }
Time and Date

synchronizing the system clock with a remote server using ntp, enable
{ # timedatectl set-ntp true }

enable automatic synchronization of the system clock with a remote


server
{ # timedatectl set-ntp yes }

verify the status


{ timedatectl status }

set rtc in utc


{ # timedatectl set-local-rtc 0 }

revert rtc defaults


{ # timedatectl set-local-rtc 1 }
Speed Test

install python
{ # dnf install python } { # dnf install python3 }

check python version


{ $ python --version } { $ python3 --version }

install red hat lsb


{ # dnf install redhat-lsb }

check release
{ $ lsb_release -a }

create dir, go to dir


{ $ mkdir Spte }

{ $ cd Spte }

download speedtest_cli.py
{ $ wget -O speedtest-cli
https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedte
st.py }

grant execution
{ $ chmod +x speedtest-cli }

go to dir
{ $ cd /home/zxy/Spte }

check the internet speed


{ $ ./speedtest-cli } { $ python speedtest-cli }

check in bytes
{ $ ./speedtest-cli --bytes }

to generate and provide a url to the speedtest.net share results image


{ $ ./speedtest-cli --share }

share in bytes
{ $ ./speedtest-cli --share --bytes }

server lists
{ $ wget http://www.speedtest.net/speedtest-servers.php }

view a server ID
{ $ more speedtest-servers.php }

test through the server id


{ $ ./speedtest-cli --server " id " }
SELinux Mode

check status
{ $ sestatus } { $ getenforce }

temporary permissive mode


{ # setenforce 0 }

temporary enforcing mode


{ # setenforce 1 }
Multimedia
initial variant
{ # dnf install gstreamer1-plugins-{bad-\*,good-\*,base} gstreamer1-
plugin-openh264 gstreamer1-libav gstreamer1-plugins-ugly }

{ # dnf install lame\* --exclude=lame-devel }

{ # dnf group upgrade --with-optional multimedia }

vaapi
{ # dnf install libva libva-intel-driver libva-vdpau-driver libvala
libvarlink libvarlink-util libva-utils gstreamer1-vaapi libva-intel-media-
driver libva-intel-hybrid-driver libvdpau-va-gl }

vdpau
{ # dnf install libvdpau libva-vdpau-driver libvdpau-va-gl }

mesa
{ # dnf install mesa-va-drivers mesa-vdpau-drivers.x86_64 mesa-dri-
drivers mesa-filesystem mesa-libEGL mesa-libGL mesa-libGLU mesa-
libOSMesa mesa-libOpenCL mesa-libTeflon mesa-omx-drivers mesa-
va-drivers mesa-vdpau-drivers mesa-libglapi mesa-libgbm }

xorg
{ # dnf install xorg-x11-drv-ati xorg-x11-drv-evdev xorg-x11-drv-fbdev
xorg-x11-drv-intel xorg-x11-drv-libinput xorg-x11-drv-nvidia-libs xorg-
x11-drv-openchrome xorg-x11-drv-qxl xorg-x11-drv-vesa xorg-x11-drv-
vmware xorg-x11-drv-wacom xorg-x11-drv-synaptics-legacy xorg-x11-
server-Xorg xorg-x11-server-common xorg-x11-drivers xorg-x11-drv-
amdgpu xorg-x11-drv-wacom-serial-support xorg-x11-font-utils xorg-
x11-fonts-ISO8859-1-100dpi xorg-x11-fonts-misc xorg-x11-server-
Xwayland xorg-x11-server-source xorg-x11-server-x2gokdrive xorg-
x11-xauth xorg-x11-xbitmaps xorg-x11-xdm xorg-x11-xinit xorg-x11-
xinit-session }

gstreamer
{ # dnf install gstreamer1-vaapi gstreamer1-plugin-libav gstreamer1-
plugin-gif PackageKit-gstreamer-plugin gstreamer-plugin-crystalhd
gstreamer1 gstreamer1-rtsp-server gstreamer1-svt-vp9 gstreamer1-
svt-av1 gstreamermm perl-GStreamer1 phonon-qt5-backend-
gstreamer pipewire-gstreamer python3-gstreamer1 rubygem-
gstreamer mingw32-gstreamer1 gnome-video-effects pocketsphinx-
plugin }

intel
{ # dnf install intel-compute-runtime intel-gmmlib intel-gpu-firmware
intel-igc intel-igc-libs intel-lpmd intel-mediasdk intel-opencl intel-vpl-
gpu-rt libva-intel-hybrid-driver intel-media-driver libva-intel-media-
driver oneVPL-intel-gpu libigfxcmrt libvpl libvpl-tools nvtop }

codecs
{ # dnf install libavcodec-free libavcodec-freeworld pipewire-codec-
aptx xpra-codecs-freeworld xmms2-avcodec opencv-imgcodecs
python3-numcodecs alsa-plugins-a52 alsa-plugins-lavrate baresip-vp9
daala-libs daala-tools flac-libs libtheora libvorbis libvpx mingw64-
wavpack mozilla-openh264 openh264 openjpeg-libs schroedinger vlc-
plugin-gstreamer vlc-plugins-freeworld xvidcore }

drm
{ # dnf install libdrm libdrm-armada drm-utils igt-gpu-tools }
{ # dnf install libplacebo }

appstream metadata
{ # dnf update @core }

{ # dnf group install multimedia }

{ # dnf group install sound-and-video }

{ # dnf update @sound-and-video }

{ # dnf update @multimedia }

{ # dnf group list --hidden }

check group permissions for current user


{ $ groups }

assign group permissions for current user and reboot


{ # usermod -aG
cdrom,mail,dialout,games,video,lock,audio,input,render,usbmon,wire
shark,power,flatpak,colord,pipewire zxy }

ffmpeg
{ # dnf install ffmpeg }

{ # dnf install ffmpeg-free --allowerasing }

convert mp4 to aac


{ $ cd foldername }

{ $ ffmpeg -i name.mp4 -vn -acodec copy name.aac }


convert aac to opus(at default bitrate)
{ $ ffmpeg -i name.aac -acodec libopus name.opus }
Snapstore

install snapstore, enable snapd


{ # dnf install snapd }

reboot & check for snap’s path in the env var PATH
{ $ echo $PATH }
check for /var/lib/snapd/snap/bin

enable classic snap support to create a symbolic link between


/var/lib/snapd/snap and /snap: and reboot
{ # ln -s /var/lib/snapd/snap /snap }

install snap store


{ # snap install snap-store }

install mpv-wayland
{ # snap install “package-name” }

check for updates


{ $ snap refresh list } { $ snap refresh }

check for snap package updates


{ $ snap refresh “package-name” }

check package information


{ $ snap info “package-name” }
Eject Devices

check for block devices


{ $ lsblk }

unmount a device
{ # umount /dev/sdb1 } (partition of mounted sdb disk)

eject unmounted device


{ # eject /dev/sdb } (partition unmounts/ force unmounts)

power off ejected device


{ # udisksctl power-off -b /dev/sdb }
Color Profile

query the RPM database that match colord


{ $ rpm -qa colord }

default location of the icc profile


{ $ cd /home/zxy/.local/share/icc }

reads files sequentially, displaying their content to the terminal,


querying the colord icc dir
{ $ cat /var/lib/colord/icc/ }

applying the profile:


transfer the profile
{ # cp /home/zxy/.local/share/icc/edid-
da4cb303bc7c842a7c5e1fb8cbfb7b08.icc /var/lib/colord/icc/ }

if not automatically loaded

open gnome settings -> color


select monitor
add profile
locate and select the icc profile from the path where it is stored
{ $ ~/.local/share/icc/ } or { $ /var/lib/colord/icc/ }
set for all users or copy into the /var/lib/colord/icc/ and install
Efibootmgr

uefi boot menu entries,bootorder


{ $ man efibootmgr }

Example Configuration
[root@localhost ~]# efibootmgr
BootCurrent: 0004
BootNext: 0003
BootOrder: 0004,0000,0001,0002,0003
Timeout: 30 seconds
Boot0000* Diskette Drive(device:0)
Boot0001* CD-ROM Drive(device:FF)
Boot0002* Hard Drive(Device:80)/HD(Part1,Sig00112233)
Boot0003* PXE Boot: MAC(00D0B7C15D91)
Boot0004* Linux

Deleting a boot option:


Assuming the configuration in the example efibootmgr -b 4 -B could
be called to delete entry 4 and remove it from the BootOrder.

Changing the boot order:


Assuming the configuration in the example, efibootmgr -o 3,4
could be called to specify PXE boot first, then Linux boot.

Changing the boot order for the next boot only:


Assuming the configuration in the first example, efibootmgr -n 4
could be called to specify that the Linux entry be taken on next boot.

case of double entry,for config


{ # efibootmgr }
BootNext: 0000
Timeout: 1 seconds
BootOrder: 0002,0000,0008,0001,0003
Boot0000* Fedora HD(1,GPT,c70d52b0-0116-4fcf-8ee8-
129cc0852994,0x800,0x12c000)/\EFI\fedora\shimx64.efi
Boot0001* Hard Drive BBS(HD,,0x0)
Boot0002* Fedora HD(1,GPT,c70d52b0-0116-4fcf-8ee8-
129cc0852994,0x800,0x12c000)/\EFI\FEDORA\shimx64.efi
Boot0003* Network Card BBS(Network,,0x0)
Boot0008* UEFI: ST1000DM010-2EP102
PciRoot(0x0)/Pci(0x1f,0x2)/Sata(1,65535,0)/HD(1,GPT,c70d52b0-0116-
4fcf-8ee8-129cc0852994,0x800,0x12c000)/\EFI\BOOT\BOOTX64.EFI

nav to EFI\fedora\shimx64.efi | EFI\FEDORA\shimx64.efi


{ # nautilus } nav to /boot/efi/EFI
{ # cd /boot/efi/EFI }

to del EFI\FEDORA\shimx64.efi boot entry

delete a boot entry


{ # efibootmgr -b 2 -B }
where -b selects boot num, and -B deletes it

change a boot order fully


{ # efibootmgr -o 0000,0008,0001,0003,0002 }
where -o sets it consecutively

optionally, changing boot next


{ # efibootmgr -n 0008 }
where -n sets it until next boot before reverting to prev order
Multipart Archive

combine files, an image and an archive, changing extension


{ $ cat imgname.jpg archname.7z > endname.png }
where cat concatenates and displays, and > functions as a redirection
operator combining them to work as a multipart archive file. The orig
extensions are held in binary modules where one part functions as an
image and the other an archive displaying the image while masking
the content of the archive.

.7z
{ # dnf install p7zip p7zip-plugins p7zip-gui }

extract a multipart image extension archive with a .7z


{ $ 7z x endname.png }

extract a multipart image extension archive with a .zip


{ $ unzip endname.png }
HRV Python

pip3 to install other Python packages


{ # dnf install python3-pip }

python packages for hrv based graphs


{ $ pip3 install numpy matplotlib }

install the SciPy library


{ # dnf install python3-scipy }

from within the folder of .py scripts


{ cd Pyhrv }

creates the poincare scatter plot using r-r interval data plotting
standard deviations from the line of identity of the poincare cloud.
{ # nano poincarestdev.py }

{
import numpy as np
from matplotlib import style
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
style.use('ggplot')

def plotPoincareWithEllipse(RRints, SD1, SD2):


"""
Input:
- RRints: List of RR intervals
- SD1: Short-term variability (width of ellipse)
- SD2: Long-term variability (length of ellipse)

Output:
- Poincare plot with SD1, SD2 lines and ellipse showing variability
"""
ax1 = RRints[:-1]
ax2 = RRints[1:]

# Normalize the color values to be between 0 and 1


norm = plt.Normalize(vmin=min(RRints), vmax=max(RRints))
# Create a colormap object
cmap = plt.get_cmap('gist_heat')

# Create scatter plot


scatter = plt.scatter(ax1, ax2, c=RRints[:-1], cmap=cmap, norm=norm, s=27)

# Add a colorbar to show the color mapping


plt.colorbar(scatter, label='Colour Bar: Dark Red-White')

# Line of identity (diagonal line)


min_val = min(min(ax1), min(ax2))
max_val = max(max(ax1), max(ax2))
#plt.plot([min_val, max_val], [min_val, max_val], 'k--', label="Line of Identity")
plt.plot([min_val, max_val], [min_val, max_val], color='#373b4a', linestyle='--',
dashes=(22, 7), label="Line of Identity")

# Ellipse parameters
center_x = np.mean(ax1)
center_y = np.mean(ax2)
angle = np.degrees(np.arctan2(SD1, SD2)) # Angle of rotation of ellipse

# Create the ellipse patch


ellipse = Ellipse((center_x, center_y), width=2*SD2, height=2*SD1, angle=angle,
color='#c7d530', fill=False, linestyle='--', linewidth=0.98596, label='Ellipse')

# Add ellipse to the plot


plt.gca().add_patch(ellipse)

# Plot SD1 and SD2 lines


plt.plot([center_x - SD1, center_x + SD1], [center_y + SD1, center_y - SD1], color=
'#3193cf', lw=3.14, label='SD1')
plt.plot([center_x - SD2, center_x + SD2], [center_y - SD2, center_y + SD2],
color='#F3C122', lw=3.14, label='SD2')

# Add labels
plt.xlabel(r'RR$_n$ (ms)')
plt.ylabel(r'RR$_{n+1}$ (ms)')
plt.legend()
plt.title('Standard Deviations Poincare Plot')
# Add SD1 and SD2 text to the plot (position it above the graph)
plt.text(0.502, 1.088, f'SD1 = {SD1:.2f} ms, SD2 = {SD2:.2f} ms',
horizontalalignment='center', verticalalignment='center',
transform=plt.gca().transAxes, fontsize=10, color='#005189',
fontweight='heavy')

# Add grid
plt.grid(True)

# Show plot
plt.show()

def ellipseFittingMethod(RRints):
"""
Input:
- RRints: List of RR intervals

Output:
- Dictionary with SD1 and SD2 values
"""
SDSD = np.std(np.diff(RRints))
SDRR = np.std(RRints)
SD1 = (1 / np.sqrt(2)) * SDSD
SD2 = np.sqrt((2 * SDRR ** 2) - (0.5 * SDSD ** 2))
return {'SD1': SD1, 'SD2': SD2}

# Swap RR intervals
RR_intervals = [763,776,772,757,748,746,748,739,743,779,792,786]

# Calculate SD1 and SD2


ellipse_results = ellipseFittingMethod(RR_intervals)
# Plot the Poincare plot with SD1 and SD2 lines and ellipse
plotPoincareWithEllipse(RR_intervals, ellipse_results['SD1'], ellipse_results['SD2'])
}

save out (ctrl+o,ctrl+x) , make the script executable


{ # chmod ugo+rwx poincarestdev.py }

execute the script


{ $ python3 poincarestdev.py }

creates the poincare scatter plot using r-r interval data plotting color
coded acceleration and deceleration points printing the C_DOWN and
C_UP parameters for heart rate acceleration and deceleration
respectively.
{ # nano poincarehra.py }

}
import numpy as np
from matplotlib import style
import matplotlib.pyplot as plt

style.use('ggplot')

def hraMethod(RRints):
"""
Perform analysis to quantify heart rate asymmetry (HRA).

Input :

- RRints : [list] of RR intervals

Output :

- C_DOWN, C_UP : {dict} with keys 'C_DOWN' (numpy.float64) and


'C_UP' (numpy.float64)
"""
ax1 = np.array(RRints[:-1])
ax2 = np.array(RRints[1:])
SD1I = np.sqrt((1 / len(ax1)) * (np.sum((ax1 - ax2) ** 2) / 2))
ax1ax2 = (ax1 - ax2) / np.sqrt(2)
indices_up = np.where(ax1ax2 > 0)
indices_down = np.where(ax1ax2 < 0)
SD1_UP = np.sqrt(np.sum(ax1ax2[indices_up] ** 2) / len(ax1))
SD1_DOWN = np.sqrt(np.sum(ax1ax2[indices_down] ** 2) / len(ax1))
C_UP = SD1_UP ** 2 / SD1I ** 2 # for decelerations
C_DOWN = SD1_DOWN ** 2 / SD1I ** 2 # for accelerations

return {'C_UP': C_UP, 'C_DOWN': C_DOWN}

def plot_poincare(RRints):
"""
Plot the Poincaré plot with points color-coded for acceleration and
deceleration.

Input :

- RRints : [list] of RR intervals


"""
# Calculate HRA values
hra_values = hraMethod(RRints)
C_UP = hra_values['C_UP']
C_DOWN = hra_values['C_DOWN']

# Convert RR intervals to numpy arrays


ax1 = np.array(RRints[:-1])
ax2 = np.array(RRints[1:])

# Determine acceleration and deceleration points


ax1ax2 = (ax1 - ax2) / np.sqrt(2)
indices_up = np.where(ax1ax2 > 0)
indices_down = np.where(ax1ax2 < 0)

# Count the number of points


num_acceleration = len(indices_up[0])
num_deceleration = len(indices_down[0])

# Multiply by 3 for each point representing 3 beats


adjusted_acceleration = num_acceleration * 3
adjusted_deceleration = num_deceleration * 3
total_beats = adjusted_acceleration + adjusted_deceleration

# Plotting
plt.scatter(ax1[indices_up], ax2[indices_up], color='#df0647',
label='Acceleration', alpha=0.8)
plt.scatter(ax1[indices_down], ax2[indices_down], color='#1e9634',
label='Deceleration', alpha=0.8)

# Add text annotations above the title


plt.title('Heart Rate Asymmetry Poincare Plot')
plt.xlabel(r'RR$_n$ (ms)')
plt.ylabel(r'RR$_{n+1}$ (ms)')
plt.legend()
plt.grid(True)

# Add the annotations above the title


plt.text(0.5, 1.10, f'[ C_UP: {C_UP:.2f} ] [ C_DOWN: {C_DOWN:.2f} ] [ Acceleration
Count: {num_acceleration} ] [ Deceleration Count: {num_deceleration} ]
[ {total_beats} Beats ]',
transform=plt.gca().transAxes, ha='center', va='bottom',
fontsize=8, bbox=dict(facecolor='#a27b8e', alpha=0.0314))

plt.show()

# Swap RR Intervals
RRints = [763,776,772,757,748,746,748,739,743]

# HRA with color coded acceleration and deceleration


plot_poincare(RRints)
}

save out (ctrl+o,ctrl+x) , make the script executable


{ # chmod ugo+rwx poincarehra.py }

execute the script


{ $ python3 poincarehra.py }

creates the poincare scatter plot of the interbeat autocorrelation


coefficient r_rr, a unit-free measure between 0 and 1, indicates how
similar consecutive RR intervals are to one another.
{ # nano poincareautocorrelation.py }

}
import numpy as np
from matplotlib import style
import matplotlib.pyplot as plt
from scipy.stats import gaussian_kde
style.use('ggplot')

# Function to calculate the interbeat autocorrelation coefficient


def correlationCoef(RRints):
"""
Computes interbeat autocorrelation coefficient.

Input:
- RRints: [list] of RR intervals

Output:
- r_rr: [numpy.float64] interbeat autocorrelation coefficient
"""
ax1 = RRints[:-1]
ax2 = RRints[1:]
mu_rr = np.mean(RRints)
r_rr = np.mean((ax1 - mu_rr) * (ax2 - mu_rr)) / (np.sqrt(np.mean((ax1 - mu_rr) **
2) * np.mean((ax2 - mu_rr) ** 2)))
return mu_rr, r_rr

# Function to plot the Poincare plot with density and autocorrelation


colormapping
def plot_poincare_density_autocorr(RRints):

# Calculate mu_rr and r_rr


mu_rr, r_rr = correlationCoef(RRints)

# Create the ax1 (x-values) and ax2 (y-values)


ax1 = RRints[:-1]
ax2 = RRints[1:]

# Create a 2D density plot


xy = np.vstack([ax1, ax2])
z = gaussian_kde(xy)(xy)

# Normalize autocorrelation values for coloring


autocorr_values = np.linspace(0.097, 0.97, num=len(z)) # Mapping of autocorr
to color
normalized_autocorr = (autocorr_values - np.min(autocorr_values)) /
(np.max(autocorr_values) - np.min(autocorr_values))

# Create scatter plot with density and autocorrelation color mapping


scatter = plt.scatter(ax1, ax2, c=normalized_autocorr, cmap='plasma', s=27)

# Add a colorbar to indicate the autocorrelation values


cbar = plt.colorbar(scatter, label='Plasma:Normalized Autocorrelation')

# Line of identity (diagonal line)


min_val = min(min(ax1), min(ax2))
max_val = max(max(ax1), max(ax2))

plt.plot([min_val, max_val], [min_val, max_val], color='#373b4a', linestyle='--',


dashes=(22, 7), label="Line of Identity")

# Label axes
plt.xlabel(r'RR$_n$ (ms)')
plt.ylabel(r'RR$_{n+1}$ (ms)')
plt.title('Interbeat Autocorrelation Coefficient Poincare Density Map')
plt.legend()
plt.text(0.5, 1.087, f'[ Mean(RR) mu_rr = {mu_rr:.2f} ms ] [ Interbeat
Autocorrelation r_rr = {r_rr:.2f} ]',
horizontalalignment='center', verticalalignment='center',
transform=plt.gca().transAxes, fontsize=9, color='#005189',
fontweight='heavy')

plt.text(0.51, 1.126, f'[High r_rr = High Density = Lower Variability = Higher


Stability ]',
horizontalalignment='center', verticalalignment='center',
transform=plt.gca().transAxes, fontsize=9, color='#005189',
fontweight='bold')

# Show the plot


plt.grid(True)
plt.show()

# Swap RR intervals
RRints = [763,776,772,757,748,746,748,739,743,779,792]

# Call the function to plot


plot_poincare_density_autocorr(RRints)
}

save out (ctrl+o,ctrl+x) , make the script executable


{ # chmod ugo+rwx poincareautocorrelation.py }

execute the script


{ $ python3 poincareautocorrelation.py }
Fedora WS GPG Check

Download the checksum file into the same directory as the image you
downloaded and navigate to it.
import Fedora's GPG key(s)

{ $ curl -O https://fedoraproject.org/fedora.gpg }

verify the checksum file is valid

{ $ gpgv --keyring ./fedora.gpg Fedora-Workstation-41-1.4-x86_64-


CHECKSUM }

verify the checksum matches

{ $ sha256sum -c Fedora-Workstation-41-1.4-x86_64-CHECKSUM }
Veracrypt

import VeraCrypt GPG Public Key

{ # rpm --import
https://www.idrix.fr/VeraCrypt/VeraCrypt_PGP_public_key.asc }

download VeraCrypt RPM packages from the official website and verify
the RPM package against the imported key

[ RPM packages: Fedora 40:

GUI: veracrypt-1.26.14-Fedora-40-x86_64.rpm (PGP Signature)

Console: veracrypt-console-1.26.14-Fedora-40-x86_64.rpm (PGP


Signature) ]

{ $ rpm --checksig /Path/to/File/veraCrypt/veracrypt-1.26.14-


Fedora-40-x86_64.rpm }

{ $ rpm --checksig /Path/to/File/veraCrypt/veracrypt-console-1.26.14-


Fedora-40-x86_64.rpm }

install VeraCrypt manually from path

{ # dnf install /Path/to/File/veracrypt-1.26.14-Fedora-40-x86_64.rpm }

{ # dnf install /Path/to/File/veracrypt-console-1.26.14-Fedora-40-


x86_64.rpm }

remove VeraCrypt via dnf

{ # dnf remove veracrypt }

You might also like