Text File Compare Using diff and grep

Make sure both input files are sorted and UPPERCASE

Lines only in file1.txt

diff -d -i -w file1.txt file2.txt | grep "^[<]" > file1-only.txt

Lines only in file2.txt

diff -d -i -w file1.txt file2.txt | grep "^[>]" > file2-only.txt

Lines common in both files

diff -u -d -i -w file1.txt file2.txt | grep -v "^[-+]" > both-files.txt

Ubuntu List Installed Packages

Refer: https://itsfoss.com/list-installed-packages-ubuntu/

Example of how to upgrade sublime-text from the command line, the first step, is just to make sure it's installed and to get its proper name.

apt list --installed | grep -i sublime
sudo apt-get update
sudo apt-get --only-upgrade install sublime-text

To list packages using apt command:

apt list --installed

To list packages using dpkg command:

dpkg-query -l

To list Snap packages installed on your system:

snap list

To list Flatpak packages installed on your system:

flatpak list

List the recently installed packages

So far you saw the list of installed packages in alphabetical order. What if you want to see the packages that have been installed recently?

Thankfully, a Linux system keeps a log of everything that happens in your system. You can refer to the logs to see the recently installed packages.

There are a couple of ways to do this. You can either use the dpkg command’s log or the apt command’s log.

You’ll have to use grep command to filter the result to list the installed packages only.

grep " install " /var/log/dpkg.log

You can also use the history of apt command. This will show only the programs that you installed using apt command. It won’t show the dependencies installed with it, though the details are present in the logs. Sometimes, you just want to see that, right?

grep " install " /var/log/apt/history.log

List recently installed packagesListing recently installed packages

The history log of apt is quite useful because it shows the time when the apt command was run, the user who ran the command and the packages that were installed by a command.

How To View Clonezilla Images

You can use RescueZilla which has a built-in GUI for Filezilla along with a file browser as long as you do NOT compress the backup image.

RescueZilla Tags - https://github.com/rescuezilla/rescuezilla/tags

RescueZilla Download - https://rescuezilla.com/download.html

Video at: http://youtu.be/OwZ-98KkZs4

Requirement

sudo apt install partclone

Create File to Hold ISO

mkdir /media/mruckman/RUCKMANS-4T/ISO
touch /media/mruckman/RUCKMANS-4T/ISO/IDEAPAD330.ISO

The following wild card names might be slightly different depending on your backup

sudo cat /media/mruckman/RUCKMANS-4T/2021-07-07-01-img/sda2.ext4-ptcl-img.gz.* | sudo gzip -d -c | sudo partclone.restore -C -s - -O /media/mruckman/RUCKMANS-4T/ISO/IDEAPAD330.ISO

Now to Finish Preparing the ISO Image

cd /media/mruckman/RUCKMANS-4T/ISO

# Answer Yes when prompted to Abort
e2fsck -f IDEAPAD330.ISO
resize2fs -f IDEAPAD330.ISO

Mount the Image in Read-Only to Retrieve Files. When mounted, it's read-only and can be found /mnt

Note: Mount Utility only seems to work on local drive and NOT external drive

sudo mount -o loop -t ext4 /media/mruckman/RUCKMANS-4T/ISO/IDEAPAD330.ISO /mnt

Unmount the ISO Image

sudo umount /mnt

Compress a PDF in Ubuntu using GhostScript

View Solution Article
How_to_Compress_PDF_in_Linux.pdf

Refer: compress-pdf-linux

Synopsis / Example

$ sudo apt install ghostscript
$ gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed_PDF_file.pdf input_PDF_file.pdf
dPDFSETTINGS   Description
/prepress    (default) Higher quality output (300 dpi) but bigger size
/ebook         Medium quality output (150 dpi) with moderate output file size
/screen        Lower quality output (72 dpi) but smallest possible output file size

Upgrade Single Package in Ubuntu

Refer: upgrade-single-package

As usual you need to fetch an updated index from the Internet:

sudo apt-get update

Now upgrade a package, where Package is whatever you want.

sudo apt-get --only-upgrade install Package
sudo apt-get install Package

Bonus, see list of packages available for upgrade

sudo apt-get update
sudo apt list --upgradable

Using Dolphin Browser

The Dolphin browser has a nice integration with the terminal, but you need to install the addtional plug-in.

sudo apt-get install dolphin
sudo apt-get install dolphin konsole
sudo apt-get install ark