You can check the contents of the /backup
directory in your WHM terminal using a few different commands, depending on how much detail you want. Here’s a breakdown of the most useful options:
1. Basic Listing:
Bash
ls /backup
This will give you a simple list of the files and directories within /backup
. It’s good for a quick overview.
2. Detailed Listing (Recommended):
Bash
ls -l /backup
This is the most commonly used command. The -l
(lowercase L) option provides a long listing, showing:
- File permissions: (e.g.,
-rw-r--r--
) - Number of links: (usually not important for backups)
- Owner: (usually
root
) - Group: (usually
root
) - File size: (in bytes)
- Last modified date and time: Crucial for identifying recent backups
- Filename:
3. Human-Readable File Sizes:
Bash
ls -lh /backup
This is the same as ls -l
but adds the -h
option, which makes file sizes “human-readable” (e.g., 1K, 10M, 2G instead of bytes). Much easier to understand. This is probably the best option for most cases.
4. Listing Subdirectories:
If your backups are organized into subdirectories (e.g., by date), and you want to see what’s inside those subdirectories, you can use:
Bash
ls -lR /backup
The -R
(uppercase R) option makes the listing recursive, meaning it will show the contents of all subdirectories as well. Be careful with this if you have a lot of backups, as it can produce a very long output. You can use -lhR
for human-readable sizes as well.
5. Filtering by File Type:
If you’re looking for specific types of backup files (e.g., .tar.gz
archives), you can use grep
:
Bash
ls -lh /backup | grep .tar.gz
This will list all files in /backup
(with details and human-readable sizes) and then filter the output to show only lines containing .tar.gz
. You can replace .tar.gz
with any other file extension or part of a filename.
6. Sorting by Date (Most Recent First):
Bash
ls -lhtr /backup
This is extremely useful. The -t
option sorts by modification time, and the -r
option reverses the order, so the most recently modified files (your newest backups) will be at the top. Combine with -lh
for human-readable sizes.
Example (Combining Options):
Bash
ls -lhtr /backup | grep cpmove # Lists cpmove archives, sorted by date (newest first), with human-readable sizes.
Important Considerations:
- Permissions: Make sure you have the necessary permissions to access the
/backup
directory. You’ll likely need to be root or usesudo
. - Disk Space: Be mindful of disk space, especially if you’re using the recursive listing (
-R
) option. - WHM Interface: While using the command line is powerful, WHM itself often provides a user-friendly interface for managing and viewing backups. Check the WHM Backup section for easier navigation.
Remember to replace /backup
with the actual path to your backup directory if it’s different. Using the appropriate combination of these ls
options and grep
will help you quickly find the information you need about your backups.