modify message of last unpushed commit

git commit --amend -m "New commit message"

create tag:

git tag -a MY_VERSION -m „my version 1.0-Release“
git push origin [tagname]

git tag - show all tags
git show MY_VERSION

change repository for pushes
git remote set-url origin ssh://<git@.../new_repository.git>
git push -u origin master

create new local branch
git checkout -b <branchName>

create new remote branch
1. create local branch
git checkout -b <branchName>

2. push local branch. origin = <remote>
git push origin <branchName>

3. set tracking information for this branch you can d
git branch --set-upstream-to=origin/<branchName> <branchName>

delete .orig files
git clean -f

make visible new remote branch local
git pull

merge my branch with other branch
git merge <other_branch> --no-ff

--no-ff - create a merge commit even when the merge resolves as a fast-forward

merge conflicts
git mergetool

remove new local branch
git branch -d <branchName>

remove new local branch immediately
git branch -D <branchName>

revert added files
git reset HEAD <file>

show all branches (remote and local)
git branch -a

show local branches
git branch

show remote branches
git branch -r

Get the size of a directory

du -sh file_path

  -s, --summarize
         display only a total for each argument

  -h, --human-readable
         print sizes in human readable format (e.g., 1K 234M 2G)

  -c, --total
         produce a grand total

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 <http://domane.to.file.zip> -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

pwd

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

Search files by name

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

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

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 alfresco-global.properties file - dir.license.external=/path/to/license/folder