45 private links
Pour me souvenir de la regex, et dans de nombreux cas grep est plus rapide que sed ou awk.
grep -oP '(?<=<div class="Message"> ).*?(?= </div>)' file
Pas mal pour simuler du failover !
tc qdisc add dev eth0 root netem delay 97ms
To verify the command set the rule run tc -s.
tc -s qdisc
delete :
tc qdisc del dev eth0 root netem delay 97ms
#commandes utiles
systemctl status proftpd.service
tail -f /var/log/proftpd/*
netstat -naop | grep proftpd
to do :
nano /etc/proftpd/conf.d/sftp.conf
<IfModule mod_sftp.c>
SFTPEngine on
Port 2222
SFTPLog /var/log/proftpd/sftp.log
# Configure both the RSA and DSA host keys, using the same host key
# files that OpenSSH uses.
SFTPHostKey /etc/ssh/ssh_host_rsa_key
SFTPHostKey /etc/ssh/ssh_host_dsa_key
SFTPAuthMethods publickey
SFTPAuthorizedUserKeys file:/etc/proftpd/authorized_keys/%u
# Enable compression
SFTPCompression delayed
</IfModule>
mkdir -p /etc/proftpd/authorized_keys/
ssh-keygen -e -f pub_rsa_mike >/etc/proftpd/authorized_keys/mike
sudo service proftpd reload
Le port 21 ne doit plus être en écoute.
Bien envie d'essayer !
Sharing a tiny bash function I'd written, to look up day for a date. Find it useful.
sd ()
{
cal -y | GREP_COLORS="mt=07;32" \grep --color=always -EC 4 " $1 |^$1 " | GREP_COLORS="sl=11;33:mt=07;33" \grep --color=always -B2 -A6 '[A-Z][a-z] '
}
@nixcraft @climagic #linux #shell https://t.co/i9zhJUMjX0
coudé pour le chien de garde iptables :
La parade : un « chien de garde » dans un autre shell
DELAI=180; while true; do test=""; read -t $DELAI -p "pare-feu OK ? " test; if [[ $? -ne 0 ]]; then {
for param in --flush --zero --delete-chain; do /sbin/iptables $param; done
for table in $(cat /proc/net/ip_tables_names); do
/sbin/iptables -t $table --flush
/sbin/iptables -t $table --zero
/sbin/iptables -t $table --delete-chain
done
for chain in INPUT FORWARD OUTPUT; do
/sbin/iptables -P $chain ACCEPT
done
for param in --flush --zero --delete-chain; do /sbin/ip6tables $param; done
for table in $(cat /proc/net/ip6_tables_names); do
/sbin/ip6tables -t $table --flush
/sbin/ip6tables -t $table --zero
/sbin/ip6tables -t $table --delete-chain
done
for chain in INPUT FORWARD OUTPUT; do
/sbin/ip6tables -P $chain ACCEPT
done
}; fi; done
Pas plus simple :
I think I have a simpler solution here, just look for a directoy whose name corresponds to the PID you are looking for, under the pseudo-filesystem accessible under the /proc path. So if you have a program running, whose ID is 1199, cd into it:
$ cd /proc/1199
Then look for the fd directory underneath
$ cd fd
This fd directory hold the file-descriptors objects that your program is using (0: stdin, 1: stdout, 2: stderr) and just tail -f the one you need - in this case, stdout):
$ tail -f 1
"cat /dev/null > ~/.bash_history && history -c && exit"
How to create the master file
Determine the number of files and the size of each file that you require
Multiply the total number of files times the size (in bytes). For example: If you want to create 10000 files that are 10 bytes each, do 10000 * 10 = 1,000,000. This represents the size of the master file that is needed.
To create this master file, run the command:
dd if=/dev/zero of=masterfile bs=1 count=1000000
The above command will create a 1 MB file called ‘masterfile’. This file contains all 0’s. If you would like it to contain random binary data, use /dev/urandom
To split the master file into thousands of pieces
Now that the master file is created, you can now use this to generate the desired 10,000 files that are 10 bytes each.
Run the command:
split -b 10 -a 10 masterfile
Command Syntax
find /path/to/files* -mtime +5 -exec rm {} \;
Note that there are spaces between rm, {}, and \;
Explanation
The first argument is the path to the files. This can be a path, a directory, or a wildcard as in the example above. I would recommend using the full path, and make sure that you run the command without the exec rm to make sure you are getting the right results.
The second argument, -mtime, is used to specify the number of days old that the file is. If you enter +5, it will find files older than 5 days.
The third argument, -exec, allows you to pass in a command such as rm. The {} \; at the end is required to end the command.
The table is pretty intelligible doing a mere, first comes the Main: and then Local:
cat /proc/net/fib_trie
or to see your network, IP addresses and netmask:
cat /proc/net/fib_trie | grep "|--" | egrep -v "0.0.0.0| 127."
|-- 193.136.1.0
|-- 193.136.1.2
|-- 193.136.1.255
|-- 193.136.1.0
|-- 193.136.1.2
|-- 193.136.1.255
grep '32 host LOCAL' -B 1 /proc/net/fib_trie | grep -Po '|-- \K(.*)' | grep -v '127.0.0.1' | sort | uniq | tr '\n' ' '
sinon via une commande propre : "hostname --all-ip-addresses || hostname -I"
pour tronquer un fichier verrouillé par un processus.
myserver1# cd /proc/25139/fd
myserver1:/proc/25139/fd# ls -l 4
lr-x------ 1 root root 64 2010-01-07 17:10 4 -> /var/log/myapp/userlog (deleted)
We can do almost everything with this file (called 4 here) what we can do with a real file: we can less it, copy it, and we can change its contents!
Free up the Space
As already said, we cannot remove the file, but what we can do is getting the size down to zero. And that's done as with every other file, e.g. if you use bash (or ksh) - what is most likely under Linux:
myserver1# > /proc/25139/fd/4
Coudifié : logrotate --force $CONFIG_FILE
<coude>
for user in $(cut -f1 -d: /etc/passwd); do echo "$user :" ;crontab -u $user -l; done
</coude>
Ils sont toujours aussi bon chez Linux et aussi chez linuxfr :' Sasha Levin a utilisé KASan et a trouvé un bogue intéressant dans les verrous tournants paravirtualisés.'
Dites moi que je ne suis pas le seul tech sys qui ne comprend pas cette phase...
Arf, j'ai connu cette galère mais il y a 5-7 ans. Maintenant j'ai plus de soucis (et Fedora a été la distribution qui a été la plus compatible avec mes périphériques)
De côté.
De côté aussi.
Via https://fralef.me/links/?-h3T3w
Pratique
Via http://daniel.gorgones.net/shaarli/?caIysg
Suite à problème de carte avec une VM :
"
Step #2: Rename eth0 as wan0
To rename eth0 as wan0, edit a file called 70-persistent-net.rules in /etc/udev/rules.d/ directory, enter:
vi /etc/udev/rules.d/70-persistent-net.rules
The names of the Ethernet devices are listed in this file as follows:
PCI device 0x14e4:0x1680 (tg3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?", ATTR{address}=="b8:ac:6f:65:31:e5", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth", NAME="eth0"
"
and edit #vi /etc/sysconfig/network-scripts/ifcfg-eth