Search files by containing text

grep -rnw '/path/to/somewhere/'-e "pattern"

    -r or -R is recursive,
    -n is line number, and
    -w stands match the whole word.
    -l (lower-case L) can be added to just give the file name of matching files.
    Along with these, --exclude or --include parameter could be used for efficient searching. Something like below:

grep --include=\*.{c,h}-rnw '/path/to/somewhere/'-e "pattern"

This will only search through the files which have .c or .h extensions. Similarly a sample use of --exclude:

grep --exclude=*.o -rnw '/path/to/somewhere/'-e "pattern"

Above will exclude searching all the files ending with .o extension. Just like exclude file it's possible to exclude/include directories through --exclude-dir and --include-dir parameter; for example, the following shows how to integrate --exclude-dir:

grep --exclude-dir={dir1,dir2,*.dst}-rnw '/path/to/somewhere/'-e "pattern"

This works very well for me, to achieve almost the same purpose like yours.

For more options :

man grep

Search a file

find /path/of/file -name 'name*file*.*'

Show last lines from a log file

tail -n 1000 /var/log/mail.log | more
  -n 100 = last 100 lines
  more = to be able to view file line by line

Download a file

wget <> -P </path/to/folder>

Lock remote access for root user

vi /etc/ssh/sshd_config
change: "PermitRootLogin yes" -> "PermitRootLogin no"
/etc/init.d/ssh reload

Show all users (ubuntu)

cat /etc/passwd | cut -d":" -f1
(etc/shadow - users file)

Lock user for login

passwd <username> -l

unlock user for login

passwd <username> -u

Grant executing rights to the current user

chmod +x (datei)

Change folder or file owner

chown <newowner> -R /path/

-R recursive

Unpack tar-archive

tar xf [ARCHIV].tar
- x unpack
- f File

Create tar-archive

tar -cvzf /path/[ARCHIV].tgz /path/to/folde

Create a file

touch <filename>

Add user to the sudoers file

open Sudoers file (/etc/sudoers) and add:

# User privilege specification
<username>    ALL=(ALL:ALL) ALL

Install rpm file

sudo rpm -i <filename>.rpm


Delete file or folder

rm -rf <ordername>

delete all files in current folder

rm -rf *

-r - recursive
-f - force (delete without warnings)

show current directory


show which sub-folders spend how much disk space

du -h --max-depth=1 </folder> | sort -hr

-h, --human-readable           print sizes in human readable format

Create database dump

1. Login to the system

ssh <username>@<ip>

2. create a dump

mysqldump --opt -p -u <user> <database> > filename.sql

-p = use a user password

> filename.sql = the file will be created if it not exists

Load database dump

1. Login to the system

ssh <username>@<ip>

2. load a dump

mysql -v -u <user> -p <database> < filename

-v = show the output

< filename = the name of the dump file (can be filename.sql too)


There are two ways to configure a license file:

  1. Upload your .lic file manually to http://localhost:8080/alfresco/service/enterprise/admin/admin-license
  2. add a property to the file - dir.license.external=/path/to/license/folder


Go to the page with services and klick "refresh"

for Repository


for Share



Creating a custom configuration file: portal-log4j-ext.xml

The first step is to get a copy of the original configuration file. Depending on our environment the portal-log4j.xml can be found in:

  • Liferay's sources: portal-impl/classes/META-INF/
  • Tomcat bundle: inside $TOMCAT/WEB-INF/lib/portal-impl.jar in META-INF/

Make a copy of that file and rename it as portal-log4j-ext.xml. It is recommended that you only keep in that file those entries that have been modified, delete the other entries, since they'll be loaded from portal-log4j.xml.

The file has to be deployed inside a directory $TOMCAT_HOME/webapps/ROOT/WEB-INF/classes/META-INF

For more informations see here: