Thursday, November 13, 2014

Some CentOS and Ubuntu commands

Following are some commands and their usage for Ubuntu and Cent OS platforms

UBUNTU COMMANDS:-

  1. lsb_release -a  ( Check Ubuntu version)
  2. /var/log/unattended-upgrades ( check Ubuntu update logs)
  3. /var/log/boot.log ( check Ubuntu boot logs)
  4. /var/log/dmesg ( Check boot messages)
  5. cat /etc/apt/apt.conf.d/10periodic| grep Unattended-Upgrade (to determine if update is running)
  6. To enable OR disable automatic updates on Ubuntu:
  7. Disable Automatic Updates.

1. Log on as the root user.
2. Run the following command:
/usr/local/sbin/disable-auto-updates.sh
3. If the command prompt appears, the automatic updates are now disabled.
4. In a text editor, open the following file:
/etc/apt/apt.conf.d/20auto-upgrades
5. Modify the following line:
APT::Periodic::Unattended-Upgrade "1";
To:
APT::Periodic::Unattended-Upgrade "0";

Enable Automatic Updates
If automatic updates are disabled, complete the following to re-enable
automatic updates.
1. Log on as the root user.
2. Run the following command:
/usr/local/sbin/enable-auto-updates.sh
3. If the command prompt appears, the automatic updates are now enabled.
4. In a text editor, open the following file:
/etc/apt/apt.conf.d/20auto-upgrades
5. Modify the following line:
APT::Periodic::Unattended-Upgrade "0";
To:
APT::Periodic::Unattended-Upgrade "1";


CentOS Commands:-
  1.  dd if=/dev/zero of=/tmp/dummy.txt bs=1M count=10 (does IO for 10MB)
  2.  du -sh * | grep 'G' ( finds all files in GBs on the same path)
  3. rm -rf fordelete/* ( recursive delete for a folder called fordelete)
  4.  root@timmy ~]# for i in {1..4} ;do echo "tim-slave$i" ;ssh tim-slave1 'cd /home/tim/instances/Rafael__i1; ./isServerRunning' ;done (in 4 slave servers go to /home/tim/instances path and check is the script is running)
  5.  tune2fs -m 1 /dev/mapper/vg_pakoracle3-lv_root ( frees area reserved for root in the LVM)
  6. find /home/downloads/ -size +500M -exec ls -lh {} \; | awk '{print $5"  -  "$9}' ( in /home/downloads check any files that exceeds 500MB)
  7.  for i in {1..4} ;do echo "tim-slave$i" ;ssh tim-slave$i 'netstat -tulpn | grep 59990'; done; ( check in each slave if there is a process running on port 59990)
  8.  service proftpd start ( start proftpd service)
  9. ps -ylC httpd | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}' ( will show average process size and memory used by Apache)
  10. free
  11. df- h
  12. cat /proc/cpuinfo
  13. grep -R 'var scriptVersion =' sanofi-demo-1/ ( finds a string var scriptVersion= in a folder sanofi-demo/)
  14. /string to search in vim  then press n for the next occurrence and N for previous.



No comments:

Post a Comment