Find files modified more than 48 hours ago:
$ find /path -mtime +1
Find files modified more than n=90 days ago (cutoff by the hour, not the day).
$ find /path -mtime +89
+(n-1) in command. Many online articles got this wrong by simply putting
Sometimes I type in the wrong window in a multi-monitor setup without knowing and end up spamming WeeChat IRC.
To prevent that, I now use gnome-terminal and turn on “Read-Only” mode. This useful feature is, however, not available in other terminals. Please share in the comments if you know of alternatives.
Instead of messing around with the ports directly with RHEL7/CentOS7 firewall-cmd, I’ve decided to update the port number in the ssh.xml service file instead. Think it’s cleaner this way.
For example, here are the steps to change sshd port from the default 22 to 9876:
1. Make a copy of the default ssh service file:
cp /usr/lib/firewalld/services/ssh.xml /etc/firewalld/services/
2. Inspect current firewall settings
iptables -nL | grep -e 22 -e 9876
ACCEPT tcp — 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 ctstate NEW
3. Edit /etc/firewalld/services/ssh.xml to change port number
From: <port protocol=”tcp” port=”22″/>
To: <port protocol=”tcp” port=”9876″/>
4. Change /etc/ssh/sshd_config port to 9876
5. Restart sshd
systemctl restart sshd
6. Notice that sshd now listens on new port
7. Reload firewalld, which will pick up the new port in ssh.xml
8. Inspect new firewall settings, notice port changed
iptables -nL | grep -e 22 -e 9876
ACCEPT tcp — 0.0.0.0/0 0.0.0.0/0 tcp dpt:9876 ctstate NEW
Assumption: SD is not encrypted
Plug SD onto another working computer, look for the “cmdline.txt” file and edit it by appending “init=/bin/sh” after “rootwait”. Save the file, remove the SD and plug it back to the RPi and boot.
You’ll be dropped into a shell. Change your passwd, then hit CTRL-ALT-DEL to trigger a reboot. Switch off the RPi when the shutdown completes, just before the boot starts. Unplug the SD and plug it onto the other working computer. Remove “init=/bin/sh” from “cmdline.txt” file.
Plug the SD back onto the RPi, boot and you can now login with the newly reset password.
If the use of IBus removes your xmodmap keymaps in X, try enabling the “Use system keyboard layout” option under the “Advanced” tab in the IBus Preferences.
– ibus 1.5.5-1
– xorg-xmodmap 1.0.8-1
The 30GB C: drive was running out of free space on my Windows 7 VM guest on VirtualBox v4.2.16.
1. Shutdown VM.
2. Extend it to 45GB:
$ cd /home/user/.VirtualBox/HardDisks
$ VBoxManage modifyhd windows7.vdi --resize 46080
3. Extend partition size in Windows 7
a. Start the VM
b. Run diskmgmt.msc > right-click C: > Extend Volume...
My Arch Linux recently switched from dhcpcd to dhclient as the DHCP client. The DHCP server isn’t assigning a FQDN to this client and it turns out that dhclient isn’t telling the server what’s the client’s hostname.
Create config file /etc/dhclient.conf with content:
send host-name = gethostname();
Love the cross-platform and open source Synergy keyboard and mouse sharing application. With the newly added built-in encryption, it’s even more secure now.
The only problem I had was the copy-paste clipboard issue. When I hit CTRL-C to copy any text from a Windows 7 Synergy cilent (v1.4.12) running in service mode, it doesn’t get sync’d to my Arch Linux Synergy server (v1.4.12-1) and so I can’t paste it on the server machine. However, it does get copied into Windows 7’s own clipboard.
Workaround: Disable the “Elevate” option on Windows 7 Synergy cilent’s GUI. Some of you will need that elevate setting but copy-paste is more important to me. I already have another keyboard plugged in to the client that I can use for UAC prompts and elevated programs, so disabling “Elevate” is fine for me though cumbersome.
Updated on 20130806 to add screenshot.
Argh! My htop is showing a blank screen. I’m afraid of the dark…helppp!
Solution: export TERM=xterm-color before running htop
My tmux uses TERM=screen and htop didn’t like it on one particular machine while the others are fine. Setting it to the above solves it.
1. Install poppler-utils
2. To extract original embedded images:
$ pdfimages -j <file.pdf> <to_dir>
3. To extract text:
$ pdftotext -j <file.pdf>