alexanderdejong.com

Wordpress Developer

  • Home
  • Blog
  • Projects
  • Contact
You are here: Home / Archives for Linux

Linux SSH Useful Server Commands to Remember: Grep, Permissions and more.

Posted on May 2, 2017 Leave a Comment

Finding files

During theme adjustments I often have to figure out where things are. I often use this to search for divs or content in Theme files on my server:

$ grep -rnw '/srv/users/developer/apps/appname/public' -e "genesis_header"

MySQL Database related

The commands for import and export of database.

// For export we use:
$ mysqldump -p -u user dbname > filename.sql

// For import we use:
$ mysql -p -u user dbname < filename.sql

// Keep your database password ready, you will need it.

More commands to follow, comment below if you want me to add any other ones.

Filed Under: Linux Tagged With: grep, mysql, mysqldump, server, ssh

Bulk Rename Multiple File Names Completely With A Bash Script in Linux

Posted on September 28, 2015 Leave a Comment

Recently, I had to bulk rename about 50 file names in bulk on Ubuntu 14.04 LTS (Linux) and I was having a difficult time in finding a proper way to do this without the need for additional software. I checked out “Renamer” which is a good option if you would like to keep strings of text inside the original file name or for the more complicated bulk renaming. But in the end I found a good Bash script to get the work done.

All it does is change all jpg files in the current directory into a numerical progression from 1 to x.

Here is the bash script to bulk rename multiple file names (use Terminal in Linux):

#!/bin/sh
num=1
for file in *.jpg; do
       mv "$file" "$(printf "%u" $num).jpg"
       let num=$num+1
done

You can even add more information to your file names by changing the line:

mv "$file" "$(printf "%u" $num).jpg"

Just replace “filename” into whatever you need:

mv "$file" "filename-$(printf "%u" $num).jpg"

Good luck!

Filed Under: Linux

Recent Posts

  • Migrating a WordPress Website Manually with Phpmyadmin, Search and Replace, DigitalOcean and Runcloud
  • How to add Total Price Calculation to your WooCommerce Product Page with AJAX
  • How to Install Roots Bedrock on a Digital Ocean Droplet running on Serverpilot via SSH
  • Linux SSH Useful Server Commands to Remember: Grep, Permissions and more.
  • How to Install Roots Sage 8.5.1 on a Digital Ocean Droplet running on Serverpilot via SSH

Find more content

Affiliate links
  • cheap shared hosting
  • low priced virtual servers only 5$
Affiliates
  • If someone buys a product then I get a commission.
  • You pay the same price using my affiliate links.
  • I can spend more time making newsletters and tutorials.
  • Thanks for visiting!

Connect with me

Recent Comments

  • Pedro Gómez on Migrating a WordPress Website Manually with Phpmyadmin, Search and Replace, DigitalOcean and Runcloud
  • Tim Delmeire on How to add Total Price Calculation to your WooCommerce Product Page with AJAX
  • Jaehyuk J Yang on How to add Total Price Calculation to your WooCommerce Product Page with AJAX
  • Alexander de Jong on A guide on customising the membership experience with Theme my Login (TML)
  • Judit Sarkany on A guide on customising the membership experience with Theme my Login (TML)

Recent Posts

  • Migrating a WordPress Website Manually with Phpmyadmin, Search and Replace, DigitalOcean and Runcloud
  • How to add Total Price Calculation to your WooCommerce Product Page with AJAX
  • How to Install Roots Bedrock on a Digital Ocean Droplet running on Serverpilot via SSH
  • Linux SSH Useful Server Commands to Remember: Grep, Permissions and more.
  • How to Install Roots Sage 8.5.1 on a Digital Ocean Droplet running on Serverpilot via SSH

Copyright © 2014 | Alexander de Jong | About | Contact | Privacy | Sitemap