Table of Contents
How can I compress an image?
How can I change the resolution of a JPG?
How can I convert and combine JPG to PDF?
How can I remove MP3 tags?
How can I install glog?
How can I fix docker permission denied?
How can I use vi key mappings in bash?
How can I install the Opera browser on Ubuntu?
How can I install a recent version of gcc?
How can I replace a page of a PDF?
How can I resize and convert an image?
How can I install the missing dependency of Acrobat Reader?
How can I install R?
How can I trace bitmap images to vector ones?
How can I install Ruby in Linux?
How can I specify the folder containing the generated Jekyll site?
How can I tell if a JVM is 32 or 64 bits?
How can I tell if a binary is 32 or 64 bits?
How can I install Orcale JDK 7?
How can I make a user a sudoer?
How can I extract a page from a PDF?
How can I install Citrix?
How can I find the distribution of the running Linux?
How can I install ant without GCJ?
How can I revert the display settings?
How can I redirect stderr and stdout to a file?
How can I follow what gets appended to a file online?
How can I install an SSH server?
How can I configure my SSH client to connect to a server?
How can I copy the SSH public key to a remote host?
How can I scroll in the screen program?
How can I rename a screen window?
How can I reorder screen windows?
How can I recover Grub after installing Windows?
How can I set environment variables during startup?
How can I install Dropbox?
How can I install Alpine?
How can I install and uninstall TeXLive in Ubuntu?
How can I update my TeXLive installation?
How can I install vanilla TeXLive to satisfy APT dependencies?
How can I install hevea on top of vanilla TeXLive?
How can I set the number of floating point digits in bc?
How can I type right to left?
How can I recover deleted files?
How can I generate a LaTeX diff of two LaTeX files?
How can I pass the results of a command to another?
How can I install the latest stable release of Git?
How can I install Ubuntu repository public keys?
How can I open a terminal from within nautilus?
How can I update the database used by the locate command?
How can I fix the background color of Eclipse tooltips?
How can I clear the bash history?
How can I get the specifications of the installed RAM?
How can I monitor the health of a hard disk?
How can I install the latest release of Mercurial?
How can I open a shell within Vim?
How can I compress an image?
22 Feb 2022
-
linux
convert -density 150x150 -quality 20 -compress jpeg one.pdf two.pdf
How can I change the resolution of a JPG?
02 Jun 2019
-
linux
Open the JPG file using GIMP. Then, open the Image
menu and select Scale
Image...
Next, set the X and Y resolution to the desired resolution and save
the file.
How can I convert and combine JPG to PDF?
01 Jun 2019
-
linux
convert *.jpg output.pdf
If convert
returns a not authorized
error, edit
/etc/ImageMagick-6/policy.xml
and change the PDF rights from none
to
read|write
.
References
How can I remove MP3 tags?
06 Jun 2018
-
linux
id3v2 -D filename.mp3
References
How can I install glog?
31 Jul 2016
-
linux
git clone https://github.com/google/glog.git
cd glog
./configure && make
sudo make install
Compile with flag -lglog
References
How can I fix docker permission denied?
01 Aug 2015
-
linux
Docker may give you the permission deniend
error on Linux:
$ docker run busybox date
2015/08/01 15:37:42 Post
http:///var/run/docker.sock/v1.12/containers/create: dial unix
/var/run/docker.sock: permission denied
Run the following command and log out to fix the above error.
sudo usermod -a -G docker ${USER}
References
How can I use vi key mappings in bash?
18 Nov 2014
-
linux
Include following in ~/.bashrc
:
set -o vi
References
How can I install the Opera browser on Ubuntu?
05 May 2014
-
linux
sudo bash -c 'echo "deb http://deb.opera.com/opera/ stable non-free" > /etc/apt/sources.list.d/opera.list'
sudo apt-get install debian-archive-keyring
wget -O - http://deb.opera.com/archive.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install opera
References
How can I install a recent version of gcc?
04 May 2014
-
linux
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
Similar instructions work for installing other versions of gcc and g++.
References
How can I replace a page of a PDF?
23 Mar 2014
-
linux
pdftk A=f1.pdf B=f2.pdf cat A1-14 B A16-21 output f3.pdf
References
How can I resize and convert an image?
22 Mar 2014
-
linux
convert -resize 50% image.jpg image.pdf
References
How can I install the missing dependency of Acrobat Reader?
28 Feb 2014
-
linux
Install Adobe Reader 9 using its .deb file.
If you run Adobe Reader, you may get the following error message:
/opt/Adobe/Reader9/Reader/intellinux/bin/acroread: error while loading shared
libraries: libxml2.so.2: cannot open shared object file: No such file or
directory
If you get the above error message, run the following command:
sudo apt-get install libxml2:i386 libstdc++6:i386
References
How can I install R?
01 Jan 2014
-
R,
linux
sudo apt-get install r-base
References
How can I trace bitmap images to vector ones?
21 Dec 2013
-
linux
- Use xsane to scan your document as a PNM image.
- Use potrace to covert your image to a vector image, e.g., PDF or EPS.
References
How can I install Ruby in Linux?
27 Nov 2013
-
linux
Run the following command to install RVM.
\curl -sSL https://get.rvm.io | bash -s stable --ruby
The above command should report a message of the form below at the end:
To start using RVM you need to run
source $HOME/.rvm/scripts/rvm
in all your open shell windows, in rare cases you need to reopen all shell windows.
References
How can I specify the folder containing the generated Jekyll site?
17 Jul 2013
-
linux
New command:
jekyll serve -d _new_site
Deprecated command:
jekyll _new_site --server
References
How can I tell if a JVM is 32 or 64 bits?
16 May 2013
-
linux
If the running JVM is not 64 bits, the following command will report an error message:
java -d64 -version
References
How can I tell if a binary is 32 or 64 bits?
15 May 2013
-
linux
file /path/to/binary
References
How can I install Orcale JDK 7?
06 May 2013
-
linux
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo update-java-alternatives
References
How can I make a user a sudoer?
26 Apr 2013
-
linux
sudo usermod -a -G sudo username
References
How can I extract a page from a PDF?
21 Apr 2013
-
linux
pdftk A=in.pdf cat A1 output out.pdf
References
How can I install Citrix?
03 Apr 2013
-
linux
- Install OpenMotif.
- Install Citrix.
- Download linuxx86-11.100.158406.
- Extract the downloaded archive.
- Run
sudo ./setupwfc
.
- Run Citrix.
/usr/lib/ICAClient/wfcmgr
References
How can I find the distribution of the running Linux?
21 Mar 2013
-
linux
cat /etc/*-release
How can I install ant without GCJ?
20 Mar 2013
-
linux
sudo apt-get install --no-install-recommends ant
When trying to use ant to build the X10 compiler, ant complained about a missing
JAR. It looked like the build.xml
file used javah
targets. So, I installed
ant-optional using the following command.
sudo apt-get install --no-install-recommends ant-optional
How can I revert the display settings?
19 Mar 2013
-
linux
While tweaking the display resolution, it got messed up. So, I went and reverted
/etc/X11/xorg.conf
to a previous version. There was a command mentioned in
this config file on how to force X11 update itself according to the new
configurations.
How can I redirect stderr and stdout to a file?
18 Mar 2013
-
linux
process >file 2>&1
How can I follow what gets appended to a file online?
17 Mar 2013
-
linux
tail -f file
How can I install an SSH server?
16 Mar 2013
-
linux
sudo apt-get install openssh-server
When an old client tries to connect to the server, it complains that the server
has changed its identity. Remove the ~/.ssh/known_hosts
to have the client
receive the new identity of the server.
References
https://help.ubuntu.com/6.06/ubuntu/serverguide/C/openssh-server.html
How can I configure my SSH client to connect to a server?
15 Mar 2013
-
linux
ssh-keygen -C "key-identifier" (without quotes)
scp ~/.ssh/id_rsa.pub server.example.org
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
Create or open the file at ~/.ssh/config
Add the following lines:
Host server.example.org
User git
Hostname server.example.org
PreferredAuthentications publickey
IdentityFile [local path to private key half of the public key you provided]
The main ssh config file is at /etc/ssh/ssh_config
.
How can I copy the SSH public key to a remote host?
14 Mar 2013
-
linux
ssh-copy-id remote-host
How can I scroll in the screen program?
13 Mar 2013
-
linux
Press C-a [
to enter the copy mode. Then, press ESC
to exit the copy mode.
How can I rename a screen window?
12 Mar 2013
-
linux
Press CTRL-a A
in each active window to get prompted for entering a new name.
References
http://nathan.chantrell.net/old-stuff/linux/an-introduction-to-screen/
How can I reorder screen windows?
11 Mar 2013
-
linux
Switch to the window you’d like to move and press CTRL-a
followed by :number
x
, where x
is the new location of the window.
References
http://www.snowfrog.net/2007/11/07/howto-move-windows-in-gnu-screen/
How can I recover Grub after installing Windows?
10 Mar 2013
-
linux
grub
sudo grub
Tell Grub which partition to tell the MBR your Grub is on by entering:
root (hd0,3)
If Ubuntu was installed on the second partition of the first hard-drive. Tell GRUB which drive’s MBR to fix:
setup (hd0)
quit
grub2
References
https://wiki.ubuntu.com/Grub2#Recover%20Grub%202%20via%20LiveCD
How can I set environment variables during startup?
09 Mar 2013
-
linux
If you want to make an environment variable visible system-wide, you should set
it in /etc/environment
. To set environment variables per user, you have to
modify ~/.pam_environment
.
The following is a sample ~/.pam_environment
file contents.
JAVA_HOME OVERRIDE=/path/to/java/home
PATH OVERRIDE=${PATH}:${JAVA_HOME}/bin
I’ve always had problems with ~/.pam_environment
for it duplicates my entries
in PATH
. So, I use the system-wide configuration file, i.e.,
/etc/environment
.
References
- https://help.ubuntu.com/community/EnvironmentVariables
man pam_env
/etc/security/pam_env.conf
How can I install Dropbox?
08 Mar 2013
-
linux
First, run the following command to add the Dropbox repository.
sudo add-apt-repository "deb http://linux.dropbox.com/ubuntu $(lsb_release -sc) main"
Next, run the command sudo apt-get update
. You should get an error message
similar to the following:
W: GPG error: http://linux.dropbox.com precise Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY FC918B335044912E
Follow the instructions at
http://reprogrammer.github.io/faq/2013/02/24/how-can-i-install-ubuntu-repository-public-keys/
to add the necessary keys. While following the instruction, note that the
Dropbox’s key server is pgp.mit.edu
.
Finally, run the following commands to install Dropbox.
sudo apt-get update
sudo apt-get install dropbox python-gpgme
The command sudo apt-get update
reports the following problem:
W: Duplicate sources.list entry http://linux.dropbox.com/ubuntu/ precise/main amd64 Packages (/var/lib/apt/lists/linux.dropbox.com_ubuntu_dists_precise_main_binary-amd64_Packages) W: Duplicate sources.list entry http://linux.dropbox.com/ubuntu/ precise/main i386 Packages (/var/lib/apt/lists/linux.dropbox.com_ubuntu_dists_precise_main_binary-i386_Packages) W: You may want to run apt-get update to correct these problems
I need to figure out how to resolve the duplicate entry problem.
References
How can I install Alpine?
07 Mar 2013
-
linux
sudo apt-get install alpine
Alpine stores its mails in $HOME/mail
.
How can I install and uninstall TeXLive in Ubuntu?
06 Mar 2013
-
linux,
tex
Installation
sudo apt-get install perl-tk
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
tar xvfz install-tl-unx.tar.gz
sudo ./install-tl<tab>/install-tl -gui
Select the following two options:
- Use the letter size instead of the default A4 size.
- Create symlinks in system directories.
The installer asks about the following directories. Leave the default settings.
TEXDIR=/usr/local/texlive/<year>
TEXMFLOCAL=/usr/local/texlive/texmf-local
TEXMFSYSVAR=/usr/local/texlive/<year>/texmf-var
TEXMFSYSCONFIG=/usr/local/texlive/<year>/texmf-config
TEXMFHOME=~/texmf
The installer says the following, but the symlinks are enough.
Add
/usr/local/texlive/20xy/texmf/doc/man
toMANPATH
.Add
/usr/local/texlive/20xy/texmf/doc/info
toINFOPATH
.Most importantly, add
/usr/local/texlive/20xy/bin/x86_64-linux
.
Uninstallation
sudo tlmgr uninstall
rm -rf /usr/local/texlive
References
How can I update my TeXLive installation?
05 Mar 2013
-
linux,
tex
Updating the updater itself
sudo tlmgr update --self
Updating the updater itself and all the packages
sudo tlmgr update --self --all
Updating the TeXLive distribution
sudo tlmgr -gui
You can check if a package is installed by using the locate
command.
Sometimes, a package is installed but the symlink to it in system directories is
missing. You can update the symlinks through the tlmgr
program.
How can I install vanilla TeXLive to satisfy APT dependencies?
04 Mar 2013
-
linux,
tex
I used
texlive.ctl to
create a vanilla TexLive package. I removed tex-common
from
texlive.ctl
because the original texlive.ctl file didn’t have it and I had to remove it to
install hevea. The hevea package is not included in TeXLive. And, I had to
install tex-common
in order to install hevea. Also, to let my own installation
of TeXLive locate the style files of the hevea package installed through Ubuntu,
I had to set the following environment variable.
export TEXMFHOME=/usr/share/texmf/
I used the following command to set the “Standards-Version” field in
texlive.ctl
.
apt-cache show debian-policy | grep Version
Then, I executed the following commands to create and install my vanilla package.
equivs-build texlive.ctl sudo dpkg -i texlive-vanilla_2010-1~1_all.deb
Finally, I used the following command to install kile.
sudo apt-get --no-install-recommends install kile
See http://manpages.ubuntu.com/manpages/maverick/man5/deb-control.5.html to learn more about the format of Ubuntu package control files. Specifically, the “Provides” section lists virtual packages that could be provided by the normal package.
References
- http://www.tug.org/texlive/debian.html
- http://superuser.com/questions/134125/vanilla-tex-live-2009-on-ubuntu
- http://tex.stackexchange.com/questions/1092/how-to-install-vanilla-texlive-on-debian-or-ubuntu/1094#1094
How can I install hevea on top of vanilla TeXLive?
03 Mar 2013
-
linux,
tex
I installed texlive-vanilla (2010-1~1). And, tried to install hevea with the following command.
sudo apt-get --no-install-recommends install hevea
But, I got the following message.
The following NEW packages will be installed:
hevea ocaml-base-nox tex-common
So, I checked the dependencies of the hevea in Ubuntu. The hevea package requires “tex-common (>=2.00)”. The “provides” section of the control file of vanilla-texlive doesn’t specify the versions of the virtual packages. So, I thought all of the virtual packages get the version number 2010-1~1 automatically. Then, I used the following command to verify that “2010-1~1” is indeed greater than “2.00” according to Ubuntu package formate rules.
dpkg --compare-versions 2010-1~1 gt 2.00 ; echo $?
And, I got the value “0” on the console, which confirms that 2010-1~1 is greater than 2.00. At this point, I concluded that the version number of the virtual packages is unspecified. So, I decided to create my own version of tex-common. I created a control file for my tex-common package called tex-common.ctl and executed the following commands.
equivs-build tex-common.ctl sudo dpkg -i tex-common_2010-1~1_all.deb
Having installed my own tex-common package, I was able to successfully install hevea using the following command.
sudo apt-get --no-install-recommends install hevea
How can I set the number of floating point digits in bc?
02 Mar 2013
-
linux
The following command sets the precision of floating point operations to 2 digits.
scale = 2
How can I type right to left?
01 Mar 2013
-
linux
To write right-to-left in Linux, press Right-ALT+]
and end by ALT+P
.
To write left-to-right in Linux, press Right-ALT+[
.
Use RLE
and PDF
to begin and end a right-to-left embedding. The unicode for
LRE
is U+202A
, the unicode for RLE
is U+202B
and the unicode for PDF
is U+202C
. In Ubuntu, hold CTRL-SHIFT
to type a unicode character. For
example, to type an RLE
, press the following keys: CTRL SHIFT U + 2 0 2 B
.
Hold the left ALT and the right SHIFT keys to switch the Ubuntu keyboard layout.
References
How can I recover deleted files?
28 Feb 2013
-
linux
The best tool that I found for recovering files was Photorec.
References
How can I generate a LaTeX diff of two LaTeX files?
27 Feb 2013
-
linux,
tex
Make sure old.tex
and new.tex
have a place to insert the preamble.
latexdiff --type=UNDERLINE --subtype=SAFE --floattype=FLOATSAFE old.tex new.tex > difference.tex
How can I pass the results of a command to another?
26 Feb 2013
-
linux
The xargs
program passes the outputs of one command as arguments to another
one.
The following is an example of processing the results of find using xargs
:
find . -name <pattern> -print0 | xargs -0 -I {} <command with {} as an argument>
find -print0
and xargs -0
make find
and xargs
handle files with unusual
characters in their names properly.
References
- http://linux.byexamples.com/archives/80/xargs-use-stardard-output-as-parameter-for-another-command
- http://www.cyberciti.biz/faq/linux-unix-bsd-xargs-construct-argument-lists-utility/
- http://www.gnu.org/software/findutils/manual/html_mono/find.html#Unusual-Characters-in-File-Names
How can I install the latest stable release of Git?
25 Feb 2013
-
linux,
git
The following commands install the latest stable release of git.
sudo add-apt-repository ppa:git-core/ppa
sudo aptitude update
sudo aptitude upgrade
References
- http://superuser.com/questions/56134/how-to-upgrade-git-on-ubuntu-hardy
- https://launchpad.net/~git-core/+archive/ppa
How can I install Ubuntu repository public keys?
24 Feb 2013
-
linux
If you get an error like the following from apt
:
W: GPG error: http://ppa.launchpad.net lucid Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY A6DCF7707EBC211F
Take the last 8 characters of the string in the error message and use it in the following two commands:
gpg --keyserver keyserver --recv 7EBC211F
The keyserver in the above commands may be a server like
keyserver.ubuntu.com
or pgp.mit.edu
.
The above command will generate an output similar to the following:
gpg: requesting key 7EBC211F from hkp server keyserver.ubuntu.com gpg: key 7EBC211F: public key “Launchpad PPA for Ubuntu Mozilla Security Team” imported gpg: no ultimately trusted keys found gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1)
Next, run the following command:
gpg --export --armor 7EBC211F | sudo apt-key add -
The above command should generate the following output:
OK
Note the post at http://askubuntu.com/a/127187 suggest that the above two steps can be performed in a single steps. I need to try out this command.
sudo apt-key adv --keyserver keyserver --recv-keys 7EBC211F
References
How can I open a terminal from within nautilus?
23 Feb 2013
-
linux
To open a terminal from within nautilus, install the nautilus-open-terminal package using the following command:
sudo aptitude install nautilus-open-terminal
References
How can I update the database used by the locate command?
22 Feb 2013
-
linux
sudo updatedb
How can I fix the background color of Eclipse tooltips?
21 Feb 2013
-
linux,
eclipse
Open the file at /usr/share/themes/Ambiance/gtk-2.0/gtkrc
. Locate
tooltip_fg_color
and tooltip_bg_color
in the file and change their values as
follows:
tooltip_fg_color:#000000
tooltip_bg_color:#f5f5c5
References
- http://www.vogella.com/blog/2012/12/04/eclipse-papercut-10-eclipse-on-ubuntu-fixing-the-black-background-color-in-hover/
- http://wiki.eclipse.org/IRC_FAQ#Black_background_color_for_tooltips_on_Linux.2FUbuntu.2FGTK
How can I clear the bash history?
20 Feb 2013
-
linux
history -c && rm -f ~/.bash_history
References
How can I get the specifications of the installed RAM?
19 Feb 2013
-
linux
dmidecode --type memory
References
How can I monitor the health of a hard disk?
18 Feb 2013
-
linux
Use S.M.A.R.T.
References
How can I install the latest release of Mercurial?
17 Feb 2013
-
linux,
mercurial
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 323293EE
sudo add-apt-repository ppa:mercurial-ppa/releases
sudo apt-get update
sudo apt-get upgrade
References
How can I open a shell within Vim?
16 Feb 2013
-
linux
Get the latest tar.gz of conque from http://code.google.com/p/conque/downloads/list.
Extract the tar.gz file to get the directory conque_x.y
. Execute the command
cp -r conque_x.y/* ~/.vim/
to install Conque on your vim.