How to: Use pacman commands with apt-get

As a Arch Linux guy, i’m a keen pacman user. But when i have to work with my Debian box and its package management software apt-get, i struggle using it.

As a result, i created simple shell function to convert pacman style commands to their apt-get equilevants (with help of arch wikis rosetta stone).

Just place this in your ~/.bashrc:

function pacman () {
	case $1 in
		-Syu)
			sudo apt-get update && sudo apt-get upgrade
		;;
		-S)
			sudo apt-get update && sudo apt-get install "${@:2}"
		;;
		-Ss)
			apt-cache search "${@:2}"
		;;
		-Si)
			apt-cache show "${@:2}"
		;;
		-Qs)
			dpkg --get-selections | grep "${@:2}"
		;;
		-Qi)
			dpkg -s "${@:2}"
		;;
		-R)
			sudo apt-get remove "${@:2}"
		;;
		-Ru)
			sudo apt-get autoremove "${@:2}"
		;;
		*)
			echo "Please use proper paremeter (eg. -Ss)"
		;;
	esac
}
;;

Unfortunately, i haven’t figured out how to use make sudo work with this functions, so i implemented sudo as a part of the commands. Let me know if you have any idea.

Leave a Comment

Filed under Sekalaiset