I am starting this thread with a long term perspective to put together lots of useful information for our programs.
Request all to participate in this thread to spread the word about all the lovely things that can be done on Linux.
The distribution I use is Debian (from www.debian.org) but most tricks shall be generic in nature (program based). Many of the softwares are available on windows also so some tips maybe applicable for their windows versions also.
Tip #1: Converting bitrate of mp3 files
I sometimes have the requirement to convert high bitrate files to lower bitrate ones so that they are of smaller sizes on websites.
I normally use the lame mp3 encoder for this purpose (also available on windows).
Suppose you have a file abc.mp3 (of say 128 kbp s although its immaterial) to be converted to def.mp3 of bitrate 16 kbps then command for it is:-
lame -b 16 abc.mp3 def.mp3
Its possible to write a script to convert many files as a batch.
Note that 16 is just a number. you can convert to other standard values also although in general converting to higher values is not suggested.
The permitted values are as follows:-
For MPEG1 (sampling frequencies of 32, 44.1 and 48 kHz)
n = 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320
For MPEG2 (sampling frequencies of 16, 22.05 and 24 kHz)
n = 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160
It is also possible to change the sampling rate also with the following switch:-
-s sfreq
sfreq = 8/11.025/12/16/22.05/24/32/44.1/48
Tip #2 : Zipping files
It is possible to zip a file very simply with the zip command.
zip zipfilename.zip file1 file2 ....
I once had a requirement to convert bitrate (as in Tip #1) and zip as well for which I have a readymade one. it converts all mp3 files in a folder and zips them too.
Tip #3: Making list of mp3 files in a folder
There is a perl program called mp3report available for the purpose. (windows version is also there).
Its syntax is: mp3report <directorypath>
It shall make an html file for you with report of file with other track details!
This is the one I use to get track length, bitrate details.
An example snapshot is attached.
Note that it recursively shows all mp3 files (also supports the capitalised .MP3) so you could actually have your whole collection in a single html file. Makes easy to search songs then.
Attached image(s)
Exon
I also use the same version of mp3report. I have modified the default template to give additional details.
HF is not allowing me to put the code here at the moment.
I am attaching the template I use. This one also shows the track name and artist names! I can add more fields but don't like the entries to become too big.
To use the template instead of the default one, the command is:-
mp3report --template=/your-location/template.html <directory-to-make-list-of>
you could have a different filename of course.
Attached File(s)
template.html ( 5.24 k )
Number of hits: 2
by members
Tip #4: mp3info
As mentioned by Exon, mp3info is also a very useful software. It can even be used for tag editing!
If you just want track details syntaxi is simply: mp3info <filename.mp3>
e.g.
Tip #6 : file
This is a very handy default utility with which you can find the type of any file.
Syntax: file <filename>
examples of usage:
Tip #7: extract utility (which uses libextractor)
Similar to the well-known "file" command, extract can display meta-data from a
file and print the results to stdout.
.
Currently, libextractor supports the following formats: HTML, PDF, PS, OLE2
(DOC, XLS, PPT), OpenOffice (sxw), StarOffice (sdw), DVI, MAN, MP3 (ID3v1 and
ID3v2), OGG, WAV, EXIV2, JPEG, GIF, PNG, TIFF, DEB, RPM, TAR(.GZ), ZIP, ELF,
REAL, RIFF (AVI), MPEG, QT and ASF.
.
Also, various additional MIME types are detected. It can also be used to
compute hash functions (SHA-1, MD5, ripemd160).
Homepage: http://www.gnunet.org/libextractor/
Its syntax is extract -f <filename>
Admittedly, it works tag2 although with no extra details (auto-generated from the tag) which it seems to give with version 1.
The below output shows details for a file with both v1 and v2 tags (which are identical)
Tip #8 - Software for editing mp3 tags : kid3-qt
This software provides a very useful tagging facility. Both v1 and v2 tags can be put. You can easily select any file in a directory (good for bulk tagging). You can put just one of the tags (usually I put v2 and the other one can just be got by the click of a button).
It has built in genres which is easy to select. Its possible to add extra tags in v2 very easily too.
A snapshot showing the software and options is attached.
Attached image(s)
Tip #9: Screen Capture Software
Often for presentations we have a requirement to store a video of desktop to demonstrate features of software.
recordmydesktop is a good lightweight utility to record the desktop. It is available on all GNU/Linux Box
Syntax for using it is simple:-
$recordmydesktop output.ogv
There is another software called xvidcap too but is more crash prone articularly for full size video.
after recording you can resize it to desired size using
Tip #10: Zipping and unzipping many files in a folder
Whenever you need to upload many mp3 files its painful zipping each one of them. Usually I put all of them in a single folder and use a custom script to zip all the mp3 files in that folder.
The script I use is as follows:-
Please note that windows users can also use the zip utility.
You can use UnxUtils available for download from unxutils.sourceforge.net/
Extract the contents of http://unxutils.sourceforge.net/UnxUtils.zip to a folder of your choice. Add the local/bin directory to your default path.
After that in shell you shall be able to use zip and other commands!
Tip #11: Making multibyte zip of big files
Sometime there is a requirement to make many part zip of big files. I used p7zip for it. (available on multiple platforms).
The syntax is:-
Tip #12: Typing Tutor
KLavaro is a lovely typing tutor software for those looking for one. It has lots of good features. it has lots of exercises and grades well too. Tests check for wpm, accuracy and fluidity as well.
Tip #13: How to type in Hindi in Open Office and other softwares?
I normally use KDE. will mention the procedure for that incase
someone's interested:-
1. Open Control Center. Go to Regional & Accessibility->Keyboard Layout.
2. Click on Enable Keyboards radio button.
3. Select India on left panel (Available layouts) and click on add.
This will cause a new India layout to come in active layouts on the
right.
4. In the layout variants you can choose 'deva' (if you want standard
hindi keyboard) or 'bolnagri' (if you want phonetic hindi keyboard,
which I prefer since its easy).
Once this is done the KDE Keyboard Layout tool shall be available in
your system tray. Whenever you need to type in Hindi select the
appropriate hindi layout. Once thats done you can type in Hindi in all
softwares supporting hindi unicode including Open Office. If you want
hindi fonts ttf-devanagri package should be installed.
Its possible to do similarly in GNOME also where you have a switcher
applet which you can add to your desktop.
Add -> Utility -> Keyboard layout switcher (for Gnome <2.6). For newer
gnome use 'keyboard indicator'.
Please note that instead of hindi layout you could have gone for other layouts like tamil, telugu, punjabi, oriya, bengali etc also to type in those languages.
Tip #14: Installing Winamp using wine on Linux
Follow the following steps:-
1. Install wine using your favourite package management software
2. Download Winamp Version 5.541 from www.oldapps.com (Newer winamp does not work) (or direct link: http://www.brothersoft.com/winamp-download-227621.html )
3. Right click on the executable and open with wine
OR
Run ' wine </yourpath>winamp5541_full_bundle_emusic-7plus_en-us.exe'
4. During the installation process do not select the "Winamp Agent" or "Modern skins" under User Interface Extensions (it makes winamp very slow and unstable otherwise)
Your installation is done and you can run by clicking the icon on your desktop. Alternatively run:
wine '/home/yourusername/.wine/drive_c/Program\ Files/Winamp/winamp.exe'
In case you need to be a DJ for shoutcast radio on HF or other stations you can also install the usual dsp plugin over wine. (This is what I use for my shoutcasts).
The plugin is available here:-
http://www.shoutcast.com/download (Direct link: http://yp.shoutcast.com/downloads/shoutcast-dsp-1-9-0-windows.exe )
Follow the procedure to become DJ given here:-
http://www.hamaraforums.com/index.php?showtopic=16324#
HB,
Will installing Wine in a Linux machine increase its vulnerability to viruses?
Exon
Tip #15: Installing Goldwave on Linux using wine
Goldwave is one of the best audio editing tools available. I was missing using it on linux earlier. Not anymore. Follow this procedure to get it for you too:-
1. Download Goldwave 4.26 (Newer one doesn't work due to DirectX not being supported by wine yet) from here: http://www.oldapps.com/goldwave.php
2. Install the executable using wine.
3. Get mfc42.dll from any XP Installation and copy it to /home/yourusername/.wine/drive_c/windows/system32/ (needed for program to work). You can also download it from here: http://www.dll-files.com/dllindex/dll-files.shtml?mfc42
Your program is ready to be used. All audio editing works seamlessly like on windows. I have never tried CD ripping (for obvious reasons, there are foss tools available) and don't know if that will work.
Tip #16: How to recover files deleted by rm -r
http://osscamp.in/blog/how-recover-deleted-files-using-rm-rf-command-ext3fs
Tip #17 - Stapler for pdf
Often one has lots of pdf's and one wishes it was possible to have an "software" stapler with which one could add delete pages at will and do other things with it.
pdftk is what you've been looking for.
To quote from the manual:-
If PDF is electronic paper, then pdftk is an electronic stapler-remover,
hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. Pdftk is a
simple tool for doing everyday things with PDF documents. Keep one in the
top drawer of your desktop and use it to:
- Merge PDF documents
- Split PDF pages into a new document
- Decrypt input as necessary (password required)
- Encrypt output as desired
- Fill PDF Forms with FDF Data and/or Flatten Forms
- Apply a Background Watermark
- Report PDF on metrics, including metadata and bookmarks
- Update PDF Metadata
- Attach Files to PDF Pages or the PDF Document
- Unpack PDF Attachments
- Burst a PDF document into single pages
- Uncompress and re-compress page streams
- Repair corrupted PDF (where possible)
That gives an idea about what all the software can do.
What more can one ask of a software which is just a little over 3 MB in installed size!
Here are some examples on how to use the lovely software:-
Decrypt a PDF
pdftk secured.pdf input_pw foopass output unsecured.pdf
Encrypt a PDF using 128-bit strength (the default), withhold all permissions (the default)
pdftk 1.pdf output 1.128.pdf owner_pw foopass
Same as above, except password ’baz’ must also be used to open output PDF
pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz
Same as above, except printing is allowed (once the PDF is open)
pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz allow printing
Join in1.pdf and in2.pdf into a new PDF, out1.pdf
pdftk in1.pdf in2.pdf cat output out1.pdf
or (using handles):
pdftk A=in1.pdf B=in2.pdf cat A B output out1.pdf
or (using wildcards):
pdftk *.pdf cat output combined.pdf
Remove ’page 13’ from in1.pdf to create out1.pdf
pdftk in.pdf cat 1-12 14-end output out1.pdf
or:
pdftk A=in1.pdf cat A1-12 A14-end output out1.pdf
Apply 40-bit encryption to output, revoking all permissions (the default). Set the owner PW to ’foopass’.
pdftk 1.pdf 2.pdf cat output 3.pdf encrypt_40bit owner_pw foopass
Join two files, one of which requires the password ’foopass’. The output is not encrypted.
pdftk A=secured.pdf 2.pdf input_pw A=foopass cat output 3.pdf
Uncompress PDF page streams for editing the PDF in a text editor (e.g., vim, emacs)
pdftk doc.pdf output doc.unc.pdf uncompress
Uncompress PDF page streams for editing the PDF in a text editor (e.g., vim, emacs)
pdftk doc.pdf output doc.unc.pdf uncompress
Repair a PDF’s corrupted XREF table and stream lengths, if possible
pdftk broken.pdf output fixed.pdf
Burst a single PDF document into pages and dump its data to doc_data.txt
pdftk in.pdf burst
Burst a single PDF document into encrypted pages. Allow low-quality printing
pdftk in.pdf burst owner_pw foopass allow DegradedPrinting
Write a report on PDF document metadata and bookmarks to report.txt
pdftk in.pdf dump_data output report.txt
Rotate the first PDF page to 90 degrees clockwise
pdftk in.pdf cat 1E 2-end output out.pdf
Rotate an entire PDF document to 180 degrees
pdftk in.pdf cat 1-endS output out.pdf
A nice list of mistakes done by new users of linux is available at the following link:-
http://www.zdnet.com/blog/btl/10-mistakes-linux-newbies-make/34444
Tip #18: Partitioning a pen drive with label name
As root for a pen drive with device name /dev/sdb1 (ensure not mounted) give the following command:-
mkfs.vfat /dev/sdb1 -n <labelname>
For sudo based systems like Ubuntu don't forget to put sudo before mkfs.vfat.
Tip #19: Using mp3info to get the information from mp3 files in desirable format
This software had been pointed out by Exon in this thread earlier. I have made a script to show it in the format I want it. (Default one doesn't give the bitrate and time duration information. The order is not intuitive as well.)
This is the script I made:-
mymp3info.sh
mp3info -r a -p "File:%f \nTitle: %t\nArtist: %a\nAlbum: %l\nYear: %y \nBitrate: %.2r\nDuration: %02m:%02s\n" "$1"
This script gives output as shown for a file below:-
mymp3info.sh 01\ TERE\ NI\ KARARAN\ -\ INH100614651.mp3
File:01 TERE NI KARARAN - INH100614651.mp3
Title: Tere Ni Kanaran Mainu Pateya
Artist: Lal Chand Yamla Jatt
Album: Khedan De Din Chaar - LCYJ
Year:
Bitrate: 128.00
Duration: 06:38
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)