How to Find Application Folders in Cloudways
When connecting to the file system via SSH, Cloudways’ randomly created application folder names can be confusing. We have produced a shell script to tackle this issue, which will allow you to quickly determine which folder is associated with which application. Let’s take a closer look at the issue.
Both Cloudways’ UI and infrastructure are easy to use. Because the program names are issued randomly, it can be challenging for users to determine which folder belongs to which application while connecting to the file system over SSH. Facilitating the distinction between different uses It can take a while to search through folders within the file system to locate the correct program when you connect to your server using SSH.
This script looks through all of the application folders on your Cloudways server, enters each folder’s public_html directory, and uses WP-CLI to retrieve the URL of the pertinent website. You can quickly determine which folder is associated with which website in this way.
How Are Shell Scripts Operated?
By putting the script below on your Cloudways server, you can run it:
#!/bin/bash # Define the base directory BASE_DIR="/home/master/applications" # Replace with the actual path to your applications directory # Navigate to the base directory cd "$BASE_DIR" || exit # Loop through each folder in the base directory for folder in */ ; do # Trim the trailing slash from the folder name folder_name="${folder%/}" # Define the path to the public_html folder public_html_path="$BASE_DIR/$folder_name/public_html" # Check if the public_html folder exists if [ -d "$public_html_path" ]; then # Navigate to the public_html folder cd "$public_html_path" || continue # Get the site URL using WP-CLI site_url=$(wp option get siteurl) # Print the folder name and site URL echo "Folder: $folder_name" echo "Site URL: $site_url" echo "------------------------" else echo "Folder: $folder_name" echo "public_html directory not found." echo "------------------------" fi # Navigate back to the base directory cd "$BASE_DIR" || exit done
Step-by-Step Setup:
- Connect to your server via SSH.
- Save the script above to a file, e.g., find_applications.sh.
- Make the file executable:
chmod +x find_applications.sh
- Run the script:
./find_applications.sh
You will see each folder name and the URL of the corresponding application once the script has run. This will make it simple for you to determine which folder is associated with which program.
The random folder name on the Cloudways platform can be a productivity killer if you handle several applications. It will be lot quicker and simpler to determine which folder each application is in on your server, though, with the help of this straightforward shell script. You’ll manage your file system more effectively and save time.