Linux notes

Convert images to a PDF file:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo apt install img2pdf # If not installed already
img2pdf im1.png im2.jpg -o out.pdf
sudo apt install img2pdf # If not installed already img2pdf im1.png im2.jpg -o out.pdf
sudo apt install img2pdf # If not installed already
img2pdf im1.png im2.jpg -o out.pdf

Source: https://stackoverflow.com/a/8955457/526189

Convert images

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo apt-get install imagemagick
convert source.png dest.jpg
sudo apt-get install imagemagick convert source.png dest.jpg
sudo apt-get install imagemagick
convert source.png dest.jpg

Source: https://askubuntu.com/a/13825/118883

Copy ISO image to USB drive

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
dd if=/path/to/your/isofile of=/your/usb/disk bs=8M status=progress
dd if=/path/to/your/isofile of=/your/usb/disk bs=8M status=progress
dd if=/path/to/your/isofile of=/your/usb/disk bs=8M status=progress

Source: https://superuser.com/a/351815/101527

Convert PDF files to text files

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo apt install poppler-utils
pdftotext input.pdf output.txt
sudo apt install poppler-utils pdftotext input.pdf output.txt
sudo apt install poppler-utils

pdftotext input.pdf output.txt

Sources: cyberciti, linuxuprising

Colored cat

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
alias ccat='highlight -O ansi --force'
ccat file
alias ccat='highlight -O ansi --force' ccat file
alias ccat='highlight -O ansi --force'

ccat file

Source: https://stackoverflow.com/a/27501509/526189

Bash – get file name and extension

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
filename=$(basename -- "$fullfile")
extension="${filename##*.}"
filename="${filename%.*}"
filename=$(basename -- "$fullfile") extension="${filename##*.}" filename="${filename%.*}"
filename=$(basename -- "$fullfile")
extension="${filename##*.}"
filename="${filename%.*}"

Source: https://stackoverflow.com/a/965072/526189


Posted

in

, ,

by

Tags: