Problem
You would like to have a list of all the services (running and stopped) in a debian system.
Solution
You can run the following to see the list of services:
service --status-all
Problem
You would like to have a list of all the services (running and stopped) in a debian system.
Solution
You can run the following to see the list of services:
service --status-all
Problem
You want to export a MySQL database table as a csv with something like:
mysql> select * from table_name into outfile '/tmp/table_name.csv';
but you get the error that MySQL cannot execute this command.
Solution
Find out the location that MySQL can use to export files by running the following:
mysql> show variables like 'secure_file_priv'; +------------------+-----------------------+ | Variable_name | Value | +------------------+-----------------------+ | secure_file_priv | /var/lib/mysql-files/ | +------------------+-----------------------+ 1 row in set (0.00 sec)
and then use the path to change the outfile path (ie /var/lib/mysql-files/table_name.csv).
Taken from the answer here
Problem
You have made some changes to the NGINX configuration and you would like to reload them without stopping and starting the server.
Solution
Use the following:
kill -HUP $(cat /var/run/nginx.pid)
Problem
You are trying to install the dependencies in a PHP Symfony project, but you get an error about enable extensions in ini files.
Solution
Make sure that you install the correct packages for the PHP version you are using. So installing php-curl while using PHP 7.1 results in the error.
When installing php7.1-curl the installation completes successfuly.
Problem
You have used ‘Bring your own node’ to use a server with one account, but you want to change the account and move the node to the new one.
Solution
Use your old account to terminate the node or login to the server and use the following to stop the running dockercloud-agent:
sudo service dockercloud-agent stop
Go to the Docker Cloud web ui interface, and use the 'Bring your own node'. Copy the token that appears after the sudo -H sh -s on the popup window.
On the server update the token with the one from the new account that you just copied, by running the following:
sudo dockercloud-agent set Token=xxxxx_new_token_xxxx
And now restart the dockercloud-agent on the server:
sudo dockercloud-agent restart
You should now be able to see 'Node xxxx detected' on the Docker Cloud web ui after a couple of minutes.
Problem
You would like to quickly copy a file from the local host to the vagrant machine.
Solution
Find the private key, ssh and IP port with ssh-config:
$ vagrant ssh-config Host default HostName 127.0.0.1 User vagrant Port 2222 UserKnownHostsFile /dev/null StrictHostKeyChecking no PasswordAuthentication no IdentityFile /path/to/private/key IdentitiesOnly yes LogLevel FATAL
Copy the file using the private key as a parameter to scp:
scp -P 2222 -i /path/to/private/key /path/to/file vagrant@127.0.0.1:~
Taken from the answer here
Problem
You want to create a MySQL table that contains spaces, but when you try you get the following error message:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-afterdash' at line 1
Solution
Use the backticks to create the table:
mysql> create database `table-afterdash`; Query OK, 1 row affected (0.00 sec)
Problem
You have defined a variable in a bash script (ie MY_FOLDER) but you also want to dynamically get the parent folder (ie MY_FOLDER can have multiple values).
Solution
Use the dirname as in the following
MY_FOLDER=/home/user/first_folder/second_folder MY_PARENT_FOLDER=$(dirname $MY_FOLDER) echo $MY_FOLDER echo $MY_PARENT_FOLDER ....... /home/user/first_folder/second_folder /home/user/first_folder
Problem
You would like to remove some lines from the bash history (ie using cut and paste with wrong values).
Solution
You can use the following, taken from the answer here
for i in {1..no_of_lines}; do history -d start_line; done
where start_line is the start of the lines you want to remove and no_of_lines is the number of lines you want to be removed.
Problem
You would like to run a migration in a symfony 2x project either up or down.
Solution
You can run the following for getting a migration up or down:
php app/console doctrine:migrations:execute 20171020125225 --up php app/console doctrine:migrations:execute 20171020125225 --down