Linux
Link
https://www.linuxfoundation.org/
[FOSS](…/Open source/) [operating system](…/Operating systems/) kernel
See also
Resources
- GParted
GParted is a free partition editor for graphically managing your disk partitions.
- freedesktop.org - specifications (previously “XDG”)
FAQ
Remove one distro from dual-boot system
- Mount the EFI partition
- Remove the folder belonging to the distro to be removed, e.g.
rm -rf /boot/efi/EFI/fedora
- Run:
efibootmgr
- Identify the number before the distro to be removed, and use it in the following command (leading zeros can be omitted):
efibootmgr -b NUMBER -B
- Use
gparted
,fdisk
etc. to remove the partition(s) belonging to the distro to be removed
What started a running program
- Find the process ID (PID) of the program:
ps aux | grep my_program
- Find the parent PID:
ps -o ppid= -p 12345
- Find the name of the parent:
ps aux | grep PPID
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
geek
to the groupsudo
, use the following command:usermod -a -G sudo geek
Source: How-To Geek
Show disks/partitions (incl. unmounted)
lsblk
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
Avoid “^[[200~” when pasting into the terminal
- This happens when one accidentally types
Ctrl
+V
before typing the correct combination,Ctrl
+Shift
+V
. - To prevent this, enter the following line into
~/.inputrc
, creating that file if necessary:"\C-v": ""
- Source
Why do I have to type ~, ` and other special characters twice?
- Switch to the “no dead keys” variant of your international keyboard.
- Source
Fix “manpath: can’t set the locale; make sure $LC_* and $LANG are correct”
- Edit
/etc/locale.gen
as root and remove the hashtag before the desired language - Run
sudo locale-gen
- Source
Find out whether the laptop is on AC power, from the CLI
cat /sys/class/power_supply/**/online
- A value of 1 means “on AC power”, 0 means “on battery”
How to enable fingerprint scanner support
Cannot select text with Ctrl
+Shift
in some apps
- Switching keyboard layout from “Danish” to “Danish (Windows)” fixed this for me.