|
|
If you have downloaded an iso image file and wanted to access the contents, you can actually mount the file in linux with out actually burning to a CD
Here is how you do it:
sudo mount -o loop -t iso9660 FILE_NAME TARGET_MOUNT
Where FILE_NAME is the iso file name to be mounted
TARGET_MOUNT is the mount target where you want to mount the file
Example:
sudo mount -o loop -t iso9660 load_scripts.iso "/media/iso_mount"
If there are any other ways of doing this, please post it in the comments.
When we transfer text files saved on Windows on to Linux using ftp or samba, we see ‘^M’ characters at the end of each line, because of the difference in line feed character between linux and unix.
One way to fix problem is we can run dos2unix that converts the test file to unix format. If dos2unix is not readily available you can try the following option:
- Open the text file in VI
- Do a find replace like this
:%s/Ctrl+v M//g this should come up as %s:/^M//g
Note: There is no space between ‘Ctrl+v’ ‘M’ characters
- Now save the file and exit VI with
:wq
Now you should be having the updated file with all Line feed characters fixed.
Here is an one liner I use to kill processes grep by certain keyword.
Using Perl:
ps -ef |grep 'keyword string' | perl -lane 'print $F[1]' | xargs kill -9
Here first I do ps -ef that lists all processes, later I shortlist them by grepping for a certain keyword.
From the shortlisted processes, I use perl -lane 'print $F[1]' that prints out the process ids for the shortlisted processes.
I use xargs to convert the process ids in multiple lines to space separated id list which is given as input arguments to the kill -9 command.
Using awk
ps -ef |grep 'keyword string' | awk ‘{print $2}’ | xargs kill -9
If you are looking for transposing rows or columns in open office, it is very easy. I paste the steps below:
- Select the rows or columns you want to transpose.
- Copy the selected values by pressing
Ctrl+c or Edit -> Copy
- Click on the cell you want to paste, and then go to
Edit -> Paste Special and check the Transpose option and say OK. This will paste the transposed rows as columns starting from the selected cell
Follow the same steps for transposing columns as rows
Recently I wanted to compile java files recursively, and I do not have an ant build.xml to process. I came up with this simple perl script that compiled all java files recursively under a given directory.
#!/usr/bin/perl
use strict;
use Cwd;
use File::Find;
find(sub{
system("javac $File::Find::name/*.java") if (-d $File::Find::name);
}, cwd);
On Unix/Linux you can try following perl oneliner
perl -MFile::Find -MCwd -e 'find(sub{system("javac $File::Find::name/*.java") if (-d $File::Find::name);}, cwd)'
On Windows
perl -MFile::Find -MCwd -e "find(sub{system('javac '.$File::Find::name.'/*.java') if (-d $File::Find::name);}, cwd)"
Please post your comments if there are any better ways of doing it.
First check whether your website currently has gzip compression enabled from this website :http://www.whatsmyip.org/http_compression/
If it says, gzip compression is not enabled, then follow steps below to enable gzip compression on a hosted website.
1. Change the php mode from the web hosting control panel using php config link to any of the following
PHP5 (Single php.ini)
In this mode, all configurations are stored in singe php.ini file under the web root directory
PHP5 (Fast CGI)
All files with the extension .php will be handled by PHP5 FastCGI processes.
FastCGI for PHP makes all your PHP applications run through mod_fastcgi instead of mod_suphp. This eliminates the overhead of loading the PHP interpretor on every request.
Since it is always in memory ready for the next hit, the responses will be generated faster.
Once php mode is changed, edit the php.ini file, and update the zlib.output_compression setting to on as shown below
zlib.output_compression = on
If the web hosting doesn’t support above configuration, for enabling the compression, you can add the following line at the begining of your php files/common php file:
Now you can check whether gzip compression is enabled from this website:http://www.whatsmyip.org/http_compression/
I recently was trying to merge two text files having related data as 2 columns separated by ~ and came across the paste command. Here is an example using paste command:
For example you have one file1 with following data:
John
Mary
Cathy
Chris
and you have other file file2 with following data:
Manager
Office Assistant
Team Member
Team Leader
Running paste file1 file2 prints following in the console
John Manager
Mary Office Assistant
Cathy Team Member
Chris Team Leader
If you want the columns to be delimited by other character try paste -d "~" file1 file2 >file3 which generates
John~Manager
Mary~Office Assistant
Cathy~Team Member
Chris~Team Leader
If you want the files to be pasted serial instead of line by line you can try this command paste -s file1 file2 which prints out each line separated by tab, and each file in a single line, as below.
John Mary Cathy Chris
Manager Office Assistant Team Member Team Leader
I hope this helps someone trying to merge 2 files.
Here are some keyboard shortcuts that are very convenient to users who prefer keyboard to the mouse.
Ctrl + Alt + D-> To minimise all windows and display desktop
Alt + Spacebar + X -> Maximise a window
Alt + Spacebar + N -> Minimise a window
Alt + D -> Access the address bar of the browser(Firefox)
Alt + "left arrow" -> Functions same way as Back in the browser(Firefox)
Alt + "right arrow" -> Functions same way as Forward in the browser(Firefox)
Ctrl + Shift + Enter -> .org extension is automatically added to the URL
Ctrl + Enter -> .com extension is automatically added to the URL
Shift + Enter -> .net extension is automatically added to the URL
Ctrl + D -> Bookmark a webpage
Will keep you posted on some more soon.
I was trying to install skype on my Ubuntu laptop, and after searching for a while and checking in other forums I came up with the following steps:
- Skype Installable for ubuntu/Linux can be downloaded at http://www.skype.com/go/getskype-linux-ubuntu-amd64
- Check the following libraries are installed on your laptop
ia32-libs
lib32nss-mdns
lib32z1
lib32asound2
lib32stdc++6
lib32ncurses5
If they are not installed on your laptop, run the following command:
sudo apt-get install ia32-libs lib32nss-mdns lib32z1 lib32asound2 lib32stdc++6 lib32ncurses5
- Once the required libraries are installed, Now you should be able to install skype by double clicking on the executable, that opens the package in the package installer
- Once the installation is complete, Skype will be available under Applications>Internet>Skype
PS:- Even though Skype installation was successful, I had problems while making a voice call, like “Problem with Audio Playback” and “Problem with Audio Capture”.
In order to set this right, we have to do two things
- Double click on the Volume control icon on the toolbar on the top, Click “Preferences” -> Select Capture and Capture1.
- Then in the Skype window, go to Options>Sound Devices. For both the Audio In and Audio Out, select the second option in the dropdown. This should correct the Audio related problems. In case it does not, then try using other available options – until you find the one that is compatible with your Skype.
I was looking for a command to batch process images taken from a higher mega pixel camera, to a decent resolution images, that I can post in the web. It could be done easily
using imagemagick. It can be installed in ubuntu using following command:
sudo apt-get install imagemagick
And now to process the images, go to the images folder, and create a new folder eg: resized
and run following command:
for pic in `ls *.jpeg *.jpg`
do
convert -resize 50% $pic resized/$pic
done
Now you should be having all the resized pictures at lower resolution under resized folder.
|
|