Linux

I always forget some usefull Linux command, because I’m more experienced with Windows. So I wrote them down for me.

 

Let’s start …

cat /etc/lsb-release
cat /proc/issue
uiname -a

Show version of linux and the distribution

du -csh *

Show the sizes of all files and directories in the current directory.
-c : Show a grand total
-s : Show sum for every directory
-h : Show results in human readable form

df -a -h

Show used disk space
-a : All files
-h : Human readable form

lsb_release -a

Show the installed ubuntu version

tar -zcvf filename.tgz sourcefolder –exclude=’folder’ –exclude=’upload/folder2′ 

Compresses a complete folder.
Exclude some folders:
--exclude='foldername'
Must stand before the source or the target description

2>/dev/null

Ignore error output

sudo -i

Open root shell

scp -r tux@sun.example.com:/foo_directory .

To copy a whole directory structure, use the 
recursive mode of scp.

groups

List all groups

groups <user>

Show groups of a user

usermod -a -G <group[,group…]> <user>

Add a user to group(s)

ls -t

Order ls output by date/time, most recent first, ls -tr most recent last