Tips &Tricks Blog

0

Bash scripting missing ‘]’

If you have the simple script like the following : #!/bin/bash if [ $foo = ‘bar’]; then echo ‘Foo is equal to bar’ fi And when you run the script, if you get the...

npm list available versions of a package 1

npm list available versions of a package

As an example, to check which versions of expressjs are available on npm, you do the following npm info express versions Of course, you can always grep for the version you are looking for...

0

grep for a word in all files in linux

The following command will search for the string “hello” in the content of all the files within all subfolders of the specified path grep -r “hello” /path/to/search/

0

Error: listen EADDRINUSE

EADDRINUSE – stands for error: address already in use. It means you have a server listening on the same port. To solve this problem you have to kill the process running on that port....

0

How to create scripts in terminal

Follow three simple steps to automate your terminal. Create a script Set the permissions Execute the script Create a script test.sh $vi test.sh ls -la echo ‘Hello Bash!’ Set the permissions $sudo chmod 777...

0

How to create a permanent “alias”?

Follow three simple steps to create alias for your command line. cd ls -la vi .bashrc Append your favorite alias at the bottom of the file. Below are some of my favorite aliases. #...

0

[: !=: unary operator expected

In bash, always use the double bracket conditional command [[ … ]] For example, #!/bin/bash sex=male if [[ $sex == ‘male’ ]];then echo “sex is male.” elif [[ $sex == ‘female’ ]];then echo “sex...