Less known but useful bash Commands

Less known but useful Commmands

Redo last command but as root

sudo !!

Open an Editor, write a bash command

(and execute in shell)

ctrl+x+e

Create superfast Ramdisk

mkdir -p /mnt/ramm
mount -t tmpfs tmpfs /mnt/ram -o size=8192M

fix a really long command

(that you messed up)

fc

quickly create folders

mkdir -p folder/{sub1,sub2}/{sub1,sub2,sub3}

exit terminal but leave all processes running

disown -a && exit

fdupes

delete duplicate files without conformation

fdupes -r /path/to/folder

To manually confirm deletion of duplicated files

fdupes -r -d /path/to/folder

To automatically delete all copies but the first of each duplicated file

(be warned, this actually deletes files, as requested)

fdupes -r -f . | grep -v '^$' | xargs rm -v

I'd recommend to manually check files before deletion

1. write duplicates to text-file

fdupes -rf . | grep -v '^$' > files 

2. then manually check the files to delete and remove files that should not be deleted from file 3. remove all files that occour in the text-file with:

xargs -a files rm -v