Linux find command – Find file and directories faster and easier

2010-03-16 1 min read Linux

 

This command is very powerfull when used with combination of filters and pipes and RE.

I will give some example:

find . -type f –» List all files
find . -type f -exec rm {} <a class=“zem_slink” title=“Path (computing)” href=“http://en.wikipedia.org/wiki/Path_%28computing%29" rel=“wikipedia”>\; –» Delete all files
find . -type d -exec rm {} \; –» Will through some common errors 🙂
find . -name "name"  –> find files containing name in the filename
find . -atime 12 –> Find files accessed 12 days ago

Continue reading

eclim for Fedora – Leonidas – installation.

2010-03-08 1 min read Linux Vim Tips

Here is the installation instruction for Eclim for vim. I have not tried it as I did not require it, but if you need it.

http://downloads.sourceforge.net/project/eclim/eclim/1.4.8/eclim_1.4.8.tar.gz?use_mirror=biznetnetworks

sudo ant -Declipse.home=/usr/lib/eclipse -Dvim.files=/home/amitag/.vim -Dplugins=cdt

create ctgs using

ctags -R /usr/include/<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://spf13.com/post/vim-crash-course">VIM Crash Course (spf13.com) <li class="zemanta-article-ul-li"><a href="http://go.theregister.com/feed/www.theregister.co.uk/2010/01/26/sourceforge_ip_address_filtering/">SourceForge bars 5 nations from open source downloads (go.theregister.com) <li class="zemanta-article-ul-li"><a href="http://blog.amit-agarwal.co.in/2010/01/22/my-project-in-sourceforgenet-gnomedesktopwal/">My project in sourceforge.net gnomedesktopwal (amit-agarwal.co.in) <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/0fb78d60-4b1a-4563-8ffa-f572041a3a64/"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_b13.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">

Continue reading

Splitting strings with IFS

2010-02-04 2 min read Bash Linux

Today I want to discuss splitting strings into tokens or “words”. I previously discussed how to do this with the <a href="http://bashcurescancer.com/reading-a-file-line-by-line.html">IFS variable and promised a more in depth discussion. Today, I will make the case on WHY to use IFS to split strings as opposed to using a subshell combined with <a class="zem_slink freebase/en/awk" title="AWK" rel="homepage" href="http://cm.bell-labs.com/cm/cs/awkbook/index.html">awk or cut.

I wrote this script which reads the /etc/password file line-by-line and prints the <a class="zem_slink freebase/en/user" title="User (computing)" rel="wikipedia" href="http://en.wikipedia.org/wiki/User_%28computing%29">username of any user which has a UID greater than 10 and has the shell of /sbin/nologin. Each test function performs this task 10 times to increase the length of the test:

Continue reading

Understand Awk Variables with 3 Practical Examples

2010-01-28 1 min read Learning Linux

<a id="aptureLink_gQhJKQ92Kn" style="padding: 0px 6px; float: left;" href="http://www.gnu.org/software/gawk/manual/gawk.html"><img style="border: 0px none;" title="The GNU Awk User's Guide" src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/ph/400x270_WebClip" alt="" width="400px" height="270px" />

<a id="aptureLink_CLV4LbC1Dr" style="padding: 0px 6px; float: right;" href="http://gnuwin32.sourceforge.net/packages/mawk.htm"><img style="border: 0px none;" title="Mawk for Windows" src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/ph/400x270_WebClip" alt="" width="400px" height="270px" /> This article is part of the on-going Awk Tutorial and Examples series. Like any other <a class="zem_slink freebase/en/programming_language" title="Programming language" rel="wikipedia" href="http://en.wikipedia.org/wiki/Programming_language">programming languages, Awk also has user defined variables and built-in variables. In this article let us review how to define and use <a class="zem_slink freebase/en/awk" title="AWK" rel="homepage" href="http://cm.bell-labs.com/cm/cs/awkbook/index.html">awk variables. Awk variables should begin with the letter, followed by it can consist of alpha numeric characters or underscore. Keywords […]

Continue reading

Short Information about loaded kernel modules

2010-01-24 2 min read Linux

There are couple of ways you can find the information on the <a class="zem_slink" title="Loadable kernel module" rel="wikipedia" href="http://en.wikipedia.org/wiki/Loadable_kernel_module">loadable kernel modules. All these would always involve calling <a class="zem_slink" title="Lsmod" rel="wikipedia" href="http://en.wikipedia.org/wiki/Lsmod">lsmod to get the loaded kernel modules and then calling modinfo to get the info on the loaded modules. I will show you with examples:

$ lsmod
Module                  Size  Used by
cdc_acm                19616  0
vfat                    8744  9
fat                    41836  1 vfat

Continue reading

Seders\’s grab bag – Tutorials

2010-01-24 3 min read Bash Fedora Learning Linux

<a href="http://sed.sourceforge.net/grabbag/tutorials/">http://sed.sourceforge.net/grabbag/tutorials/

<span style="font-size: x-large;"><a href="http://sed.sourceforge.net/grabbag/">seder&#8217;s<a href="http://sed.sourceforge.net/grabbag/"> grab bag

  • <a href="http://sed.sourceforge.net/grabbag/scripts/">scripts

  • <a href="http://sed.sourceforge.net/grabbag/tutorials/">tutorials

  • <a href="http://sed.sourceforge.net/grabbag/seders/">seders

  • <a href="http://sed.sourceforge.net/grabbag/ssed/">ssed

  • <a href="http://sed.sourceforge.net/grabbag/links/">links

  • <a href="http://sed.sourceforge.net/grabbag/tutorials/#intros">Intros

  • <a href="http://sed.sourceforge.net/grabbag/tutorials/#advanced">Advanced

  • <a href="http://sed.sourceforge.net/grabbag/tutorials/#misc">Miscellaneous

<span style="font-size: large;">Sed Tutorials

If you have written anything about sed – whether an introduction, how sed got you out of a real-life situation, or perhaps an advanced technique you&#8217;ve discovered – you may like have your work published here. <a href="mailto:bonzini@gnu.org">Your contribution will be very welcome.

Continue reading

Perl script to create csv files with a pattern – Generic script.

2010-01-19 1 min read Learning Linux Perl

I was having a really bad day and needed a quick solution to create some csv files. And this I needed to do for multiple data kinds and patterns, so I created this small script to do the job for me…

#Number of rows required in the output.

$rows = 100;

#The config and the output file

open (CF_FILE, &#8221;<Config.test&#8221;);
open (OUT_FILE, &#8221;>test.csv&#8221;);

#—————————————————————————
# No need to change anything below this.
#—————————————————————————

Continue reading
Older posts Newer posts