apt aliases

Hey there to the few Anglophone readers that still visit this site! Today’s post is not as short as usual but rather to the point, plus it also comes with an important announcement. But first things first so, let me just share with you guys a couple of bash aliases that I find particularly useful for dealing with apt or, in other words, when it comes to add/remove software from the command line in a Debian-based distro:

# ~/.bashrc: executed by bash(1) for non-login shells.
# some apt aliases
alias add="sudo apt-get install --allow-unauthenticated -y"
alias fix="sudo apt-get install --fix-broken --assume-yes"
alias remove="sudo apt-get remove --assume-yes"
alias update="sudo apt-get update --assume-yes"
alias upgrade="sudo apt-get upgrade --assume-yes"
alias expunge="sudo apt-get autoclean --assume-yes"
alias flush="sudo apt-get autoremove --assume-yes"

Interesting? If you liked the idea and actually want to use them, it’s as simple as pasting those anywhere within your .bashrc file.

Okey so now it’s time to my oh-so-important announcement! Well, since I’ve been trying to kind of have a blog here for a year a half now, and given that the overall feedback has been, let’s say far less frequent than my original expectations really, but most importantly because I know some of you were really waiting for this, I’ve decided to start posting in Spanish :)

That’s pretty much it. Muchas gracias por leerme y los despido entonces hasta la próxima.

PD: No quería dejar de saludar a todos mis compatriotas, deseándoles un muy feliz Día de la Independencia!
Un abrazo,

Self-contained crontab Cheatsheet

This time I’m bringing you a self-documented cron table file (with an example), that is, a tidy cheatsheet diagram embedded as comments that does just one thing, helps you remember the crontab syntax:

# * * * * * command to be executed
# - - - - -
# | | | | |
# | | | | +- - - - day of week (0 - 6) (Sunday=0)
# | | | +- - - - - month (1 - 12)
# | | +- - - - - - day of month (1 - 31)
# | +- - - - - - - hour (0 - 23)
# +- - - - - - - - minute (0 - 59)

# Alarm clock set to 6:30AM
30 6 * * * /home/nano/alarm

I hope you find it useful, thanks for reading and happy May Revolution Day to everyone!

The Awakeness of Shell Scripting with AWK

I guess I’m getting too used to the “it’s been a while!” thingy so, awkward title aside, let’s just move straight to today’s post:

The more I learn about AWK, the more I love it. It’s just that simple. I’ve been trying its powers a bit and came with an awk-mazing (and probably useless, but still exciting) five-lines (sans comments) cute script that emulates the most popular feature (the “-e” option) of our good ol’ boy apropos.
Enter lazyman!

#!/bin/bash
#
# lazyman.sh - displays the name section of some program’s man
# page.
#
# DESCRIPTION
# this tiny script shows the NAME section of a given program’s
# manual page, displaying an output quite similar to
# “apropos -e” but directly calling “man” instead of querying
# against “mandb”.
#
params=$(echo $@ | awk 'END{print NF}')
case $params in
1) man $1 | awk '/NAME/{getline;print}' ;;
*) echo "usage: lazyman.sh [program]" ;;
esac

That’s all folks! I hope you’ve enjoyed it and thanks for reading!

UNIX Programming: Simple Notifications With mailx

Hey there! I know it’s been a month since my last post, I’m sorry about that but I’ve been pretty busy this days, having a lot to do at work and also being a full time student, so anyway, this time I’m sharing with you a nifty tip regarding notifications using mailx on UNIX, so without further ado, here’s the actual code:

#!/bin/ksh
#
# mailx settings:
#
to="someone@somewhere.com"
subject="[Notification] Something happened."
body="Lorem ipsum dolor sit amet et cétera."
#
# run and notify:
#
runSomething && (echo $body | mailx -s "$subject" "$to")

I hope you find it interesting, thanks much for reading and don’t hesitate to leave a comment!

Next Page »