if [ ! -d directory ]; then mkdir directory fi if you dont have sub directories you need to use "-p" option mkdir -p /dxx/xx/xx/xx/e/3/3/5/DIRECTORY if [[ ! -e $dir ]]; then mkdir $dir elif [[ ! -d $dir ]]; then echo "$dir already exists but is not a directory" fi
Author: coder
Vpn over TCP or UDP
A VPN is for wrapping raw IP packets into some kind of “tunnel” between two sites.
– Connection speed is going slow down cause of Encryption.
Performance : UDP is better
Security : For Experts , it is The same . UDP is also secure, because VPN service adding EXTRA header inside of UDP
Connectionless > TCP is a protocol which sits on top of IP, (which are “unreliable“: Packet lost, duplicated, reordered)
to provide a reliable two-directional channel for data bytes, where bytes always reach the receiver in the order they were sent. TCP does that by using a complex assortment of metadata with explicit acknowledges and reemissions. Thus, TCP incurs a slight network overhead.
If VPN uses TCP, it is paying the TCP overhead twice. An UDP-based VPN thus has the potential for slightly better performance. On the other hand, the cryptographic protection of the VPN requires some state management, which may be harder for the VPN implementation when using UDP, hence it is possible that the UDP-based VPN has an extra overhead to contend with.
Performance is tested by me, and UDP connection performance obviously better than TCP.
combine string variables on bash. concatenate string bash
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
mystring="${arg5}12${arg_someload}endoffile" # ------------------------------------------ $ arg1=foo $ arg2=bar $ mystring="$arg1" $ mystring+="12" $ mystring+="$arg2" $ mystring+="endoffile" $ echo "$mystring" foo12barendoffile # ------------------------------------------ mystring="$string1$string2" # ------------------------------------------ # ------------------------------------------ # ------------------------------------------ |
1 2 3 4 5 6 7 8 9 10 11 12 |
foo="Hello" foo="$foo World" echo $foo > Hello World # ------------------------------------------ a='hello' b='world' c=$a$b echo $c > helloworld |
Ftp ACL (Access Control Lists ) – restricted FTP access
What is ACL ?
When you enable it , only selected ips have access to FTP server as a client. it is for security of FTP. if some one stole your FTP.
How to ? It is depends on your FTP provider. But if you have own linux server.
access-list 101 permit tcp any any eq 21 !--- The above line permits TCP traffic from any source, such as the FTP client, !--- FTP server destination at the FTP control port 21. access-list 101 permit tcp any eq 20 any !--- The above line permits TCP traffic from any source, such as the FTP server, !--- FTP client at FTP data port 20.
Example Document :
Reconstitute the Archive
cat *tar.gz* | tar -xvpzf - -C /
split a file
split -d -b 1200m /backup.tar.gz /name/backup.tar.gz.
Using tar command
1 2 3 4 5 6 7 |
Create Archive tar czf ~/backup.tgz * or tar cvf backup.tar /dirname |
1 2 3 |
untar Archive, Extraction tar -xvf tar.file |
using tar command for Partition backup
1 2 3 4 5 |
# mounting disks mount /dev/sda1 /mnt/root cd /mnt/root tar cpjf /root.tar.bz2 . |