1:-
df -h show the drive information how many drive exist in linux plateform as well as how many percent he fill.
2:- vmstat -s , show the RAM status.
cp -r /var/lib/mysql /extra , copy file from one source to given destinaction.
3:- show free and used memory in the system:-
cat /proc/meminfo
OR
# free
# free -m
# free -mt
#free -gt
4:- linux finf out current running version :-
cat/proc/version
5:- Take mysql dump for perticular database:-
mysqldump -u root -padmin123 databasename >bacupfile,sql
6:- copy command
cp -avr /var/www/html/unified_HD_old /data/WWW_bkup
7:- open
/etc/security/limits.conf file
in vi editer and change configuration for increase user limit
add this
* soft nofile 16384
* hard nofile 16384
apache soft nproc 1457280
apache hard nproc 3000000
check user limit command in linux is ulimit -n
http://stackoverflow.com/questions/34588/how-do-i-change-the-number-of-open-files-limit-in-linux
8:- mpstat -P ALL
9:-SHOW STATUS WHERE `variable_name` = 'Threads_connected';
10:- /etc/init.d/httpd fullstatus | more
11:- tail -f error_log
/var/log/httpd
12. using given command i can know thw replaction of id
ps ax | grep 80
ps ax | grep 3306
kill -9 28013
13:- netstat -an |grep :3306 |wc -l
netstat -an |grep :80 |wc -l
14:- /etc/init.d/httpd fullstatus | more
15:- tail -f error_log
16:-
netstat -n | grep :80 |wc -l
1952
netstat -na|grep ESTABLISHED|wc -l
26
ps -ef|grep httpd|wc -l
62
netstat -anp | grep 3306 | wc -l
netstat -anp | grep 3306
show Mysql connection in Linux
netstat -anp | grep 3306 | grep EST | wc -l
17:-
compress file
tar -zcvf mysqlbackup_8sep_14.tar.gz MysqlBacup/
uncompress file
tar -zxvf mysqlbackup_8sep_14.tar.gz
17 (a):- tail -f /data/httplog/access_log|grep "/unified/admin"
cat /data/httplog/access_log|grep "/unified/admin"
using above command i can find data.
(B) :- du -sh * given command i can see size of disk with directory.
(c):- su - customscript create new user in linux.
18a:-
find / -type f -name "*.php" -exec grep -il tapan {} \;
18:-
From Master:
1. Error log
2. my.cnf configuration file
3. output of following SQL statements:
TEE output.txt;
SHOW FULL PROCESSLIST;
SHOW GLOBAL VARIABLES;
SHOW GLOBAL STATUS;
SHOW MASTER STATUS;
SELECT sleep(60);
SHOW FULL PROCESSLIST;
SHOW MASTER STATUS;
SHOW GLOBAL STATUS;
SHOW SLAVE STATUS\G
SHOW ENGINE INNODB STATUS\G
\s
NOTEE;
From Slave:
1. Error log
2. my.cnf configuration file
3. output of following SQL statements:
TEE output2.txt;
SHOW FULL PROCESSLIST;
SHOW GLOBAL VARIABLES;
SHOW GLOBAL STATUS;
SHOW SLAVE STATUS\G
SELECT sleep(60);
SHOW FULL PROCESSLIST;
SHOW GLOBAL STATUS;
SHOW SLAVE STATUS\G
SHOW MASTER STATUS;
SHOW ENGINE INNODB STATUS\G
\s
NOTEE;
19.
Change file permission in apache
chown -R apache:apache logs
chmod 755 logs
tar -xvzf html-2016-08-24.tar.gz
// check port listen or not
* netstat -tulpn|grep 27017
========================================================================
2 df -h
3 crontab -e
4 sh /data/MySQLdump.sh
5 crontab -e
6 sh /data/cronshfile/MySQLCronDBdump.sh
7 telnet 172.31.22.60
8 telnet 172.31.22.60 3306
9 telnet 172.31.22.58 3306
10 echo PAESSHSTART;df -P;echo PAESSHEND
11 telnet 172.31.22.58 3306
12 telnet 172.31.22.59 3306
13 telnet 172.31.22.58 3306
14 exit
15 echo PAESSHSTART;df -P;echo PAESSHEND
16 telnet 172.31.22.60 3306
17 telnet 172.31.22.59 3306
18 telnet 172.31.22.58 3306
19 echo PAESSHSTART;df -P;echo PAESSHEND
20 telnet 172.31.22.59 3306
21 telnet 172.31.22.58 3306
22 echo PAESSHSTART;df -P;echo PAESSHEND
23 telnet 172.31.22.60 3306
24 echo PAESSHSTART;df -P;echo PAESSHEND
25 telnet 172.31.22.60 3306
26 telnet 172.31.22.58 3306
27 telnet 172.31.22.59 3306
28 echo PAESSHSTART;df -P;echo PAESSHEND
29 crontab -e
30 sh /share/syncservice/sync_ondeck_aircel_hd/src/epgsync_common_hd.run.sh
31 crontab -e
32 sh /share/syncservice/src/epgsync_airteldth.run.sh
33 sh /share/syncservice/sync_ondeck_aircel_hd/src/epgsync_ondeck.run.sh
34 sh /share/syncservice/src/epgsync_viddth.run.sh
35 echo PAESSHSTART;df -P;echo PAESSHEND
36 mysqldump -u root -h 172.31.22.59 -p unified >/home/unified_10June_15.sql
37 mysql -u root -p
38 mysqldump -u root -p --databases unified common_hd aircel dth_airtel onde
ck vid_dth >/home/db159Allbcup.sql
39 cd /home
40 rsync -r db159Allbcup.sql 172.31.22.60:/home
41 mysql -u root -p
42 echo PAESSHSTART;df -P;echo PAESSHEND
43 crontab -e
44 /data/cronshfile/MySQLCronDBdump.sh
45 mysqldump -u neo -h172.31.22.58 -padmin123 unified > /data/databas
50 service crond status
51 systemctl status crond.service
52 service crond status
53 /etc/init.d/crond start
54 service crond status
55 crontab -e
56 mysqldump -u root -p --databases common_hd aircel dth_airtel ondeck vid_d
th >/data/databaseBackup/unified/add159masterDB.sql
57 cd /data/databaseBackup/unified
58 mysqldump -u root -p --databases common_hd aircel dth_airtel ondeck vid_d
th >/data/databaseBackup/unified/add159masterDB.sql
59 rsync -r add159masterDB.sql 172.31.22.60:/home
60 mysql -u root -p
61 echo PAESSHSTART;df -P;echo PAESSHEND
62 crontab -e
63 sh /share/syncservice/src/epgsync_airteldth.run.sh
64 share/syncservice/sync_ondeck_aircel_hd/src/epgsync_common_hd.run.sh
65 /share/syncservice/sync_ondeck_aircel_hd/src/epgsync_aircel.run.sh
66 /share/syncservice/sync_ondeck_aircel_hd/src/epgsync_ondeck.run.sh
67 /share/syncservice/src/epgsync_viddth.run.sh
68 /share/syncservice/sync_ondeck_aircel_hd/src/epgsync_common_hd.run.sh
69 echo PAESSHSTART;df -P;echo PAESSHEND
488 rpm -e MySQL-server-advanced MySQL-shared-advanced MySQL-client-advanced
MySQL-shared-compat-advanced MySQL-devel-advanced
489 rpm -e MySQL-server-advanced
490 rpm -qa |grep MySQL
491 rpm -e MySQL-client-advanced MySQL-devel-advanced
492 rpm -qa |grep MySQL
493 rpm -e MySQL-shared-advanced
494 rpm -qa |grep MySQL
495 rpm -e MySQL-shared-compat-advanced
496 cd /root/tools/
497 ll
498 rpm -Uvh MySQL-*
499 rpm -qa |grep MySQL
500 /etc/init.d/mysql start
501 mysql -u root -p
502 rpm -qa |grep MySQL
503 mysql -u root -p
504 cd /root/
505 ll
506 mkdir tools
ifconifg
619 ifconfig
620 ifconfig | more
621 ping 172.31.22.1
622 iptables -l
623 iptables -L
624 /etc/init.d/iptables stop
625 ifconfig eth0 down
626 exit
627 route -n
628 ifconfig
629 vim /etc/sysconfig/network-scripts/ifcfg-eth0
630 route -n
631 route add 0.0.0.0 gw 172.31.22.1
632 route -n
633 iptables -L -n
634 getenforce
635 ifconfig
636 route -n
637 service iptables status
638 service iptables stop
639 service iptables start
640 service iptables status
641 exit
642 service network restart
643 echo PAESSHSTART;df -P;echo PAESSHEND
881 curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install
.sh | bash
882 exit
883 command -v nvm
884 nvm install node
885 cat /etc/redhat-release
886 uname -a
887 node -v
888 curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install
.sh | bash
889 telent raw.githubusercontent.com 443
890 yum install telnet
891 cat /etc/redhat-release
892 cat /etc/rees
893 cat /etc/resolv.conf
894 vim /etc/resolv.conf
895 dig yahoo.com
896 ifconfig -a
897 dig yahoo.com
898 yum install telnet
899 yum clean all
900 yum install telnet
ssh root@172.31.22.91
902 cd /etc/scripts/digiapis/
903 ls -ltr
904 cat package.json
905 top -d 2
906 node -v
907 npm -v
908 npm install pm2 -g
909 pm2 install
910 cat .ssh/id_rsa.pub
911 ssh root@172.31.22.91
912 ls -ltr
913 ssh root@172.31.22.91
914 mkdir -p /etc/scripts
915 scp -r root@172.31.22.91:/etc/scripts/digiapis /etc/scripts/
916 cd /etc/scripts/
917 ll
918 cd digiapis/
921 ls -ltr
922 npm install
923 ls -ltr
924 vim app.js
925 pm2 start app.js -n digiapis -i 0
926 pm2 save
927 pm2 list
928 ls -ltr
929 tail -f /root/.pm2/logs/digiapis-*
930 netstat -tulpn
931 ls -ltr
932 vim app.js
933 netstat -tulpn
934 ls -lt
935 vim app.js
936 vim config.js
937 cat /etc/hosts
938 vim /etc/hosts
939 vim config.js
940 vim /etc/hosts
941 vim config.js
942 cat /etc/hosts
943 pm2 list
944 pm2 reload digiapis
945 ls -ltr
946 vim config.js
947 ifconfig
948 cd
949 cd tools/
950 ll
951 vim test.php
952 php test.php
953 vim test.php
954 vi test1.php
955 vim test1.php
956 php test1.php
957 date
958 cd
959 scp -r root@172.31.22.91:/etc/scripts/epgrecording /etc/scripts/
960 cd /etc/scripts/
961 ls -ltr
962 cd epgrecording/
963 ll
964 rm -rf node_modules/
965 npm install
966 ls -ltr
967 vim index.js
968 crontab -e
969 which node
970 crontab -e
971 vim scheduleworker.js
972 pm2 start scheduleworker.js -n cathcup
973 pm2 stop cathcup
974 ls -ltr
975 vim config.js
976 yum install redis
977 yum install make gcc wget
978 cd
979 cd tools/
980 ll
981 wget http://download.redis.io/releases/redis-3.0.2.tar.gz
982 tar -zxvf redis-3.0.2.tar.gz
983 cd redis-3.0.2
984 ll
985 make
986 make install
987 cd utils/
988 ./install_server.sh
989 /etc/init.d/redis_6379 start
990 chkconfig redis on
991 chkconfig redis_6379 on
992 netstat -tulpn
993 ps -wef|grep 17704
994 cd /etc/scripts/
995 ll
996 cd epgrecording/
997 ll
998 vim config.js
------------------------------------------------------------------------------------------
Goal: Using netstat to view information about connections
Difficulty: Easy
Prerequisites: Access to a Linux console
Lets start with the basics. The "netstat" command is quite useful for checking connections to your machine. If we wanted to see ALL of the connections (which i really recommend you don't do unless you're trying to debug something and then you should probably pipe it to a file) we could use the "netstat -a" command.
Using "netstat -a" will give you something sort of like this (this is a segment of my server):
tcp 0 0 app.mydomain.com:http 93.184.216.119:16494 SYN_RECV
tcp 0 0 app.mydomain.com:http 93.184.216.119:18733 SYN_RECV
tcp 0 0 app.mydomain.com:http 93.184.216.119.dsl.mwe:64775 SYN_RECV
tcp 0 0 app.mydomain.com:http 93.184.216.119.threembb.:16490 SYN_RECV
tcp 0 0 app.mydomain.com:http 93.184.216.119:video-activmail SYN_RECV
tcp 0 0 app.mydomain.com:http 93.184.216.119:45025 SYN_RECV
tcp 0 0 app.mydomain.com:http 93.184.216.119:dvl-activemail SYN_RECV
tcp 0 0 app.mydomain.com:http 41-135-22-100.dsl.mwe:64774 SYN_RECV
As you can see it does name resolving for us and all that good stuff. Sometimes very hand but that's not what this is about. We want to get some solid numbers so we can take a broader perspective. To do this we can use the following command:
netstat -an | wc -l
This will show us a count of all connections that we presently have to our machine. But we can take this one step further even. Lets say you only wanted to see traffic comming across port 80 (standard http). We can grep our netstat then count it like so:
netstat -an | grep :80 | wc -l
Finally, lets take a look at the big picture in a category form. It is often extremely useful to see what those connections are doing, especially when you think you might just have tons of open connections that are idle and are trying to tweak your settings.
netstat -ant | awk '{print $6}' | sort | uniq -c | sort -n
So there you have it. A quick way to return counts on your connections in your linux environment. (Note the netstat command is standard on most operating systems, including windows, but you may need to use some other way to count your results)
Occasionally, when using netstat you may only care about ports that you are listening on. This is especially important if you are running a server that isn't behind a firewall because it helps you determine what you may be vulnerable to that you aren't aware of. using the netstat -l provides us with an excellent way to view this information.
root@nox [~]# netstat -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:mysql *:* LISTEN
tcp 0 0 *:submission *:* LISTEN
tcp 0 0 *:pop3 *:* LISTEN
tcp 0 0 localhost:783 *:* LISTEN
Another very common thing and powerful tool that netstat has built in is to show you network statistics in an overview fashion. If you're just trying to get a good idea about packet statistics then the netstat -s command may be what you're looking for. Here is some sample output. Keep in mind that netstat -s will show statistics broken down by protocol, so the fewer protocol stacks you are running the more compacted this summary will be.
netstat -s
Ip:
139502653 total packets received
28 with invalid addresses
0 forwarded
0 incoming packets discarded
133312468 incoming packets delivered
84570989 requests sent out
366 outgoing packets dropped
50 reassemblies required
25 packets reassembled ok
110 fragments received ok
220 fragments created
Icmp:
180285 ICMP messages received
1586 input ICMP message failed.
ICMP input histogram:
destination unreachable: 9516
timeout in transit: 331
echo requests: 170151
echo replies: 284
172009 ICMP messages sent
0 ICMP messages failed
ICMP output histogram:
destination unreachable: 1818
echo request: 40
echo replies: 170151
IcmpMsg:
InType0: 284
InType3: 9516
InType8: 170151
InType11: 331
OutType0: 170151
OutType3: 1818
OutType8: 40
Tcp:
1104118 active connections openings
2918161 passive connection openings
26607 failed connection attempts
256788 connection resets received
10 connections established
128535136 segments received
78146054 segments send out
1645036 segments retransmited
0 bad segments received.
185776 resets sent
Udp:
5125395 packets received
1867 packets to unknown port received.
0 packet receive errors
5158639 packets sent
TcpExt:
511 SYN cookies sent
511 SYN cookies received
12748 invalid SYN cookies received
14894 resets received for embryonic SYN_RECV sockets
159972 packets pruned from receive queue because of socket buffer overrun
2 packets pruned from receive queue
73 ICMP packets dropped because they were out-of-window
1965839 TCP sockets finished time wait in fast timer
78 time wait sockets recycled by time stamp
36503 packets rejects in established connections because of timestamp
2487605 delayed acks sent
33477 delayed acks further delayed because of locked socket
Quick ack mode was activated 45146 times
233 times the listen queue of a socket overflowed
233 SYNs to LISTEN sockets ignored
9643039 packets directly queued to recvmsg prequeue.
7969358 packets directly received from backlog
3291115817 packets directly received from prequeue
24087199 packets header predicted
5532135 packets header predicted and directly queued to user
30481401 acknowledgments not containing data received
42935286 predicted acknowledgments
814 times recovered from packet loss due to fast retransmit
339835 times recovered from packet loss due to SACK data
336 bad SACKs received
Detected reordering 2070 times using FACK
Detected reordering 854 times using SACK
Detected reordering 10 times using reno fast retransmit
Detected reordering 1840 times using time stamp
3234 congestion windows fully recovered
20175 congestion windows partially recovered using Hoe heuristic
TCPDSACKUndo: 11509
14757 congestion windows recovered after partial ack
1004274 TCP data loss events
TCPLostRetransmit: 54568
129 timeouts after reno fast retransmit
33120 timeouts after SACK recovery
31346 timeouts in loss state
885023 fast retransmits
93299 forward retransmits
337378 retransmits in slow start
128472 other TCP timeouts
TCPRenoRecoveryFail: 356
35936 sack retransmits failed
9 times receiver scheduled too late for direct processing
57242284 packets collapsed in receive queue due to low socket buffer
49286 DSACKs sent for old packets
157 DSACKs sent for out of order packets
95033 DSACKs received
2091 DSACKs for out of order packets received
39363 connections reset due to unexpected data
35517 connections reset due to early user close
12861 connections aborted due to timeout
6 times unable to send RST due to no memory
TCPSACKDiscard: 60
TCPDSACKIgnoredOld: 2937
TCPDSACKIgnoredNoUndo: 38596
TCPSpuriousRTOs: 2925
TCPSackShifted: 1905464
TCPSackMerged: 2048679
TCPSackShiftFallback: 995770
TCPBacklogDrop: 41842
IpExt:
InBcastPkts: 20
InOctets: 60455654365
OutOctets: 154094094438
InBcastOctets: 6560
Another extremely useful tool for server administrators who are trying to track down processes that have run amuck is the netstat -p command. This returns the PID of the process that has the connection. It's also quite useful if you've got someone abusing a PID and you need to find out what IP it is so that you can get in touch with that individual or to block connections from that IP in the future. Here's some sample output from netstat -p.
netstat -p
tcp 0 0 localhost:56423 example.domain.com:https ESTABLISHED 27911/java
tcp 0 52 localhost:ssh oh-76-76-76-76.dhcp.e:51653 ESTABLISHED 3344/sshd
tcp 0 0 localhost:imaps 76.sub-76-76-76.myvz:9258 ESTABLISHED 14501/dovecot/imap-