linux

Tag Archive

Extract regular expression group match using grep or sed

I've been looking for a GNU/Linux command that matches lines in a text file using a regular expression and extracts a group match for that expression (a sub-match within parenthesis). It would be really handy if the grep command supported this as an output option, but unfortunately it does not. However there are at least two ways to approach this problem. I'll show you one with grep and one with sed. Read more...

2012-05-09

Linux file permissions to only delete owned files

Coming from a Windows background, I was surprised to find out that when it comes to Linux file permissions, a user can delete a file that they don't own and have no write permissions to. Well, that is the default behavior if you don't set up your ownership and permissions exactly correct. Find out how here. Read more...

2011-11-18

Bash script to copy permissions

This is a bash script that I've used on Ubuntu in order to copy the permissions from a file or directory, onto the whole structure of another directory. I've found that this is something I like to do quite often and wanted some automation for this operation. Read more...

2010-12-04
Twitter: @mikeplate