How to use the command qlmanage (with examples)
- Osx
- December 25, 2023
The qlmanage
command is a QuickLook server tool that allows users to interact with QuickLook, a feature in macOS that enables users to preview the content of a file without opening it. The qlmanage
command provides various options to display QuickLook for files, generate thumbnails, and reset QuickLook.
Use case 1: Display QuickLook for one or multiple files
Code:
qlmanage -p path/to/file1 path/to/file2 ...
Motivation:
Sometimes, we want to quickly preview the content of a file without opening it. Instead of manually navigating to the file and opening it with its default application, we can use the qlmanage
command to display QuickLook for one or multiple files.
Explanation:
qlmanage
: The command itself.-p
: An option to display QuickLook for the given files.path/to/file1 path/to/file2 ...
: The paths to the files for which we want to display QuickLook.
Example output: The QuickLook preview of the specified files will be displayed.
Use case 2: Compute 300px wide PNG thumbnails of all JPEGs in the current directory and put them in a directory
Code:
qlmanage *.jpg -t -s 300 path/to/directory
Motivation: Sometimes, we need to generate thumbnails of images for displaying them in a web application or other purposes. In this use case, we want to compute 300px wide PNG thumbnails of all JPEG images in the current directory and store them in a specific directory.
Explanation:
qlmanage
: The command itself.*.jpg
: A glob pattern to select all JPEG files in the current directory.-t
: An option to enable thumbnail generation.-s 300
: An option to set the width of the thumbnails to 300 pixels.path/to/directory
: The directory where the generated PNG thumbnails will be stored.
Example output: PNG thumbnails with a width of 300px will be generated for all JPEG files in the current directory and saved in the specified directory.
Use case 3: Reset QuickLook
Code:
qlmanage -r
Motivation: Sometimes, QuickLook may not work as expected due to internal issues or conflicts. In such cases, resetting QuickLook can help resolve these problems by restoring QuickLook to its default state.
Explanation:
qlmanage
: The command itself.-r
: An option to reset QuickLook.
Example output: QuickLook will be reset, and any issues or conflicts with QuickLook should be resolved.
Conclusion:
The qlmanage
command is a handy tool for managing QuickLook in macOS. Whether you want to display QuickLook for files, generate thumbnails, or reset QuickLook, qlmanage
provides the necessary functionality. By using the provided examples and explanations, you should now be able to effectively utilize the qlmanage
command in your macOS workflow.