Viewing log files without using vi or any other text editor

2010-01-16 1 min read Linux

This is quite useful for viewing files without opening them.. Saves quite a lot of time in viewing the logs 🙂

Want to see the first 5 lines of the /etc/passwd file? Pretty easy, just use the "head" command:

head -5 /etc/passwd

Want to see the last 20 lines of the /etc/passwd file? Again, pretty easy, just use the "tail" command:

tail -20 /etc/passwd

But what if you only want to see lines 10-15 of a given file? Neither the "head" nor the "tail" commands alone will do. Instead, use the "sed" command to print the range of lines you want to see:

Continue reading

View information on all the rpms installed.

2010-01-16 1 min read Fedora Linux

This post if applicable to all the distro’s which are based on rpm.

If you look at the number of rpms installed on your system, you will see it somewhere around 500-2000. Noe thats a pretty huge number. So sometimes I keep wondering what are these rpms for. Heres a command that can help you figure out what these rpms are for:

rpm -qa –info

And if you want to find info on all the files and put it in a file too:

Continue reading

Speed up gnome and change widow manager for gnome.

2010-01-13 3 min read Linux

I have been planning to do this for quite some time now. So finally I did this today. Actually I wanted to use some features of gnome like tracker and gnome-settings and quite a few other things along with running cairo-dock and still wanted the system to use less memory and faster response. It is well known fact that gnome/kde takes a lot of memory and CPU thus wanted to run some other window manager like fluxbox or blackbox. I went with fluxbox, as that suits my needs very well, so heres what I did:

Continue reading

Send mail to yourself and read in your favourite client and configure the rules to move to directory.

2010-01-10 2 min read Fedora Linux

By default when you send a mail using sendmail, the mail goes to the default directory. What I wanted to do was, use rss2email, to send the mails and then sort them in different folders depending on the From address.

Sendmail uses procmail to deliver mail locally. So here’s what I had to do:

Configure the rss2email to send the mail to amit@localhost

Next, configure the procmail to deliver mail to my home directory. To do this we will use the procmailrc file in the home directory. The contents of the file are :

Continue reading

Remove Invalid characters in Filename.

2010-01-10 1 min read Linux Photo

Sometimes I end up having some invalid characters in filename like ? & and so on.

So simple bash script to get rid of them:

for i in `find . -type f`
do
echo $i
mv $i `echo $i |tr ? _|tr = _ |tr ’&’ ’_’`
done <a name="more">

change the terminal title dynamically in X11

2010-01-09 1 min read Bash GNOME Linux

I was actually looking for this for quite sometime. Some years back in my bashrc was the proper setting for setting the terminal title when I did a cd, and I had completely forgotten how to do it. So today I searched quite a few commands the environment variables for doing the same and found it again.

Here it is (Just put this in your bashrc or bash_profile):

export PROMPT_COMMAND=&#8217;echo -ne &#8221;\033]0;`pwd`&#8221;; echo -ne &#8221;\007&#8221;&#8217;

Continue reading

The document editor that is revolutionary and breaking the typewriter paradigm.

2010-01-08 1 min read Fedora Linux

Today, I thought I will try something different for word processor requirements, for non-text files. For text  files, vi rocks for me 🙂

So, I tried LyX, here is the description of the editor:

Description: LyX is a modern approach to writing documents which breaks with the
obsolete &#8221;typewriter paradigm&#8221; of most other document preparation
systems.  It is designed for people who want professional quality
output with a minimum of time and effort, without becoming
specialists in typesetting.  The major innovation in LyX is WYSIWYM
(What You See Is What You Mean). That is, the author focuses on
content, not on the details of formatting. This allows for greater
productivity, and leaves the final typesetting to the backends
(like LaTeX) that are specifically designed for the task.  With
LyX, the author can concentrate on the contents of his writing, and
let the computer take care of the rest.

<img src="file:///tmp/moz-screenshot.jpg" alt="" />

Continue reading
Older posts Newer posts