Mount disk and install grub boot loader
1 2 |
mount /dev/sdX /mnt grub-install --boot-directory=/mnt/boot /dev/sdX |
Mount disk and install grub boot loader
1 2 |
mount /dev/sdX /mnt grub-install --boot-directory=/mnt/boot /dev/sdX |
Delete all lines of a file containing a regex pattern using sed. For example you can delete all commented lines of a default configuration file. Take a look on my basic regex cheat sheet
1 |
sed -i '/regexPattern/d' path/to/file1.log |
Replace a string with a new one in all files using sed and xargs
1 2 3 |
oldstring="some_string_to_search" newstring="new_string_to_replace" grep -rl $oldstring /path/dir/ | xargs sed -i s@$oldstring@$newstring@g |
Comment specific line using sed command can be used to configuration files …
1 |
sed -i '123 s/^/#/' filename |
Find ulimit -a for other users that don’t have shell access using su command and ulimit attaching a bash shell
1 |
su www-data --shell /bin/bash --command "ulimit -a" |
Merge multiple PDF files in Linux is easy running one simple command by using PDF Toolkit. Installation on Ubuntu > 16.04:
1 |
apt install pdftk |
Merge multiple pdf files: In this example we have n pdf files in the same directory, each file has the prefix sample-pdf-. The command below will merge n number of pdf files, using […]
By using the PDF Toolkit PDFtk library you can do this simple pdf editing task and many more. For all of you creating software related to PDF documents you should really spend some time reading about PDFtk server. Installation:
1 |
apt install pdftk |
Usage: In this example we have two pdf files with 10 pages each. The command […]
ImageMagick is an awesome image manipulation tool. It provides an command-line API for literally hundreds of functionalities related to image editing. Every now and then I need to apply watermarks to my images before posting them somewhere online, in public. GIMP, has one or two scripts which extend its functionalities but there’s no neat way […]