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

Browser and OS stats on my blog

2010-01-16 0 min read Uncategorized
\"{{en|Summary:
Image via Wikipedia

I have been thinking of posting this for some time, but here are some stats from my <a class="zem_slink freebase/en/website" title="Website" rel="wikipedia" href="http://en.wikipedia.org/wiki/Website">website:

OS Stats :

<a href="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/OS.jpg"><img class="size-full wp-image-1516" title="OS stats for blog.amit-agarwal.co.in" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/OS.jpg" alt="OS stats for blog.amit-agarwal.co.in" width="429" height="311" />

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 &#8217;&&#8217; &#8217;_&#8217;`
done <a name="more">

Older posts Newer posts