Useful linux commands


  • Just open a linux-shell and type in the commands

Change keyboard layout
loadkey de
setxkbmap -layout de

Open textfile with an editor
nano textfile
vi textfile
pico textfile

Show content of file in shell
cat textfile
less textfile
head textfile
tail textfile

Show content of variable
echo $MYVAR

Set content of variable
export MYVAR=someValue

Append value of variable
export MYVAR=$MYVAR" addition"
echo $MYVAR => someValue addition

Execute shellscript

Show treeview of files and directories
only directories, with max depth of 3, and ignore „target“
tree mydir -d -L 3 -I target
current dir, only dirs, show full path, and dont sort, max Depth 5
tree . -fUd -L 5

Write output of command into file
tree >> test.txt
Note: if the file doesn’t exist, it will be created automatically!

… list will be updated from time to time