zip -r zipfile.zip directoryToZip -x directoryToZip /subdirectoryToExclude/* directoryToZip/SecondSubdirectoryToExclude /*
Kategorie: #!/bin/bash
Show me directories with the largest disc usage.
du -a ./ | sort -n -r | head -n 20
Its always searching for the directories with the most diskusage from the actual directory, sorted by usage. It shows the first 20 Lines
VIM Editor Shortcuts
Some shortcuts for working with VIM, an open source text editor for the console. Available for Linux, Windows & Mac.
Smart movements
*
and#
search for the word under the cursor forward/backward.w
to the next wordW
to the next space-separated wordb
/e
to the begin/end of the current word. (B
/E
for space separated only)gg
/G
jump to the begin/end of the file.%
jump to the matching { .. } or ( .. ), etc..{
/}
jump to next paragraph.'.
jump back to last edited line.g;
jump back to last edited position.
Check If Service Is Running
Simple bash snippet to check if a service is running, if not -> send a mail to root. In this snippet
#!/bin/sh
SERVICE=apache2;
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
echo "$SERVICE service running, everything is fine"
else
echo "$SERVICE is not running, try to start it."
sudo service $SERVICE start
echo "$SERVICE is not running!" | mail -s "$SERVICE down" root
fi