free -m
to see memory statistics
df -h
to see disk usage statistics
du -h --max-depth=1 | sort -hr
ls -ld .?*
Will only list hidden files
ls -a
List All Files
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
sudo ufw app list
for f in * ; do mv -- "$f" "$(tr [:lower:] [:upper:] <<< "$f")" ; done
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
mysql -u username -p database_name < file.sql
Stop MySQL
sudo service mysql stop
Make MySQL service directory.
sudo mkdir /var/run/mysqld
Give MySQL user permission to write to the service directory.
sudo chown mysql: /var/run/mysqld
Start MySQL manually, without permission checks or networking.
sudo mysqld_safe --skip-grant-tables --skip-networking &
Log in without a password.
mysql -uroot mysql
Update the password for the root user.
UPDATE mysql.user SET authentication_string=PASSWORD('YOURNEWPASSWORD'), plugin='mysql_native_password' WHERE User='root' AND Host='%'; EXIT;
Turn off MySQL.
sudo mysqladmin -S /var/run/mysqld/mysqld.sock shutdown
Start the MySQL service normally.
sudo service mysql start
Use n module
from npm in order to upgrade node
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/<VERSION>/bin/node /usr/bin/nodejs
(NOTICE that the default installation for nodejs is in the /usr/bin/nodejs
and not /usr/bin/node
)
To upgrade to latest version (and not current stable) version, you can use
sudo n latest
To undo:
sudo apt-get install --reinstall nodejs-legacy
# fix /usr/bin/node
sudo n rm 6.0.0
# replace number with version of Node that was installed
sudo npm uninstall -g n
sudo ps wwaux | grep php7-fpm