-bash: fork: Cannot allocate memory

I also faced this issue with my Ubuntu 14.04 desktop. Even these basic command showed Can’t allocate memory error. On investigating, found that system is using all the memory for Caching and is not freeing up memory. This is called Cache Ballooning and solved this by clearing the cache.

Create timestamp variable in bash script

In order to get the current timestamp and not the time of when a fixed variable is defined, the trick is to use a function and not a variable: If you don’t like the format given by the %T specifier you can combine the other time conversion specifiers accepted by date. For GNU date, you can find the complete list of … Read more

Getting an “ambiguous redirect” error

Bash can be pretty obtuse sometimes. The following commands all return different error messages for basically the same error: Adding quotes around the variable seems to be a good way to deal with the “ambiguous redirect” message: You tend to get a better message when you’ve made a typing mistake — and when the error … Read more

bash : Bad Substitution

The default shell (/bin/sh) under Ubuntu points to dash, not bash. So if you chmod +x your_script_file.sh and then run it with ./your_script_file.sh, or if you run it with bash your_script_file.sh, it should work fine. Running it with sh your_script_file.sh will not work because the hashbang line will be ignored and the script will be … Read more

Laravel PHP Command Not Found

Ok, I did that and it works: And paste do source ~/.bash_profile and enjoy 😉 Important: If you want to know the difference between bash_profile and bashrc please check this link Note: For Ubuntu 16.04 running laravel 5.1, the path is: ~/.config/composer/vendor/bin On other platforms: To check where your Composer global directory is, run composer global about. Add /vendor/bin to the directory that gets listed after “Changed … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)