Awesome bash functions

A pink offroad lambo
Yee Haw!

It seems that there are more partitions on a linux computer than ever before. Here is a function to show the disk free space in a human readable format, while skipping over some of the system partitions:

function dfh {
	# clean disk usage listing:
	df -h | head -n 1 &&\
	df -h | grep -v \
		-e '^tmpfs' 	\
		-e '/boot/efi' \
		-e '/boot' \
		-e '^Filesystem' \
		-e '^efivarfs' \
		 --color=never
 }

Here is a function to briefly show what filesystems are mounted. This filters out the system supplied mounts that I don't care to see. If a new one shows up, I add a line to filter it:

function mmount {
	# Show MY filesystems.
	mount | grep  -v \
	-e '^sysfs' \
	-e '^proc' \
	-e '^udev' \
	-e '^devpts' \
	-e '^tmpfs' \
	-e '^securityfs' \
	-e '^cgroup2' \
	-e '^pstore' \
	-e '^efivarfs' \
	-e '^bpf' \
	-e '^systemd' \
	-e '^debugfs' \
	-e '^tracefs' \
	-e '^hugetlbfs' \
	-e '^mqueue' \
	-e '^fusectl' \
	-e '^configfs' \
	-e '^ramfs' \
	-e '^/var/lib/snapd' \
	-e '^binfmt' \
	-e '^tracefs' \
	-e '^nsfs' \
	-e '^portal' \
	-e '^gvfsd-fuse' \
	-e '/boot/efi' \
	-e '/var/snap' \
	-e '/var/lib/docker' \
	-e '/var/lib/lxcfs' \
	;
 }

This function allows the user to rename their terminal window. It works my manipulating the $PS1 shell variable. You can adapt it to use your own style.

function termname {
	# rename the terminal window or tab.
	if [ -z "$1" ]; then
		echo "Usage: termname NAME"
		return 1
	 fi

	# Set the new terminal name
	local TERMNAME="$1"

	PS1=$(python3 -c "print(r'\[\e]0;'+'$TERMNAME'+r'\a\]\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ')")

 }

So, yeah, I added these to my .bashrc and it changed my life.