Some quick fixes and minor hacks on Ubuntu. I update it every now and then.
A Few Words
I encounter problem every now and then on Ubuntu. I decide to take some notes on what I get when searching through websites like StackOverflow.
Last update: 2018-10-22.
How to add a
.desktop executable file to start menu and “favorites”?
.desktop file usually comes with the software packages in
.tar.bz format, for example, Zotero. When you double click to execute the
zotero.desktop, you can not add it to the side bar (favorites). The solution is:
1 ln -s ~/Software/Zotero_linux-x86_64/zotero.desktop ~/.local/share/applications
I just use Zotero to illustrate, other software is likewise. After the symbol exists, you can find it in start menu by press the super (win) key. Open Zotero, and now you can add it to the side bar by right clicking the icon.
Change file owner and user group
Suppose the file name is “so_happy.org”
1 sudo chown user:group so_happy.org
group are the ones you want to set.
Change file permission
Allow file executiohttps://askubuntu.com/questions/25596/how-to-set-up-usb-for-virtualboxn:
1 sudo chmod +x your_file
1 sudo chmod 755 your_file
There are three bits to represent readable/writable/executable. Then 000 - 111 are mapped to 0-7 decimal digits.
The three digits in the command are owner, group, others.
Read more: AskUbuntu.
Hold back a package in
1 sudo apt-mark hold <package>
 TODO How to ignore packages in Ubuntu Software Updater?
Change End-of-Line (EOL) of a file
1 sudo apt install dos2unix
Process file with it.
1 dos2unix input_file.txt output_file.txt
This is especially helpful for the file
~/.aspell_pws/.aspell.en.pws. Once Spacemacs is run on Windows, the EOL will be changed to DOS (I synchronize this file with Dropbox).
Taking area screenshot with shortcut
Link: How to change the keyboard shortcut to take screenshots with Shutter? - StackOverflow.
- Install shutter (Available in Ubuntu Software Center).
- Go to
- Scroll down to the bottom, add a personal shortcut (
- Give it a name, whatever. The command is
- If you want to take a full screenshot, change the command to
shutter -f, or simply press the
Convert GBK-encoded files to UTF-8 encoding
Link: Linux 下 GBK->UTF-8 文件编码批量转换命令.
sudo apt install enca.
- Check the usage via
- In our case, run the command in terminal:
1 2 3 enca -L zh_CN file # check the encoding of the file enca -L zh_CN -x UTF-8 file # convert GBK to UTF-8 enca -L zh_CN -x UTF-8 file1 file2 # convert file1 to UTF-8 and save to file2
Note: it supports wild card matching, like “*.tex”.
Using USB passthrough to Oracle VirtualBox
Link: How to set up USB for Virtualbox?
- Install “VirtualBox Extension Pack”.
- sudo usermod -aG vboxusers
- Reboot the host computer. Done!
- ← Older-Zotero Configuration for Attachment Synchronization Between Multiple Computers
- C Coding Standard - Formatted-Newer →