some interesting alias

2011-09-27 1 min read Linux

For this time, I will just give you a link to to bashrc file.

http://hayne.net/MacDev/Bash/aliases.bash

Head over there and see some very interesting aliase’s.

Enhanced by Zemanta

Total upload and download on any interface.

2011-06-05 1 min read Bash Fedora

Something that I have been searching for a long time, finally some look inside the <a class=“zem_slink” title=“Procfs” rel=“wikipedia” href=“http://en.wikipedia.org/wiki/Procfs" _mce_href=“http://en.wikipedia.org/wiki/Procfs">/proc got me what I wanted. Hope this will save someone’s day. So far, the only option I could think of was to run conky which becomes a little heave on some of the very old laptops I have to use sometimes 🙁

  <td>
    <div class="text codecolorer">
      &nbsp;cat /proc/net/dev|grep eth2|awk '{print $2/1024/1024"&nbsp; "$10/1024/1024}'
    </div>
  </td>
</tr>
1
Enhanced by Zemanta

Ranking of the most frequently used commands

2011-01-31 2 min read Linux Uncategorized

Lets take a quick look at how to get the most frequently used commands on you shell. So what we need to do is this:

  <td>
    <div class="text codecolorer">
      history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -n | tail | sort -nr
    </div>
  </td>
</tr>
1

So, how did we arrive at this and will this always work? No it might not always work. A typical example is where HISTTIMEFORMAT variable is set. In that case, if you check history, you will see that after the number column we have time and date in the specified format, in which case, you will get wrong information from the above command. Anyways, forgetting these special cases, lets go to how we got this command:

Continue reading

write the output of a command to /var/log/user.log… each line will contain $USER, making this easy to grep for.

2010-12-28 2 min read Bash Learning Linux

write the output of a command to /var/log/user.log… each line will contain $USER, making this easy to grep for.

  <td>
    <div class="text codecolorer">
      &nbsp;log() { (echo "$ $@";$@) | logger -t $USER; }
    </div>
  </td>
</tr>
1

This command is useful if you want to copy the output of a series of commands to a file, for example if you want to pastebin the output from ‘uname -a’, ‘lspci -vvv’ and ‘lsmod’ for video driver trouble-shooting on your favorite Linux forum.

Continue reading

function for copy files with progress bar (using pv – pipe viewer)

2010-11-11 1 min read Bash Linux

function for copy files with progress bar (using pv – pipe viewer)

  <td>
    <div class="text codecolorer">
      &nbsp;cp_p() { if [ `echo "$2" | grep ".*/$"` ]; then pv "$1" > "$2""$1"; else pv "$1" > "$2"/"$1"; fi; }
    </div>
  </td>
</tr>
1

dont have to type new file name (it copy file under same name) and dont have to use ‘/’ in the end of destination folder (but you can if u want, its idiot proof)

Continue reading

Remove some path from the PATH variable temporarily.

2010-09-04 2 min read Bash Linux

How many times has it happened to you that you are working on some linux platform (like Fedora/Ubuntu/CentOS etc) and suddenly you see that you need to remove some path from the PATH variable so that a script is executed from some other path. It really difficult to do this if the path is too long and if you end up doing this couple of times. If that is the case, then the below script is for you 🙂

Continue reading
Older posts Newer posts