If you type in a wrong command, bash-insulter will insult you badly.
I got the following error while compiling a Latex-File:
compiling MyLatexfile.tex... tex/virtualbox.tex:1: Package inputenc Error: Unicode char \u8: not set up for use with LaTeX.
So I checked the encoding of the file and saw that it looked like this:
file tex/virtualbox.tex tex/virtualbox.tex: LaTeX document, UTF-8 Unicode (with BOM) text, with very long lines
It seems that inputenc does not like utf-8 with Byte Order Mark. So I removed it using the following sed-command:
This is a one-liner to search for installed packages containing a searchstring and then deinstall them using "apt-get remove":
apt-get remove --purge $(dpkg --get-selections | cut -f 1 | grep DPKG-SEARCHSTRING | xargs echo " " | tr -d '\n')
Sometimes we have to migrate some tables from one host to another. And sometimes we want to migrate users as well. This is how I managed to do this..
First let's read out all users
mysql --batch --skip-column-names -e "SELECT user, host FROM user" mysql
To find out the serial number of a disk I mostly use one of the following commands:
/sbin/udevadm info --query=property --name=sdb | grep ID_SERIAL ## or hdparm -i /dev/sdb | grep SerialNo
Normally I don't use the "print"-key on my keyboard. I woud like to use it to quickly create screenshots. So I'll map the following command to my .fluxbox/keys-file:
sleep 5s && import /home/dr/Screenshots/`date +%F-%T`.jpg
After 5 seconds of idle-time this command will activate a screenshot. After the cursor changed I can select a window or a region on my screen. The screenshot will be saved with it's date and time under /home/dr/Screenshots.
Most linux-users know $OLDPWD. It's an environment variable to get the recently used directory. Sometimes it would be nice to remember more visited directories. In such cases pushd and popd would be a good choice..
Most common shells do have a directory stack. By looking in the man-page of bash I found the following description of the DIRSTACK: