Find text or string in files of a certain type

Posted by & filed under Linux, Mac OS X.

One can use grep “mystring” myfile.ext to find the lines in myfile.ext containing mystring. One could also use grep “mystring” *.ext to find mystring in all files with extension ext. Similarly, one could use grep “mystring” /directory to search for mystring in all files in the directory. What if one wants to search for mystring… Read more »

sftp with restricted folder

Posted by & filed under Linux.

I recently needed to set up an ftp server (or sftp server) that allows the user to transfer files. I had some restrictions: The account cannot have ssh access since I don’t want an unauthorized person to run jobs on the server. The account needs to be restricted to a single directory. I don’t want… Read more »

LPR printing on command line

Posted by & filed under Linux.

These days, with Linux distros such as Ubuntu, printing is quite easy. You can add and remove printers and print files just as easily (or even more so) compared to Windows or Mac. Sometimes I might just want to print from the command line. To do so, I make use of the lpr command. To… Read more »

Delete .DS_Store files

Posted by & filed under Linux.

I have a bunch of .DS_Store files in many directories in my home folder because I transferred them from my old system, a Mac OS X. To remove them, do find . -name .DS_Store -exec rm “{}” ‘;’ in ~/. Got this in the comments of this post.

Find files and find files containing certain text

Posted by & filed under Linux.

This is a reminder to myself as I keep forgetting how to do these basic searches in Linux. To find files with file name containing the text foo using the command find: ## find file with “foo” in file name find ./ -name *foo* ## replace ./ with path; can use shell style wildcards ##… Read more »

Bash batch script to convert org-mode file to html

Posted by & filed under Emacs, Linux.

I recently read this on reddit. I adapted the script on there to convert multiple org-mode files to html files. If you use it make sure you adapte the location of org-mode and your org.el file. Enjoy. #! /bin/bash ## http://www.reddit.com/r/emacs/comments/dy9yt/anyone_know_of_a_script_that_i_can_feed_an/ ## http://www.ibm.com/developerworks/library/l-bash2.html ## http://desk.stinkpot.org:8080/tricks/index.php/2007/02/concatenate-strings-in-bash/ f=”" for file in “$@” do ##emacs –batch -q –no-site-file… Read more »

Twitter in Pidgin

Posted by & filed under Linux.

I liked Adium in Mac OS X because it allows me to use all IM services (AIM, facebook, etc.), IRC, and Twitter in one application. For some reason Pidgin (based on libpurple like Adium) did not have Twitter support natively. [This](http://www.webupd8.org/2009/03/twitter-in-pidgin-plugin.html) site shows how, but it did not work. It appears pidgin-microblog in Ubuntu is… Read more »