Archive for the ‘Linux’ tag
Configuring service startup in Ubuntu
If you are one of the old-timers who has migrated to Ubuntu from RedHat/Fedora distribution in the past, you might be familiar with the ntsysv tool in those Linux versions. I used to use that oddly-named tool to switch-on/off services in my Linux box. I was searching for a similar tool for Ubuntu, and found rcconf:
$ sudo apt-get install rcconf $ rcconf
Linux: Diff between two folders
To find the files which are in one and not in the other:
$ diff -r folder1/ folder2/
To find the file content differences:
$ diff -r -N folder1/ folder2/
OpenSource Font Manager
Fontmatrix is an excellent Font organizing Software available for Linux, Windows and MacOS.
To install it in all Debian based systems (including Ubuntu):
$ sudo apt-get install fontmatrix
Screenshot of Fontmatrix running in my system:
Mounting WebDav in Ubuntu
$ sudo apt-get install davfs2 $ sudo mount -t davfs http://localhost:8080/alfresco/webdav <filesystem_folder>
Finding the width and height of Ogg Theora videos
When placing Ogg Theora video files in your site using HTML5 <video> tags, you can optionally specify the width and height of the videos. But how do you find the width and height? Use the tool ogginfo:
$ ogginfo video.ogg
Text-to-speech in Linux
Festival is an interesting OpenSource project for converting text-to-speech in Linux environment. It has a commandline tool text2wave which converts, guess what, text to voice in wave format. Simple usage:
$ echo "Hello World" | text2wave > a.wav
Wave files are uncompressed, and occupy lot of space. To encode to Ogg Vorbis format:
$ oggenc a.wav
This will create a.ogg in the current directory.
Desktop Video Capture in Linux
recordmydesktop is a powerful screencasting commandline tool for Linux. To capture the screen:
$ recordmydesktop
Press Ctrl+C to quit capturing. The captured video will be encoded in Ogg Theora format and saved as out.ogv (if out.ogv exists, as out-1.ogv and so on). To save the file in another name, say myout.ogv:
$ recordmydesktop myout.ogv
There is also a GTK frontend for recordmydesktop. To launch it:
$ gtk-recordMyDesktop
Encoding to Ogg Theora Format: For use in HTML5
To encode a video file for use in HTML5 video compatible browser (firefox 3.5 and above supports HTML5 video), use the command:
$ ffmpeg -i in.flv -vcodec libtheora -sameq \ -acodec libvorbis -ac 2 -sameq out.ogg
Finally use it in your page:
<video src="out.ogg"> Your browser does not support HTML5 video. </video>
Reference: HTML 5 <video> Tag.
Video format conversion in Linux
To stream video content using Video View Portlet, I had to re-encode some videos to flv format. This is pretty simple in Linux:
$ mencoder -oac copy -ovc lavc -o out.flv in.avi
-oac means Output Audio Codec and -ovc means Output Video Codec. The various options for -oac:
| copy | no encoding, just streamcopy. |
| pcm | Encode to uncompressed PCM. |
| mp3lame | Encode to MP3 (using LAME). |
| lavc | Encode with a libavcodec codec. |
The options for -ovc:
| copy | no encoding, just streamcopy. |
| raw | Encode to an arbitrary uncompressed format (use ’-vf format’ to select). |
| lavc | Encode with a libavcodec codec. |
Crontab quickies
When searching the Web for setting hourly cron job, I was pleasantly introduced to a simplified syntax:
@hourly <application>
For understanding the shortcut commands, go through the complete documentation of the crontab syntax by typing man 5 crontab in your command-prompt.
Color Picking in Linux
Which color-picking software do I use? I found out two options (both are GTK based):
- gpick: The project also has binaries for popular Linux distros available.
- gcolor2: This is part of the Debian repository.
Linux Screen Rulers
Recently I have been working with a demanding Web Designer based client. She was insisting on pixel-level spacing and detail. Thus I wanted to have a Screen Ruler for measuring her template. I use Ubuntu-based Linux, and found the following tools in its repository:
For KDE users:
$ sudo apt-get install kruler
For GNOME users:
$ sudo apt-get install screenruler
Linux command-line XSLT
To convert an XML based on a XSL, use this command:
$ xsltproc /path/to/xsl.xsl /path/to/xml.xml
The converted document will be written to STDOUT. To write to a particular file, you may use the -o parameter:
$ xsltproc /path/to/xsl.xsl /path/to/xml.xml -o out.html
Check the info/man pages for additional information.
Haskell: The first step (Installing Haskell Compiler in Linux)
Today visited the Chennai Book Fair. And in pursuit of my New Year Resolution, I bought Real World Haskell book. I am running Mint Linux, and installed the GHC compiler thus:
$ sudo apt-get install ghc6 $ sudo apt-get install libghc6-mtl-dev
Accessing WebDAV From Commandline
Linux has a wonderful commandline tool for accessing WebDAV resources. It is cadaver. To access any resource:
$ cadaver http://portale:8080/alfresco/webdav/Web%20Projects
If the resource requires authentication, cadaver will prompt for it. Then you may use the standard UNIX and FTP commands for navigating and manipulating content. Some of the common commands are: cd, pwd, ls, put, get, mput, mget, less, cat and delete. Similar to FTP commands, it has corresponding local commands too: lcd, lpwd and lls.
Edit In-line
To edit a file in-line in cadaver, just issue the edit <file-name> command. The default editor will open the file. To change the editor (to, say, emacs), issue the command: set editor emacs from cadaver prompt.
