Git

Git is a tool that can help you track changes in your files, specially when you share your files with your friends on a Linux server.

Here is a very simple description:

log into your server
ssh foobarserver

go to your folder where you want to track files
cd to/your/folder/for-git-tracking/test/

create a local git repository
git init

Add your files to the local repo
git add myfile.sh

or add more files at once
git add .

Commit your changes to the repo, give a message -m, so that your friends can understand what you have done
git commit -m "myfile.sh: first commit" myfile.sh

or commit all files in current directory (the character “.” is the directory where your files are.)
git commit -m "My files, snapshot" .

Now, start editing your file:

vim myfile.sh

or

nano -w myfile.sh

After saving your changes, do:

git commit -m "myfile.sh: I have changed an important part in this file" myfile.sh

or
git commit -m "My files, here is my explanation of the changes" .

Later on, you can do:

to see the log and the changes done
git log

did you forget to commit some files, or did someone change something?
git status

Using unix command ‘du’, disk usage

Sometimes you like to know which folders are using up all your space on your Linux server.

This command will sum up the disk usage per folder, and print the result:

du -m --max-depth=10 / | sort -r -n | head -10

– m (display in megabyte)
– max-depth=10 (folder depth? Should be plenty, depends on your system)
– sort -n -r (sort it by numbers, and reverse it)
– head -10 (only show the 10 top folder with most data.)

result on “myserver”:

6268    usr
5330    var
3414    var/www
2715    backup
2714    backup/postgresql_dumps
2399    usr/share
2192    var/www/applications
2126    var/www/applications/logonlogoff
2034    var/www/applications/logonlogoff/cache
1691    usr/local