Tricks
Set a Python script as the default program to open .pcd
files
.pcd
filesWith this setup, you can open/view any .pcd
point cloud file by just double clicking the mouse.
Prepare a script that takes filename as the first argument.
for example, running command
pcd_viewer.py example.pcd
can open the pcd file.remember to add executable permission
sudo chmod +x pcd_viewer.py
.
Create a MIME type for
.pcd
files.open the file
/etc/mime.types
and add a lineapplication/x-pcd pcd
,such that files with extension
.pcd
can be recognized as the MIME typeapplication/x-pcd
.
Create a
pcd-viewer.desktop
file to link/associate the program to the designated MIME type.set the execution path to the prepared python script, and add
%u
to help pass the argumentadd a line
MimeType=application/x-pcd
to declare that this app can handle this MIME typeplace this file in
/usr/share/applications
if you plan to make it work for all usersplace this file in
~/.local/share/applications
for only the current userwith this file set properly, you can see it in the "Open with" menu after right click (please verify this before moving forward; it would not show up if
%u
is not added or the path is not valid)
Set this application as the default program for
.pcd
files.option one: right click an
.pcd
file and select PCD Viewer; it will remember the last program as the default one to open it in the future.option two: open the file
/usr/share/applications/defaults.list
and add a lineapplication/x-pcd=pcd-viewer.desktop
; this will force it to use PCD Viewer at all time.note: creating a
defaults.list
at~/.local/share/applications
would not work.To make it work immediately you can run
sudo update-desktop-database
after the changes.
Reference: Ubuntu – Make shell script default to run file extension
Set Snap Store applications as the default program
The same approach can be applied to applications installed from Snap Store.
Run
snap list
to see all applications installed from Snap Store.Run
echo $XDG_DATA_DIRS
to check the env path for all installed applications.Their
.desktop
files are placed at/var/lib/snapd/desktop/applications/
.
Just two steps needed:
Register .pcd as the MIME type if not done yet. (Similar to the Step 2 to set up a python script as the default program.)
Place the following .desktop file under
~/.local/share/applications
.
Reference: Launchers for installed snap applications
Auto start a program/script when the system boots
If sudo
privilege is required, we will need three files; otherwise two files. The usage is the following.
Prepare the script you plan to run as the system starts, named
launch.sh
for example.If root privilege is needed, prepare a file named
root.sh
to run thelaunch.sh
file.Prepare a
launch.desktop
file to runlaunch.sh
orroot.sh
script. Place this file in~/.config/autostart/
folder.Reboot the computer and you will see the program running automatically as the system starts.
Reference: Cruiser-OnboardROS autostart
Mount USB Drive in Remote Sessions without Root Privilege
When working on GUI desktop (with monitor, mouse and keyboard), if you plug in a USB flash drive or SD card, it will get mounted automatically and file manager will prompt out. The mounting point is at
/media/<username>/<usb-drive-id>
.In remote login sessions (where you only have ssh terminals), if you plug in a USB flash drive, nothing happens. You have to mount it manually by the
mount
command withsudo
.
The drawback of this operation is that, you have to use
sudo
for all write operations in this directory later on, because the owner is root rather than the current user. The solution is to mount it byudisks
command instead. (Actually in GUI desktop, nautilus file manager does this for you.)
Reference: CLI mounting vs. GUI mounting
Secure Erase a Portable SSD
For SanDisk SSD, there is an official software: SanDisk SSD Dashboard
This software installer requires network connection to install. (~100MB)
"Secure Erase is different from Sanitize because it only deletes the mapping table but will not erase all blocks that have been written to. Sanitize will delete the mapping table and will erase all blocks that have been written to. Therefore, Secure Erase is faster to complete than Sanitize."
There may not be a secure erase option available for some models of SSD. (e.g., not available for my Extreme PRO 4TB)
Secure Erase under Windows
For HDD
DBAN: Short for Darik’s Boot and Nuke, DBAN has been around for years and is a well-known and trusted drive wipe utility for HDDs. It does multiple pass rewrites (binary ones and zeros) on the disk. You’ll need to download it to a USB drive and run it from there.
Disk Wipe: Disk Wipe is another free utility that does multiple rewrites of binary data. You can choose from a number of different methods for overwriting your disk. Disk Wipe is also portable, so you don’t need to install it to use it.
Eraser: Eraser is also free to use. It gives you the most control over how you erase your disk. Like Disk Wipe, you can choose from different methods that include varying numbers of rewrites, or you can define your own.
For SSD
Parted Magic: Parted Magic is the most regularly recommended third-party erase tool for SSDs, but it does cost $13. It’s a bootable tool like some of the HDD erase tools—you have to download it to a USB drive and run it from there. (Note: there might be some executable available for download at 3rd party websites.)
ATA Secure Erase: ATA Secure Erase is a command that basically shocks your SSD. It uses a voltage spike to flush stored electrons. While this sounds damaging (and it does cause some wear), it’s perfectly safe. It doesn’t overwrite the data like other secure erase tools, so there’s actually less damage done to the SSD.
Secure Erase under Linux
Option One: Using Parted Magic
Download a ISO image from some 3rd party software website for free.
Create a new VM in VMware using this image.
Forward SSD to this Parted Magic VM and perform secure erase.
Option Two: Command-line Simple Secure Erase
sudo hdparm -I /dev/sdX
Displays all information about a drive.sudo hdparm ––security-erase PASS /dev/sdX
Simple command to secure erase a drive with no hassle.sudo hdparm ––user-master u ––security-set-pass PASS /dev/sdX
Sets a password.sudo hdparm ––user-master u ––security-erase PASS /dev/sdX
Securely erases the SSD.
More information for Option Two: check this article.
References: SanDisk Dashboard Support Information; Getting Rid of Your PC? Here’s How to Wipe a Windows SSD or Hard Drive; Securely Erasing Your SSD with Linux: A How-To; Perform a SSD Secure Erase
Increase Swap Space
Normally, it is safe to increase your swap size to match the RAM size. For example, if you RAM size is 16GB, you can increase the swap size to be 16GB as well.
References: AskUbuntu: How to increase swap space?; How To Add Swap Space on Ubuntu 20.04
Last updated