Using Xephyr

$ Xephyr -ac -screen 800x600 -reset :1 & -ac : Disables access control restrictions and allows to forward the session -screen : sets the resolution of the new X session. Set it according to your need. -:1 : This specifies that the new X session is display number “1“. Your current Display is most probably “0“ -reset: Resets the X server when the last X client is closed. The Xephyr should start and you will get a blank new window....

Unzipping a problematic archive

Nice little tip for unzipping problematic archives (.zip) from AskUbuntu.com. I downloaded a .zip archive and could not for the life of me unzip. I tried gunzip and unzip – both failed with the following errors: Gunzip $ gunzip foo.gzip gzip: foo.gzip: unknown suffix -- ignored Unzip $ unzip foo.zip Archive: foo.zip End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive....

Config

Boot Kernel Command Line On boot systemd activates (by default), the target unit default.target whose job is to activate services and other units by pulling them in via dependencies. To override the unit to activate, systemd parses its own kernel command line arguments via the systemd.unit= command line option. This may be used to temporarily boot into a different boot unit. The classical run-levels are replaced as following: systemd.unit=rescue.target is a special target unit for setting up the base system and a rescue shell (similar to run level 1) systemd....

Commands

replace symlinks for i in *; do link=$(readlink $i) && rm $i && mv $link $i; done permissions find /home/user -type d -print0 | xargs -0 chmod 0775 find /home/user -type f -print0 | xargs -0 chmod 0664 clean up dconf For a single key: dconf reset "/path/to/the/key" Must not end with a /. For a whole path: dconf reset -f "/path/to/the/path/" Must end with a /. If you do this while having dconf-editor opened, it will likely crash....

Images

pdfimages pdfimages -j foo.pdf bar This will extract all images from foo.pdf and save them in JPEG format (option -j) to bar-000.jpg, bar-001.jpg, bar-002.jpg, etc. delete metadata exiftool -exif:all= *.jpg exiftool -xmp:all= *.jpg or use MAT: Metadata Anonymisation Toolkit https://0xacab.org/jvoisin/mat2

Western Digital GreenPower Disks

WD GreenPower disks have some problems under Linux with their “head parking” feature parking the head every 8 seconds. This destroys the disk over a short time span. For Linux, there’s idle3ctl from the idle3-tools. You can display the current value with the following command: $ sudo ./idle3ctl -g /dev/sdX Idle3 timer set to 80 (0x50) The value 80 means 8 seconds (default). From 1-128, the values mean 1/10th of a second, e....

rtmpsrv

rtmpsrv allows you to get all parameters that are required by rtmpdump. You don’t need packet sniffers or complex analysis to use rtmpdump when using rtmpsrv. The only problem you may have is when a video consists of several segments (chapters). In such cases just skip to the next chapter. How to compile rtmpdump with rtmpsrv and rtmpsuck in Linux: svn checkout svn://svn.mplayerhq.hu/rtmpdump/trunk rtmpdump cd rtmpdump make linux How to use rtmpsrv in Linux: Configure your firewall to redirect RTMP traffic through a local port:...

ATA Secure Erase (SE) and hdparm

Warning The instructions below will irretrievably destroy data. Moreover, as the hdparm manpage explains, “these switches are DANGEROUS to experiment with, and might not work with every kernel. USE AT YOUR OWN RISK.” Explanation According to National Institute of Standards and Technology (NIST) Special Publication 800-88: Guidelines for Media Sanitization, Secure Erase is “An overwrite technology using firmware based process to overwrite a hard drive. Is a drive command defined in the ANSI ATA and SCSI disk drive interface specifications, which runs inside drive hardware....

LVM

shrink lvm # Unmount the filesystem and check its' LV umount /mnt/foo e2fsck -f /dev/mapper/vg0-foo # Shrink ext4 and then the LV to the desired size resize2fs -p /dev/mapper/vg0-foo 40G lvreduce -L 40G /dev/mapper/vg0-foo # Before continuing, run e2fsck. If it bails because the partition # is too small, don't panic! The LV can still be extended with # lvextend until e2fsck succeeds, e.g.: # lvextend -L +1G /dev/mapper/vg0-foo e2fsck -f /dev/mapper/vg0-foo # Resize the filesystem to match the LVs size, check and mount it resize2fs -p /dev/mapper/vg0-foo e2fsck -f /dev/mapper/vg0-foo mount /mnt/foo expand lvm umount /mnt/bar # Extend the LV to use all free space lvextend -l +100%FREE /dev/mapper/vg0-bar e2fsck -f /dev/mapper/vg0-bar # Resize the partition to fill the LV resize2fs -p /dev/mapper/vg0-bar e2fsck -f /dev/mapper/vg0-bar mount /mnt/bar expand luks encrypted filesystems umount /crypto e2fsck -f /dev/mapper/crypto cryptsetup luksClose crypto lvextend -L +100M /dev/cryptovg/crypto cryptsetup luksOpen /dev/cryptovg/crypto crypto cryptsetup -v resize crypto e2fsck -f /dev/mapper/crypto resize2fs /dev/mapper/crypto e2fsck -f /dev/mapper/crypto mount /dev/mapper/crypto /crypto Snapshot Taking A Snapshot...

systemd-nspawn

Downloading the Stage Tarball: mkdir /var/lib/machines/gentoo-stage3-amd64 && cd /var/lib/machines/gentoo-stage3-amd64 wget https://gentoo.osuosl.org/releases/amd64/autobuilds/current-stage3-amd64-systemd/stage3-amd64-systemd-*.tar.xz tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner Config file: gentoo-stage3-amd64.nspawn [Exec] Boot=1 PrivateUsers=off [Files] BindReadOnly=/var/db/repos BindReadOnly=/usr/src Bind=/var/cache/distfiles Bind=/var/cache/binpkgs Bind=/var/tmp/portage Set password: systemd-nspawn --settings=no -D /var/lib/machines/gentoo-stage3-amd64 passwd exit Boot and update: systemd-nspawn --machine=gentoo-stage3-amd64 emerge --metadata emerge --deep --newuse --update --ask --jobs 4 @system emerge app-shells/bash-completion systemctl poweroff make.conf PORTAGE_TMPDIR="/var/tmp" ACCEPT_LICENSE="* -@EULA" MAKEOPTS="-j8 -l9" EMERGE_DEFAULT_OPTS="--with-bdeps=y --ask --jobs=8 --load-average=9 --verbose --getbinpkg" chroot mount --types proc /proc /mnt/gentoo/proc mount --rbind /sys /mnt/gentoo/sys mount --make-rslave /mnt/gentoo/sys mount --rbind /dev /mnt/gentoo/dev mount --make-rslave /mnt/gentoo/dev chroot /mnt/gentoo /bin/bash env-update source /etc/profile export PS1="(chroot) $PS1" to install/update grub: mount /boot in chroot!...