Archiwum tagów: bash

IT night 2014 recap & slides

IT Night 2014

First of all – this is a coolest event badge ever. Seriously – it’s awesomeness is about zoundsss! Thanks guys again for that!

So this night is over, I think we all had already enough sleep and now we’re able to do some recap. First of all – hard to say for me but this was my first IT night; somehow it happened that I couldn’t make it earlier (7 years to narrow it as this was 8th edition – lol). What was this night about? Everything that was somehow connected to IT topics; there were gaming consoles, Linux Millionaire – like trivia, throwing HDDs challenge, assembling PC challenge etc – all the things we did and we love or hate :) And of course – there were many talks given by awesome people (lol – including me) ;) But honestly – every one person who attended this night was really awesome – We could talk a lot with almost everyone and did not get bored :)

So – if you weren’t there – regret this all 365 following days and register to the next edition – it’s really a must – be event :) And for organizers – guys – you did a tremendous and great job – thank you for that!

My talk was about living and working in terminal. You can find this on Slideshare (embedded below). I also created GitHub project where I will develop those topics through the time. Wanna help? No prob – just ping me somehow ;)

(English) Calculating files size in bash

Ten wpis nie jest dostępny w języku polskim

Grep is Your friend

GREP stands for Global Regular Expression Print. I think that every sysop loves grepgrepping and anything that has something in common with grep – this tool makes our lives really easier ;) If You’re not convinced than I think You’re in a good place – maybe the following text will convince You :)

  1. Excluding irrelevant words: sometimes We have to grep for some word but We have to exclude some irrelevant string. E.g. let’s grep for ‘index.html’ but let’s also exclude ‘404’ from this:
  2. egrep (extended grep, same as grep -e or grep –regexp=) allows us to do more powerful search including regular expressions with metacharacters like +, ?, | and ()
  3. Counting results – If we just want to know the number of lines that matched our query – We would use:
  4. Case Insensitive search – by default grep is case sensitive, If we want to make case insensitive search than we use:
  5. Matching eXact word only – by default grepping for Word will return lines containing SomeWord and <strongwordbytheway< strong=””>. If We would like to find only those lines containing exact word Word We should use:

grep -w could be also useful here.

  1. Matching left and right side of the word – to search for instances of string matching Word in the end or start We use \< or \>:Below would match any word starting with access, like access_entry:

    Below would match any word ending with error, like general_error:
  1. Showing context results – sometimes We would like to grep for some errors in logs, but we also would like to view the context of that log entry – e.g. grepping for ‘Relay access denied‘ in Postfix logs to see If that error is occurring with some pattern:
  2. zgrep – this one would grep in the compressed gzip file – just like gunzip -c flog.gz | grep Word:
  3. Coloring matched words – We can highlight our matched words with some color (check man page to see how to set exact color):