This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
shell:usefull [d.m.Y H:i] – kodmasin | shell:usefull [d.m.Y H:i] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | |||
+ | ====== Useful shell commands ====== | ||
+ | |||
+ | ===== deleting .svn folders (files) ===== | ||
+ | Sometimes people who use subversion need to delete all .svn folders in their working copy. To use below command you must be in root directory of your working copy and all .svn folders and files will be deleted. | ||
+ | |||
+ | find . -name .svn -exec rm -rf {} \; | ||
+ | |||
+ | :!: Be careful you can not undo this | ||
+ | |||
+ | |||
+ | ===== sending server resource usage by email ===== | ||
+ | Here are commands I found useful: | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | Complete example using above commands will be: | ||
+ | > (top -b -n 1; df -h; vnstat -d; last) | mutt -s " | ||
+ | |||
+ | Best is when you use this command in combination with cron: | ||
+ | 0 5 * * * (top -b -n 1; df -h; vnstat -d; last) | mutt -s " | ||
+ | |||
+ | ===== ' | ||
+ | |||
+ | To put process in background you should suffix '&' | ||
+ | |||
+ | If you want to keep process running after you logout you should use nohup command. This command will not put process to background automatically. | ||
+ | |||
+ | Example: Let say one want to download opensuse linux DVD iso file. He would also like to do something after he run this command. He also do not want to take care if download is not over and he has to go home (logout but do not shutdown the computer). | ||
+ | |||
+ | nohup wget -c http:// | ||
+ | |||
+ | ===== '' | ||
+ | |||
+ | If you need to deny access from one particular IP address use: | ||
+ | iptables -I INPUT -s 218.108.247.138 -j DROP | ||
+ | |||
+ | If sometimes after you want to allow access to that IP address use: | ||
+ | iptables -D INPUT -s 218.108.247.138 -j DROP | ||
+ | |||
+ | To check '' | ||
+ | iptables -L | ||
+ | |||
+ | ===== MySQL ===== | ||
+ | ==== dump just data ==== | ||
+ | dump just data (-c option is here so that I can insert this data to tables which have new columns) | ||
+ | |||
+ | mysqldump -u user -p -c --no-create-info database > filename | ||
+ | |||
+ | ===== make child directory have same ownership and permissions ===== | ||
+ | :!: without ACL | ||
+ | |||
+ | * set parent dir ownership you would like child to have | ||
+ | * set setuid bit with chmod | ||
+ | * every user have to set umask (just once) with wanted permissions | ||
+ | |||
+ | ==== Example ==== | ||
+ | We wnat to that all child dirs have group '' | ||
+ | |||
+ | chown :office | ||
+ | chmod g+s . | ||
+ | | ||
+ | Each user before creating subdir have to set umask (just once) with mask for wanted permissions. For example: | ||
+ | | ||
+ | umask 0002 | ||
+ | |||
+ | ===== GoAccess - apache log analyzer ===== | ||
+ | |||
+ | Nice small log terminal analyzer. [[http:// | ||