- systemd by example
The playground allows you to learn about systemd interactively, right from your browser! Create examples without the danger of breaking your system, and without being distracted by hundreds of unrelated unit files.
Mounting external NTFS disk R/W under Linux
After following the instructions here to mount an external disk with NTFS read/write on Debian and failing (after adding to /etc/fstab and rebooting, the disk was still being mounted read-only): https://wiki.debian.org/NTFS
According to this StackExchange entry, the disk had first to be mounted on Windows and the “write caching” disabled: https://unix.stackexchange.com/questions/436712/write-access-to-ntfs-drives
Add user to secondary group
For example, to add the user
geekto the group
sudo, use the following command:
usermod -a -G sudo geek
Source: How-To Geek
Show disks/partitions (incl. unmounted)
Source: 6 Different Ways to List Hard Drives in Linux
Wake up computer at a specified time
The rtcwake command requires root permissions, so it must be run with sudo on Ubuntu and other Ubuntu-derived distributions. On Linux distributions that don’t use sudo, you’ll have to log in as root with the su command first.
Here’s the basic syntax of the command:
sudo rtcwake -m [type of suspend] -s [number of seconds]
For example, the following command suspends your system to disk (hibernates it) and wakes it up 60 seconds later:
sudo rtcwake -m disk -s 60
The -m switch accepts the following types of suspend:
standby – Standby offers little power savings, but restoring to a running system is very quick. This is the default mode if you omit the -m switch.
mem – Suspend to RAM. This offers significant power savings – everything is put into a low-power state, except your RAM. The contents of your memory are preserved.
disk – Suspend to disk. The contents of your memory are written to disk and your computer is powered off. The computer will turn on and its state will be restored when the timer completes.
off – Turn the computer off completely. rtcwake’s man page notes that restoring from “off” isn’t officially supported by the ACPI specification, but this works with many computers anyway.
no – Don’t suspend the computer immediately, just set the wakeup time. For example, you could tell your computer to wake up at 6am. After that, can put it to sleep manually at 11pm or 1am – either way, it will wake up at 6am.
Seconds vs. Specific Time
The -s option takes a number of seconds in the future. For example, -s 60 wakes your computer up in 60 seconds, while -s 3600 wakes your computer up in an hour.
The -t option allows you to wake your computer up at a specific time. This switch wants a number of seconds since the Unix epoch (00:00:00 UTC on January 1, 1970). To easily provide the correct number of seconds, combine the date command with the rtcwake command.
The -l switch tells rtcwake that the hardware clock is set to local time, while the -u switch tells rtcwake that the hardware clock (in your computer’s BIOS) is set to UTC time. Linux distributions often set your hardware clock to UTC time and translate that to your local time.
For example, to have your computer wake up at 6:30am tomorrow but not suspend immediately (assuming your hardware clock is set to local time), run the following command:
sudo rtcwake -m no -l -t $(date +%s -d ‘tomorrow 06:30’)
Source: How to Make Your Linux PC Wake From Sleep Automatically