Linux: Difference between revisions
(Add Gnome tricks) |
(Adding a new USB disk to a virtual machine. Small formatting changes.) |
||
Line 17: | Line 17: | ||
<code>$ sudo ip route del default via 192.168.1.1</code> | <code>$ sudo ip route del default via 192.168.1.1</code> | ||
= chroot into a Raspberry Pi = | == chroot into a Raspberry Pi == | ||
== Mount sequence == | === Mount sequence === | ||
<pre> | <pre> | ||
Line 33: | Line 33: | ||
</pre> | </pre> | ||
== Doing stuff in chroot == | === Doing stuff in chroot === | ||
'''Example:''' Fixing a broken apt install | '''Example:''' Fixing a broken apt install | ||
Line 43: | Line 43: | ||
</pre> | </pre> | ||
== Unmount sequence == | === Unmount sequence === | ||
<pre> | <pre> | ||
Line 55: | Line 55: | ||
</pre> | </pre> | ||
= Gnome tricks = | == Gnome tricks == | ||
== Creating a desktop launcher on Gnome == | === Creating a desktop launcher on Gnome === | ||
Install '''gnome-panel''' | Install '''gnome-panel''' | ||
Line 73: | Line 73: | ||
= Trimming a video = | === Trimming a video === | ||
ffmpeg can be used to trim a video from a given start time to end time. | ffmpeg can be used to trim a video from a given start time to end time. | ||
Line 82: | Line 82: | ||
= Create ebook from a website using Calibre = | == Create ebook from a website using Calibre == | ||
Some free books on the internet are available as HTML pages. <br> | Some free books on the internet are available as HTML pages. <br> | ||
Line 93: | Line 93: | ||
</pre> | </pre> | ||
= X Window system tricks = | == X Window system tricks == | ||
== Switch to Colemak layout in X window system == | === Switch to Colemak layout in X window system === | ||
<pre> | <pre> | ||
setxkbmap us -variant colemak | setxkbmap us -variant colemak | ||
</pre> | </pre> | ||
== Natural scrolling == | === Natural scrolling === | ||
Run the following command, then logout and login. | Run the following command, then logout and login. | ||
<pre> | <pre> | ||
echo "pointer = 1 2 3 5 4 6 7 8 9 10 11 12" >> ~/.Xmodmap | echo "pointer = 1 2 3 5 4 6 7 8 9 10 11 12" >> ~/.Xmodmap | ||
</pre> | </pre> | ||
== VirtualBox tricks == | |||
=== Adding a new virtual USB disk to a virtual machine === | |||
* Enable USB controller for the virtual machine. This can be done from the VirtualBox UI. | |||
* Create a new virtual disk and add it using the USB controller. | |||
* Run this command as root inside the box. | |||
# mkfs.ext4 /dev/sdb |
Revision as of 03:57, 26 October 2018
Network Tricks
Connecting to two networks - one Wi-Fi and one wired
Wi-Fi network has internet, wired does not. Then, disable the gateway of the Wired network for internet access.
Show the networks
$ ip route show
Smaller metric number means higher priority for the gateway
Remove the gateway of the wired network
$ sudo ip route del default via 192.168.1.1
chroot into a Raspberry Pi
Mount sequence
mount /dev/sdb3 /mnt mount /dev/sdb2 /mnt/boot mount /dev/sdb1 /mnt/boot/firmware mount -o bind /proc /mnt/proc mount -o bind /sys /mnt/sys mount -o bind /dev /mnt/dev mount -o bind /dev/pts /mnt/dev/pts cp /usr/bin/qemu-arm-static /mnt/usr/bin chroot /mnt
Doing stuff in chroot
Example: Fixing a broken apt install
dpkg --configure -a apt -f install exit
Unmount sequence
umount /mnt/dev/pts umount /mnt/dev/ umount /mnt/sys umount /mnt/proc umount /mnt/boot/firmware umount /mnt/boot/ umount /mnt
Gnome tricks
Creating a desktop launcher on Gnome
Install gnome-panel
sudo apt-get install --no-install-recommends gnome-panel
Open the Create Launcher dialog and enter the details for the launcher
sudo gnome-desktop-item-edit --create-new /usr/share/applications
Done.
Trimming a video
ffmpeg can be used to trim a video from a given start time to end time.
ffmpeg -i video.webm -ss 00:00:00 -t 00:05:04 -async 1 video-cut.webm
Create ebook from a website using Calibre
Some free books on the internet are available as HTML pages.
An epub file is simply an archive of HTML pages that can be treated as an ebook.
A book website can be stitched into an ebook using wget
and calibre
wget -r --no-parent http://www.hpmor.com/ ebook-convert index.html hpmor.epub
X Window system tricks
Switch to Colemak layout in X window system
setxkbmap us -variant colemak
Natural scrolling
Run the following command, then logout and login.
echo "pointer = 1 2 3 5 4 6 7 8 9 10 11 12" >> ~/.Xmodmap
VirtualBox tricks
Adding a new virtual USB disk to a virtual machine
- Enable USB controller for the virtual machine. This can be done from the VirtualBox UI.
- Create a new virtual disk and add it using the USB controller.
- Run this command as root inside the box.
# mkfs.ext4 /dev/sdb