daily use yang selalu terupdate secepat nya

1. check file descripsi di kernel
sysctl fs.file-nr
#sample output
fs.file-nr = 1020 0 70000

1. 1020 The number of allocated file handles.
2. 0 The number of unused-but-allocated file handles.
3. 70000 The system-wide maximum number of file handles.

untuk menset dapat menggunakan sysctl /etc/sysctl.conf
tambahkan baris berikut
fs.file-max = 70000
lalu jalankan sysctl -p

2.PHP Increase Upload File Size Limit
cara pertama
edit file /etc/php.ini
memory_limit = 32M
upload_max_filesize = 10M
post_max_size = 20M
lalu restart apache

cara kedua
menggunakan .htacces

php_value upload_max_filesize 10M
php_value post_max_size 20M
php_value memory_limit 32M

—– legend ————
1. upload_max_filesize – The maximum size of an uploaded file.
2. memory_limit – This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. Note that to have no memory limit, set this directive to -1.
3. post_max_size – Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size.

3.kill command
kill signal
kill -9 <pid number>
kill by name prosess
pkill mysqld <– name prosess

4. rsync
1. Copy/Sync a File on a Local Computer
[root@domba]# rsync -zvh backup.tar /tmp/backups/

2. Copy/Sync a Directory on Local Computer
[root@domba]# rsync -avzh /root/rpmpkgs /tmp/backups/

3. Copy a Directory from Local Server to a Remote Server
[root@domba]$ rsync -avz rpmpkgs/ root@10.xx.xxx.xx:/home/

4.Copy/Sync a Remote Directory to a Local Machine
[root@domba]# rsync -avzh root@10.xx.xxx.xx:/home/tarunika/rpmpkgs /tmp/myrpms

5.Rsync Over SSH
Copy a File from a Remote Server to a Local Server with SSH
[root@domba]# rsync -avzhe ssh root@10.xx.xxx.xx:/root/install.log /tmp/

Copy a File from a Local Server to a Remote Server with SSH
[root@domba]# rsync -avzhe ssh backup.tar root@10.xx.xxx.xx:/backups/

6.Show Progress While Transferring Data with rsync
[root@domba]# rsync -avzhe ssh –progress /home/rpmpkgs root@10.xx.xxx.xx:/root/rpmpkgs

7.Use of –include and –exclude Options
rsync command will include those files and directory only which starts with ‘R’ and exclude all other files and directory
[root@domba]# rsync -avze ssh –include ‘R*’ –exclude ‘*’ root@10.xx.xxx.xx:/var/lib/rpm/ /root/rpm

8.Use of –delete Option
[root@domba]# touch test.txt
[root@domba]# rsync -avz –delete root@10.xx.xxx.xx:/var/lib/rpm/ .

9.Set the Max Size of Files to be Transferred
[root@domba]# rsync -avzhe ssh –max-size=’200k’ /var/lib/rpm/ root@10.xx.xxx.xx:/root/tmprpm

10.Automatically Delete source Files after successful Transfer
[root@domba]# rsync –remove-source-files -zvh backup.tar /tmp/backups/

11. testing result before real rsync
[root@domba]# rsync –dry-run –remove-source-files -zvh backup.tar /tmp/backups/
12. Set Bandwidth Limit and Transfer File
[root@domba]# rsync –bwlimit=100 -avzhe ssh /var/lib/rpm/ root@

4. iftop – Network Bandwidth Monitoring
iftop -i eth1

5. iptables rule
1. deled chain by number
iptables -t nat -L –line-numbers
iptables -t nat -D POSTROUTING 1

list by number iptable rule
iptables -L INPUT –line-numbers
del input line number
iptables -D INPUT 2

allow port
-A INPUT -p udp -s 10.xx.x.xxx/24 -m udp –dport 161 -j ACCEPT

6. snmpd
install yum install net-snmp
config snmpd.conf
rocommunity public
syslocation “lokasi dari letak server”
syscontact domba@emal.com

enable snmp on vmware
conect with ssh to vmware host
esxcli system snmp set -c public
esxcli system snmp set -l warning
esxcli system snmp set -e yes
lalu start snmp melalui control panel vcleint

7. find commands
deled file 7 hari kebelakang
find /home/uselinux/logs/ -mtime +7 -print0 | xargs -r -0 rm -rf

cari file
find /home/userlinux -name *ttf -print

deled file di folder
find /mnt/path/to/folder/ -type f -name “*.mkv” -exec rm -f {} \;
find /mnt/path/to/folder/ -type f -name “*.mkv” -exec rm -f {} \;


8. faster rsync
rsync -aHAXxv –numeric-ids –delete –progress -e “ssh -T -c arcfour -o Compression=no -x” user@<source>:<source_dir> <dest_dir>
-z, tidak digunakan karena bisa lambat pada satu sisi
-a: archive mode – rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
-H: preserves hard-links
-A: preserves ACLs
-X: preserves extended attributes
-x: don’t cross file-system boundaries
-v: increase verbosity
–numeric-ds: don’t map uid/gid values by user/group name
–delete: delete extraneous files from dest dirs (differential clean-up during sync)
–progress: show progress during transfer
-T: turn off pseudo-tty to decrease cpu load on destination.
-c arcfour: use the weakest but fastest SSH encryption. Must specify “Ciphers arcfour” in sshd_config on destination.
-o Compression=no: Turn off SSH compression.
-x: turn off X forwarding if it is on by default.
Flip: rsync -aHAXxv –numeric-ids –delete –progress -e “ssh -T -c arcfour -o Compression=no -x” [source_dir] [dest_host:/dest_dir]

8. nfs
edit nfs threads tanpa restart
echo ’32’ > /proc/fs/nfsd/threads

9. timezone
change timezone
cp /usr/share/zoneinfo/Asia/Jakarta /etc/localtime

10. kill rabbitmq proses conn
rabbitmqctl list_connections pid port state user vhost recv_cnt send_cnt send_pend name | awk ‘{print “rabbitmqctl close_connection \”” $1 “\” \”manually closing idle connection\”” | “/bin/bash” }’

11. write table permition on linux
7 = 4+2+1 (read/write/execute)
6 = 4+2 (read/write)
5 = 4+1 (read/execute)
4 = 4 (read)
3 = 2+1 (write/execute)
2 = 2 (write)
1 = 1 (execute)
chmod 666 mydoc.txt read/write by anybody! (the devil loves this one!)
chmod 755 mydoc.txt rwx for owner, rx for group and rx for the world
chmod 777 mydoc.txt read, write, execute for all! (may not be the best plan in the world…)