Skip to main content

Raymii.org Raymii.org Logo

Quis custodiet ipsos custodes?
Home | About | All pages | Cluster Status | RSS Feed

Some Bash and Arch Tweaks

Published: 01-01-2012 | Author: Remy van Elst | Text only version of this article


❗ This post is over thirteen years old. It may no longer be up to date. Opinions may have changed.


So, I have some nice tips for your .bashrc, with screenshots. Also a handy command to show your biggest packages in pacman/arch.

Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below. It means the world to me if you show your appreciation and you'll help pay the server costs:

GitHub Sponsorship

PCBWay referral link (You get $5, I get $20 after you've placed an order)

Digital Ocea referral link ($200 credit for 60 days. Spend $25 after your credit expires and I'll get $25!)

Simple Calendar with today marked as

tcal

alias tcal='cal | sed "s/^/ /;s/$/ /;s/ $(date +%e) / $(date +%e | sed '''s/./#/g''') /"' 
Fast cd up:
alias ..='cd ..'
alias ...='cd ../..' 
Network Info (LAN IP, IP and MAC):

netinf

netinfo ()
{
echo "Internal IPv4 address of eth0: "; ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
echo "External IPv4 address: "; wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/
Biggest folders in directory Gigabyte version:

dug

alias dug='du -h | grep ^[0-9.]*G | sort -rn | head -n 20'
Biggest folders in directory Megabyte version:

dum

alias dum='du -h | grep ^[0-9.]*M | sort -rn | head -n 20'
Process Grep:

pg

alias pg='ps -ef | grep '
Nice greeting when opening a bash shell:

welcome

PS1="u@h  -  tn${PWD}/ -$ "
echo "Welkom Remy,"
echo "Het is vandaag:";
date
echo "Deze PC draait op een:" 
/bin/uname -p
echo ""
netinfo;

(put this one at the end of your .bashrc file)

And the huge packages finder:

dup

#!/bin/bash
pacman -Qi | awk '/Name/ { name=$3 } /Size/ { printf "%.3fMBt%sn", $4/1024, name }' | sort -rh | head -n $1
exit 0

(I've put this in /usr/bin/dup and chmodded it to 755).

Thanks to the arch forum for most of these tips!

Tags: alias , arch , bash , snippets , tweaks