Regex Between Two Strings

cat mobile_errors.txt.txt | grep -o -P '(?<=returned for booking ).*(?= with error code)' | sort | uniq > mobile_error_bookings.txt

The magic of this search is here:

grep -o -P '(?<=beginning string with space at end ).*(?= ending string with space at start of it)

Copy Command Output To Linux Clipboard Directly

Refer: https://www.cyberciti.biz/faq/xclip-linux-insert-files-command-output-intoclipboard/

In order to put it on the global clipboard and just not the terminal clipboard.

alias cbcopy='xclip -selection clipboard'
alias cbpaste='xclip -selection clipboard -o'

Installation

sudo apt-get install xclip

How do I use the xclip command for clipboard copy and paste?

Let us copy the output of the following command to the Linux clipboard. The syntax is:

command | xclip
command | xclip -i

To paste selection to standard out or pipe, use the following command again:

xclip -o
xclip -o | myapp1 -arg1

Nala throws Repo Warning

The following type of error gets thrown when updating Ubuntu

Failed to fetch http://ubuntu.byteiran.com/ubuntu/dists/jammy/InRelease
sudo apt update always giving Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)

Solution was to comment out file with byteiran in it.

sudo subl /etc/apt/sources.list.d/nala-sources.list

Other Standard Sources

sudo subl sudo /opt/sublime_text/sublime_text /etc/apt/sources.list
# deb http://ubuntu.byteiran.com/ubuntu/ jammy main restricted universe multiverse

Website Traffic Analysis with goaccess better than Webalizer

Refer: https://www.makeuseof.com/analyse-website-traffic-from-linux-terminal-with-goaccess/#why-not-use-google-analytics

Installation

sudo apt-get install goaccess

Terminal Version

Use "NCSA Combined Log Format"

goaccess /home/mruckman/Desktop/apache-log-files-202X-mm-dd/var/log/httpd/access_log -o report.html --log-format=COMBINED

There are keys you can use to navigate panels and browser forward and backwards. Type ? for help screen.

[Tab] and [Shift]+[Tab] key navigates between panels

Hit [Enter] to open a panel and then

[Ctrl] + [f] is forward
[Ctrl] + [b] is backward

Generate an HTML Report

goaccess /home/mruckman/Desktop/apache-log-files-202X-mm-dd/var/log/httpd/access_log -o report.html --log-format=COMBINED

Boot into UEFI settings from Linux

Refer: https://itsfoss.com/access-uefi-from-linux/

It is still a good idea to ensure that your Linux distro uses systemd. Use the given command and if it returns systemd you are good to go:

ps --no-headers -o comm 1

Once you figure out that your distro is utilizing systemd, you can use the given command to boot into UEFI settings:

systemctl reboot --firmware-setup

Let me break down the used options first:

  • reboot: As its name suggest, it will reboot your system.
  • --firmware-setup: When this option is used with reboot, it will indicate to the system’s firmware to boot into the firmware setup interface.

Ubuntu 22.04 Can’t Play Disney+ Videos After Update

Refer: https://askubuntu.com/questions/1437945/ubuntu-22-04-cant-play-disney-videos-after-update

Solution for Firefox browser:

  • Enter about:config in the URL input field and accept the risk.
  • Search for general.useragent.override.
  • Select String and click +.
  • In the input field enter:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0
  • Accept the changes and refresh the page and the video will load.
  • Be sure not to forget to clear your browser's cache.

Original Source: https://www.reddit.com/r/linuxquestions/comments/yfjaa1/comment/iu6916h/?utm_source=share&utm_medium=web2x&context=3