- rkhunter --check --rwo --summary > /tmp/rkhunter_final.log
- cat /tmp/archival_system/delJS_downtime.log | grep "^[0-9]" | awk '{sum=sum+$1} END{print sum}'
- grep "proxy\:" /var/log/apache_front_error_log | awk '{print $NF}' |grep -v resid | sort | uniq -c | sort -n
- for i in `ls -lrt | awk '{print $7"\t"$9}' | grep ^31 | awk '{print $2}'`; do cat $i | tai64nlocal | grep "m.jannath\_perthous100\@yahoo.com"; cat $i | tai64nlocal | grep "mahesh_f_b@yahoo.co.in"; cat $i | tai64nlocal | grep "annaisai1986@yahoo.co.in"; cat $i | tai64nlocal | grep "anfaz_m@hotmail.com"; cat $i | tai64nlocal | grep "sujitha2012@gmail.com"; cat $i | tai64nlocal | grep "desiginer@gmail.com"; done
- for i in `ls -lrt | awk '{print $7"\t"$9}' | grep ^31 | awk '{print $2}'`; do cat $i | tai64nlocal | grep "m.jannath\_perthous100\@yahoo
- cat /tmp/list | awk '{print $5}' | xargs -i egrep "adityaseth09@gmail.com|kvenk111@yahoo.co.in|knvs.prasad@gmail.com" /home/qmail-logs/2010/{}
ls -ltra | awk '{print $5," ",$9}' | awk '$1 < 3000' | awk '/gif|png|jpg/ {print $2}' | xargs -I % cp -rp % /web/R/images/
- to massively clean lines containing x’s in front some css declarations in a group of files
ls | awk '/.css$/' | xargs sed -i.bk -e '/^ *x.*$/d' next...
find . -type f -exec grep -i '^ *x' /dev/null {} + | awk '!/svn|htdocs/' | cut -c 3- | awk '!/^#/' | awk -F ':' '{print $1}' | awk '/.css$/'| xargs sed -i.bk -e '/^ *x.*$/d\
'
seq -w 1 30 | xargs -i -t zcat in_Feb2011/in_Employer-{}Feb2011.gz | egrep 'resume.html?resid=3304847|resume.html?resid=30780899|resume.html?resid=31313778|resume.html?resid=31628106'
sar - Collect, report, or save system activity information.
-b :Report I/O and transfer rate statistics.
-B :Report paging statistics
-d :Report activity for each block device (kernels 2.4 and newer only)
-q :Report queue length and load averages
-r :Report memory and swap space utilization statistics
-u :Report CPU utilization.
iostat - Report Central Processing Unit (CPU) statistics and input/output statistics for devices and partitions.
-d : device utilization report
-c : CPU usage report
-x : Display extended statistics
iostat
* rrqm/s : The number of read requests merged per second that were queued to the hard disk
* wrqm/s : The number of write requests merged per second that were queued to the hard disk
* r/s : The number of read requests per second
* w/s : The number of write requests per second
* rsec/s : The number of sectors read from the hard disk per second
* wsec/s : The number of sectors written to the hard disk per second
* avgrq-sz : The average size (in sectors) of the requests that were issued to the device.
* avgqu-sz : The average queue length of the requests that were issued to the device
* await : The average time (in milliseconds) for I/O requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.
* svctm : The average service time (in milliseconds) for I/O requests that were issued to the device
* %util : Percentage of CPU time during which I/O requests were issued to the device (bandwidth utilization for the device). Device saturation occurs when this value is close to 100%.
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
cciss/c0d0 2269.60 132.60 296.20 77.60 20521.60 1681.60 10260.80 840.80 59.40 4.15 11.18 2.65 99.20
Citrix Xen VM:
Open properties of VM,, select "Startup Options", change "OS Boot Parameters" to "rw init=/bin/bash", graphical utf8reboot, you get # prompt... if want to edit some files...graphical utf8
graphical utf8
run this command:
# mount -w -o remount /
# now edit files you want... and reboot...
#### mysql query to backup table contents into a file.
mysql#> select id,user,subject,content,status,sentdate,last_update from tickets where type='PRODUCT' into outfile '/tmp/product_ticket' fields terminated by '~' lines terminated by '|~|';
Mysql check
mysqlcheck -u root -p --auto-repair -c -o -A
Repair Mysql MYISAM files..
/myisamchk --force --sort_buffer_size=64M --key_buffer_size=16M --read_buffer_size=8M --write_buffer_size=8M ../data/phplists/phplist_linktrack.MYI
mysql INNODB related
mysql> #SELECT TABLE_SCHEMA, TABLE_NAME, CONCAT(ROUND(data_length / ( 1024 * 1024 ), 2), 'MB') DATA, CONCAT(ROUND(data_free / ( 1024 * 1024 ), 2), 'MB')FREE from information_schema.TABLES where TABLE_SCHEMA='man' and table_name='result10' and Data_free > 0;
mysql> select TABLE_SCHEMA, TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='man';
ALTER TABLE `pass11` ENGINE = InnoDB (this will also refragment innodb table)
ext4 disable journal
At one high loaded web project I needed a very fast file system. I decided to use Ext4 with disabled journal (As a google:))).# Create ext4 fs on /dev/sda10 disk
mkfs.ext4 /dev/sda10
# Enable writeback mode. This mode will typically provide the best ext4 performance.
tune2fs -o journal_data_writeback /dev/sda10
# Delete has_journal option
tune2fs -O ^has_journal /dev/sda10
# Required fsck
e2fsck -f /dev/sda10
# Check fs options
dumpe2fs /dev/sda10 |more
For more performance add fstab opions: data=writeback,noatime,nodiratime
i.e:
/dev/sda10 /opt ext4 defaults,data=writeback,noatime,nodiratime 0 0
Tested at non-boot partition ;)
Redirect port request internally using IPTABLES
# iptables -I PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
# rpm -q --provides openssl
To check which users are connected to ftp servers, make the below entrt in vsftpd.conf
setproctitle_enable=YES
restart vsftpd and run command
# ps -fe | grep ftp
to restrict users to time based login in system and ftp server
edit /etc/pam.d/vsftpd and add below line just after ending auth section
session optional pam_keyinit.so force revoke
auth required pam_listfile.so item=user sense=deny file=/etc/vsftpd/ftpusers onerr=succeed
auth required pam_shells.so
auth include system-auth
account required pam_time.so
account include system-auth
session include system-auth
session required pam_loginuid.so
now edit /etc/security/time.conf and add below line at end.
vsftpd;*;mayankg;!Al1000-1900
Done