2/09/2012

Restore file permissions

I didn't test it but it must work for owners and owner groups too. Something like:

2/07/2012

Find a directory by name in linux

-type d == directory
-name '.svn' == all directories named .svn
-ls == converts unusual characters to C style escape sequences

To delete the list of directories returned by the above command execute xargs builds and executes command lines from standard input
/bin/rm -dr == remove command with the directory and recursive flags

2/01/2012

Group Sticky bit

To ensure that the group owner of existing and new files stays the same set the group sticky bit like so:

1/16/2012

List installed packages

5/10/2011

Debian adduser

Debian / Ubuntu: Add to sudo group (Debian / Ubuntu specific step):

11/01/2010

Ubuntu - find current graphics card model

lspci | grep VGA

More detailed information can be found by running:
sudo lshw -C video

10/31/2010

Split a string in Java

If you have a string as follows:

Lorem Ipsum   Foo Bar

and you want to split it by whitespaces, you can't do

myString.split(" ");

because the output would be ("Lorem", "Ipsum", " ", "Foo", "Bar")

Obviously the desired output would be: ("Lorem", "Ipsum", "Foo", "Bar")

To do that in java use: myString.split("\\s+");