The Recommended Way To Clean The Package Cache In Arch Linux

Finally I’ve found a comprehensive post of how to clean the package cache in Arch! Thanks SK!

And before you go for a cache trim, maybe you want to check what packages you have installed and their size:

pacman -Qi | egrep '^(Name|Installed)' | cut -f2 -d':' | paste - - | column -t | sort -nrk 2 | grep MiB | less

Copying local files and folders with rsync

To copy the contents of one local folder into another, replacing the files in the destination folder. The parameter -a also makes the copy recursive and preserve the modification times, but additionally it copies the symlinks that it encounters as symlinks, preserve the permissions, preserve the owner and group information, and preserve device and special files. This is useful if you are copying the entire home folder of a user, or if you are copying system folders somewhere else.

rsync -rtav source/ destination/


Trailing Whitespaces in VIM

Trailing whitespaces don’t bother me in general, let’s be clear, I don’t like them but there are other thousands things that bother me more. Although I hate (with hate, I mean it) when someone sends me a patch and I can’t apply it cleanly because of the trailing whitespaces… in this moment I understand this guy and this other trailing whitespaces hater.

Since I use Vim I leave here some solutions to remove and highlight them automatically.

Add to your .vimrc


autocmd FileType c,cpp,vhd,h,sv,svh autocmd BufWritePre <buffer> %s/\s\+$//e



highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()


Got it from:

#1 CD Command Hacks – Linux Hacks Series


Use CDPATH to define the base directory for command

$export CDPATH=~:/etc:/proc
$cd systemd
From the book “Linux 101 Hackers”, Ramesh Natarajan.
MKDIR and CD in one shot

Add this function to your bash_profile

$vim .bash_profile 
function mkdircd () { mkdir -p "$@" && eval cd "\"\$$#\""; }
From the book “Linux 101 Hackers”, Ramesh Natarajan.

Toggle between the last two directories

$cd -

will bring you to the previous path you were. If you use it again, you are back in path you were the first.

From the book “Linux 101 Hackers”, Ramesh Natarajan.
Using the directory stack

You can use the directory stack to store directory paths, display and cd to it.

  • dirs: Display the directory stack
  • pushd: Push directory into the stack
  • popd: Pop directory fom the stack and cd to it
From the book “Linux 101 Hackers”, Ramesh Natarajan.

For more examples visit the blog of the geekstuff