Various Tips/How to's
1. How to apply a patch in linux
A patch can be applied by issuing the following command:
patch -p0 < patch-file
This has to be done in the correct directory. Simply look at the patch file, in the first few lines you should see something like this:
--- pixman-remap.h 22 Aug 2005 04:02:33 -0000 1.5 +++ pixman-remap.h 21 Nov 2005 19:46:40 -0000 1.7
This tells you that you will need to find the file pixman-remap.h and change to the directory containing this file before you apply the patch.
2. Creating a tar/gzip of customizrd Firefox builds
tar -C dist -jhcf firefox.tar.gz bin/
3. Y axis label cutoff in MS Excel
If your Y-axis label gets cutoff in Excel then add some …….. (fullstops) at the end. Change the colour of the fullstops to match the background colour so they won’t be seen.
4. Some common linux commands
5. Common Vim commands
6. Installing XFCE on Ubuntu
You can install XFCE using those two commands:
sudo aptitude update && sudo aptitude install xubuntu-desktop
7. Installing Microsoft Windows fonts on Ubuntu
If you want to install the windows ( True Type ) fonts on Ubuntu
sudo aptitude install msttcorefonts
you would need to enable the universe and multiverse repositories before installing.
8. Bulk rename files in linux
The syntax for the rename command is:
rename [ -v ] [ -n ] [ -f ] perlexpr [ files ]
Renames *.JPG to *.jpg
rename -v 's/\.JPG$/\.jpg/' *.JPG
the “s” in the perl expression above means substitute. The syntax is s/old/new/ — substitute the old with the new.
9. Java on Ubuntu / Kubuntu
Installing Java:
sudo aptitude install sun-java6-bin sun-java6-jre
Selecting your preferred Java environment on K/Ubuntu
sudo update-alternatives --config java
10. SSH with no password
First, on the system you ssh from use
ssh-keygen -t rsa
. This will create 2 files id_rsa and id_rsa.pub
On the system you wish ssh to without a password append contents of id_rsa.pub to the file authorized_keys in you .ssh directory. If the file is not yet created just use the touch command i.e.
touch authorized_keys
To append you can use
cat id_rsa.pub > authorized_keys
11. Opera on Ubuntu( 7.10 Gusty )
First add the commercial repository:
sudo gedit /etc/apt/sources.list
Add this line:
deb http://archive.canonical.com/ gutsy partner
Save and run these commands:
sudo apt-get update sudo apt-get install opera
12. Matlab crashes when setting font preference on linux
If Matlab R2007a crashes when editting the font preferences on linux then
- Install the newest the JRE 6 from the packet manager
- Edit your /matlab/bin/matlab and add the follow the command
export MATLAB_JAVA=/usr/lib/jvm/java-6-sun-1.6.0.03/jre
Be sure to change the paths if your are different from above.
13. Create an archive of a directory/folder in linux
tar -zcvf archive-name.tar.gz directory-name
where,
- -z: Compress archive using gzip program
- -c: Create archive
- -v: Verbose i.e display progress while creating archive
- -f: Archive File name
If you wish to restore your archive then you need to use following command (it will extract all files in current directory):
tar -zxvf prog-1-jan-2005.tar.gz
where,
- -x: Extract files
13. Installing Microsoft Truetype fonts on Ubuntu
You can install the MS core fonts by installing the msttcorefonts package. To do this, enable the “Universe” component of the repositories. After you do that, use the following command from the command line:
sudo apt-get install msttcorefonts