See your most used shell commands
history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -n | tail | sort -nr
DZone Snippets > peter > linux
12389 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Peter Cooperx http://www.petercooper.co.uk/
history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -n | tail | sort -nr
require 'rubygems' require 'inline' # Oodles of inspiration and examples from # http://www-128.ibm.com/developerworks/linux/library/l-affinity.html class LinuxScheduler inline do |builder| builder.include '<sched.h>' builder.include '<stdio.h>' builder.c ' int _set_affinity(int cpu_id) { cpu_set_t mask; __CPU_ZERO(&mask); __CPU_SET(cpu_id, &mask); if(sched_setaffinity(getpid(), sizeof(mask), &mask ) == -1) { printf("WARNING: Could not set CPU Affinity, continuing as-is\n"); return 0; } return 1; } ' end # cpu_id is 0-based, so for core/cpu 1 = 0, etc.. def self.set_affinity(cpu_id) self.new._set_affinity(cpu_id.to_i) end end # Set this process's CPU affinity LinuxScheduler.set_affinity(ARGV.first) # Hog up all the CPU time on that processor 1000000.times { b = rand(100) ** 100 }
procs memory swap io system cpu r b swpd free buff cache si so bi bo in cs us sy id wa 2 5 375912 19548 17556 477472 0 1 0 0 1 1 1 0 0 1 0 4 375912 18700 17556 478264 0 0 1044 0 774 1329 8 1 0 91 0 5 375912 17664 17556 479168 0 0 1160 0 764 1110 8 1 0 91 1 8 375912 15836 17568 479796 0 0 1144 840 751 1622 16 7 0 78 0 7 375912 19340 17576 480224 0 0 1224 148 587 1958 17 18 0 65 2 0 375912 18288 17588 481036 0 0 812 0 845 1732 18 3 21 59 0 2 375912 15868 17588 481528 0 0 1012 0 588 941 4 1 5 90
service mysqld stop cd ~ mkdir mysql cd mysql wget http://dev.mysql.com/get/Downloads/MySQL-5.0/MySQL-server-standard-5.0.22-0.rhel4.x86_64.rpm/from/http://mirror.x10.com/mirror/mysql/ wget http://dev.mysql.com/get/Downloads/MySQL-5.0/MySQL-client-standard-5.0.22-0.rhel4.x86_64.rpm/from/http://mirror.x10.com/mirror/mysql/ wget http://dev.mysql.com/get/Downloads/MySQL-5.0/MySQL-shared-standard-5.0.22-0.rhel4.x86_64.rpm/from/http://mirror.x10.com/mirror/mysql/ wget http://dev.mysql.com/get/Downloads/MySQL-5.0/MySQL-devel-standard-5.0.22-0.rhel4.x86_64.rpm/from/http://mirror.x10.com/mirror/mysql/ rpm -Uvh --nodeps MySQL-server-standard-5.0.22-0.rhel4.x86_64.rpm rpm -Uvh MySQL-client-standard-5.0.22-0.rhel4.x86_64.rpm rpm -Uvh MySQL-shared-standard-5.0.22-0.rhel4.x86_64.rpm rpm -Uvh MySQL-devel-standard-5.0.22-0.rhel4.x86_64.rpm nano -w /etc/my.cnf # Comment out the base-dir line under [mysqld.server] - RHEL 4 / MySQL bug adduser mysql chown -R mysql:mysql /var/run/mysqld chown -R mysql:mysql /var/lib/mysql service mysql start mysql
perl -pi -e 's/source/destination/g' *.html
find / -type f -size +20000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
uuencode file.txt file.txt | mail email@address.com
chmod 750 /usr/bin/rcp chmod 750 /usr/bin/wget chmod 750 /usr/bin/lynx chmod 750 /usr/bin/links chmod 750 /usr/bin/scp
find -type l -maxdepth 1 -name '*.*' | xargs -n 1 basename | xargs -i find /home/virtual/{}/var/www -type f -size +8192k -ls
openssl des3 -salt -in infile.txt -out encryptedfile.txt
openssl des3 -d -salt -in encryptedfile.txt -out normalfile.txt