How To Cache GPG Passphrase In Ubuntu

I got into Debian packaging and one of the most brutal part was to type in the GPG secret key’s password every time I sign a package. I wasted a lot of time typing my long password. I searched a lot to cache my password for some time after I type it once. All of them said to edit gpg-agent.conf, but none of them worked for my fresh installation of …

How To Install & Run Composer Binaries Globally

Take PHPUnit as an example. You can install it using Composer doing this : composer require phpunit/phpunit This will install a phpunit shortcut in vendor/bin directory. This obviously means you can run it. But, you would have to point to the exact location of the phpunit file to run :  /home/username/mysite/vendor/bin/phpunit phpunit.xml But, that’s long and uncomfortable. And you would have to install PHPUnit separately for each projects. I’m gonna…

Variables in Bash “: command not found”

Bash is like the very complicated language, even a space can make a syntax error. But, when you get into it often, you will get a hang of it and it will be easy. This post is a solution to one of the most common problems that happen to a newbie in Bash and it’s about a single whitespace. Here is a sample Bash file : a = 50 echo…

Append Contents to Files in Bash

In Bash, we can add contents to file easily using the > character. Like this : echo "myContents" > ~/myfile.txt What if you want to append contents to the file without overwriting ? The easiest way to do this is change the “>” to “>>”. Just by making this small change, appending will be done : echo "myContents" >> ~/myfile.txt Even if the file doesn’t exist, Bash will create one…

if, else, elif Conditions in Bash

All programming languages have the if & else conditions and they’re different in syntax according to each programming languages. In Bash, it’s really different and even a small space can cause syntax errors. So, you have to be careful while writing Bash code. In this post, I’ll give you many examples on how to use if and else conditions in Bash. if, else a="AC" if [ $a = "AC" ];…

Creating a File with Contents in Bash

It’s really easy to create a file in Bash with cat and > : cat "/home/simsu/file.txt" > "/home/simsu/file.txt" But, what if you want to add contents to file too ? In this case, we can use cat and echo. Here’s how we do it in echo : echo "My File, My Choice" > "/home/simsu/file.txt" But, there’s a problem with doing like this. Since there is an option to limit the…