Delete all files in a folder that don\’t match a certain file extension

$ rm !(*.foo|*.bar|*.baz)

Deletes all files in a folder that are NOT *.foo, *.bar or *.baz files. Edit the pattern inside the brackets as you like.

\"\"

by David Winterbottom (codeinthehole.com)

\"\"
\"\"

\"\"

URL: http://feedproxy.google.com/~r/Command-line-fu/~3/TCRb2ku_V1Y/delete-all-files-in-a-folder-that-dont-match-a-certain-file-extension

\"Reblog

Lock the hardware eject button of the cdrom

$ eject -i 1 This command will lock the hardware eject button of your cdrom drive. Some uses are:

1: If you have a toddler and has discovered the cdrom button

2: If you are carrying a laptop in a bag or case and don\’t want it to eject if the button is inadvertently pressed.

To unlock the button use:

eject -i 0

\"\"

by David Winterbottom (codeinthehole.com)

\"\"
\"\"

\"\"

URL: http://feedproxy.google.com/~r/Command-line-fu/~3/_ZEuVoJP8nE/lock-the-hardware-eject-button-of-the-cdrom

\"Reblog