Skip to content

Command

Reduce PDF Size with Ghostscript
shell
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed_PDF_file.pdf input_PDF_file.pdf
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed_PDF_file.pdf input_PDF_file.pdf

The dPDFSETTINGS parameter is what defines the compression level and so the quality of your compressed PDF file.

The possibles values for dPDFSETTINGS are:

/prepress -> Higher quality (300 dpi) but bigger size

/ebook -> Medium quality (150 dpi) with moderate output file size

/screen -> Lower quality (72 dpi) but smallest possible output file size

The /prepress is the default option if you don’t specify any options.

Merge PDF with GhostScript
shell
gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=outputFile.pdf fileToMerge1.pdf fileToMerge2.pdf fileToMerge3.pdf
gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=outputFile.pdf fileToMerge1.pdf fileToMerge2.pdf fileToMerge3.pdf

The dPDFSETTINGS parameter is what defines the compression level and so the quality of your compressed PDF file.

The possibles values for dPDFSETTINGS are:

/prepress -> Higher quality (300 dpi) but bigger size

/ebook -> Medium quality (150 dpi) with moderate output file size

/screen -> Lower quality (72 dpi) but smallest possible output file size

The /prepress is the default option if you don’t specify any options.

Convert JPG to PDF with ImageMagick
shell
convert -density 300 fileToConvert.jpg outputFile.pdf
convert -density 300 fileToConvert.jpg outputFile.pdf

-density specify the dpi that the PDF is rendered. Placing this to 300/600 will give pretty good quality for your PDF file.

Move a file
shell
mv -v fileToMove destinationForTheFile
mv -v fileToMove destinationForTheFile
Rename a file
shell
mv fileToRename newNameOfFile
mv fileToRename newNameOfFile
Execute a script .sh
shell
zsh my-script.sh or ./my-script.sh
zsh my-script.sh or ./my-script.sh
Copy a file
shell
cp sourceFile destinationFile
-r for recursive
cp sourceFile destinationFile
-r for recursive
Remove a file or directory
shell
rm fileToRemove
-Rf for recursive with force
rm fileToRemove
-Rf for recursive with force
Making a directory or file
shell
mkdir myDirectory
touch myFile
mkdir myDirectory
touch myFile
Display Manjaro version
shell
lsb_release -drc
lsb_release -drc
Grep search
shell
cat myFile | grep "my research"
cat myFile | grep "my research"
Display where am i
shell
pwd
pwd
Display all service on system
shell
systemctl list-units --all
systemctl list-units --all