TL/DR; I use the current time/date stamp in a file name from the command line. This requires typing out "$(date +"%y%m%d_%H%M%S")" as part of the filename. I would like to shorten this by using a variable or alias or something that requires less typing and memory (mine, not the PC's).
Longer explanation of my current usage:
I have a headless Ubuntu 20.04 server that I access via ssh. The server uses only the BTRFS file system. I am in the habit of taking a manual snapshot before updating. BTRFS snapshots keep the time stamp of the source subvolume, which is useful because it definitively shows which subvolume was the source, however knowing when the snapshot was taken is also important. The obvious solution is to use a date/time in the filename thus recording the time of the snapshot while still retaining the source subvolume date. I know I can script the entire command, which I may do anyway, but knowing a good shortcut to doing this would be useful in many ways for me.
Here's the snapshot command I use:
I would like to replace "$(date +"%y%m%d_%H%M%S")" with something like "$now"
Longer explanation of my current usage:
I have a headless Ubuntu 20.04 server that I access via ssh. The server uses only the BTRFS file system. I am in the habit of taking a manual snapshot before updating. BTRFS snapshots keep the time stamp of the source subvolume, which is useful because it definitively shows which subvolume was the source, however knowing when the snapshot was taken is also important. The obvious solution is to use a date/time in the filename thus recording the time of the snapshot while still retaining the source subvolume date. I know I can script the entire command, which I may do anyway, but knowing a good shortcut to doing this would be useful in many ways for me.
Here's the snapshot command I use:
Code:
sudo btrfs su sn /mnt/install/@Ubuntu_Server_2004/ /mnt/install/@Ubuntu_Server_2004_"$(date +"%y%m%d_%H%M%S")"
Comment