Web & Software Developer

Archive for “Bash, Shell, Terminal, Command Line”

Shell commands for command prompt (command line) and ssh terminal commands and code snippets.

Bash Shell Script To Bulk Optimize Images With TinyPNG API

Bash Shell Script To Bulk Optimize Images With TinyPNG API

This is a bash shell script that will optimize and compresses all JPG, JPEG, and PNG images in a local directory with the TinyPNG API. It will optimize images with these extensions: .png, .PNG, .jpg, .JPG, .jpeg, and .JPEG. The script will not modify or delete your existing images. It will simply create an optimized […]

Reset MySQL root password in Ubuntu/Linux Command Line

These are the terminal commands to reset your MySQL password for your “root” user. This is useful if you forgot your MySQL password on your local LAMP server. This is a fix for errors like these: ERROR 1045: Access denied for user: ‘root@localhost’ (Using password: NO) ERROR 1045: Access denied for user: ‘root@localhost’ (Using password: […]

Resume Extracting .tar.gz File That Terminated Before Finishing

If you are extracting a very large .tar.gz file, the process can be terminated before it finishes. This can sometimes help: Run the command again, but add the -k flag so that it will skip over any files that have already been extracted. So if you were extracting sample.tar.gz, like this: Then, after it gets […]

Transfer Files From Server to Server via Terminal

This is a quick way to transfer or move files from one server to another server via the command line. This uses SSH. Before you begin, make sure your web host allows SSH connections. Some hosts require that you first enable SSH before they give you access. This works in a linux terminal (or PuTTY […]

Check if PHP exec() is Working on Your Ubuntu 14.04 LAMP Server

To check if the PHP exec() function is working on your local LAMP server, paste this in the terminal: Then, navigate in your browser to your http://localhost/whomi.php. You should see “whoim = ” and the user who executed the script. If you see this, then the PHP exec() function is working. If you don’t see […]

Create a PHP info Test Page in Linux Terminal

This will create a PHP info page so that you can test if your PHP server is working. This test file will be created quickly using the command line. Open a terminal and type: Open your web browser and type in the address bar “localhost/test.php” and press ‘enter’. You should see the PHP Info page. […]