Find some text in folder files
grep --color=auto -nH 'text_to_find' *
Find some text in folder and subfolder files
grep -r --color=auto -nH 'text_to_find' *
================================================
To generate a file with custom size:
# dd if=/dev/zero of=output.dat bs=1024 count=10240
or # dd if=/dev/zero of=output.dat bs=1M count=10
==============================================
Copy BSD Disk to another
dd if=/dev/ad0 of=/dev/da0 bs=1M
If you not have all disk in same plece you can try to make a dump over SSH
dump -C16 -b64 -0uanL -h0 -f - / | gzip -2 | ssh -c blowfish user@host.com dd of=filename.dump.gz
To restore you can try:
mount first partition
mount /dev/ad1s1a /tmp/root #(ad1 is the backup disk)
ssh -c blowfish usr@host.com gzcat root.dump.gz | (cd /tmp/root && restore -ruf -)
================================================
#!/bin/bash count=99 if [ $count -eq 100 ] then echo "Count is 100" elif [ $count -gt 100 ] then echo "Count is greater than 100" else echo "Count is less than 100" fi
=================================================
show listen port by process
netstat -tupln
=================================================
show linux open files
lsof /dev/sda1
=================================================
show port listen by process
lsof -i :22
=================================================
Scan all ports with nmap
nmap -P0 -vv -sS -ff -r -n -p 1-65535 SERVER_IP_HERE
=================================================
List apache modules
apachectl -t -D DUMP_MODULES
=================================================
Show open files by process
watch 'lsof -u apache | sort | uniq -c | sort -n'
watch 'lsof -u apache | awk '\''{print $2}'\'' | sort | uniq -c | sort -n'
Niciun comentariu:
Trimiteți un comentariu