Sign up to create your own snipts, or login.

Public snipts » linux The latest public linux snipts.

showing 1-20 of 163 snipts for linux
  • Linux: Dateien nach Inhalt suchen
    find -type f|xargs grep $keyword
    

    copy | embed

    0 comments - tagged in  posted by cbeier on Mar 07, 2010 at 2:23 p.m. EST
  • suchen in linux
    grep -H -r "muster" *
    

    copy | embed

    0 comments - tagged in  posted by toledot on Mar 07, 2010 at 7:06 a.m. EST
  • .htaccess file to lock down files with db or secure in the prefix
    <FilesMatch "^(db|secure).*$">
    deny from all
    </FilesMatch>
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Mar 02, 2010 at 11:17 a.m. EST
  • Correct permissions for svn files in project
    find -name .svn -exec sudo chmod 777 {} \;
    find $(find -name .svn) -type d -exec sudo chmod 777 {} \;
    find $(find -name .svn) ! -type d -exec sudo chmod 664 {} \;
    

    copy | embed

    0 comments - tagged in  posted by mailo on Mar 02, 2010 at 8:25 a.m. EST
  • Enable SOAP on Media Temple DV server
    # Navigate to a relatively unimportant directory. I chose /home/
    cd /home/
    
    # Download PHP (http://www.php.net/releases/)
    wget http://museum.php.net/php5/php-5.2.6.tar.gz
    
    # Unpack the PHP file
    tar -zxf php-5.2.6.tar.gz
    
    # Configure the new PHP to enable SOAP (will take a few minutes) (before enable is two dashes)
    cd php-5.2.6
    ./configure --enable-soap=shared
    
    # Rebuild PHP (this will also take a while)
    make
    
    # Copy just the SOAP module into your existing installation of PHP
    cp modules/soap.so /usr/lib/php/modules/
    
    # Add the new SOAP configuration to your existing configuration
    echo "extension=soap.so" > /etc/php.d/soap.ini
    
    # Restart Apache
    /etc/init.d/httpd restart
    
    # Optional: You can now delete /home/php-5.2.6/ if you’d like, as you won’t need it any longer.
    rm -rf /home/php-5.2.6/
    
    # Check phpinfo() to confirm that SOAP is now enabled.
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Feb 22, 2010 at 8:45 p.m. EST
  • Cron job example
    # This will kick off a cron job at 2:07am.
    
    which $EDITOR
    EDITOR=vi
    export EDITOR
    
    crontab -e
    
    MAILTO="bbb@bbb.com"
    7 2 * * * /usr/local/bin/php -f /home/bbb/cron.php
    
    
    crontab -l
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Feb 17, 2010 at 2:45 p.m. EST
  • Rewrite .cfm files to files with .cfm
    RewriteEngine On
    Options -Indexes
    
    # redirect all .cfm files to files without .cfm
    RedirectMatch 301 ^(.*)\index.cfm$ $1
    RedirectMatch 301 ^(.*)\.cfm$ $1
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Feb 15, 2010 at 11:25 a.m. EST
  • Get route to an IP on Linux
    ip route get 10.118.216.81
    

    copy | embed

    0 comments - tagged in  posted by yvoictra on Feb 01, 2010 at 7:48 a.m. EST
  • Actualizar Ubuntu sin riesgos
    ; 1. Como root, hacer un backup del /
    sudo su -
    cd /
    tar -cvf /tmp/mi-dir-raiz.tar --exclude=mnt/* --exclude=dev/* --exclude=proc/* --exclude=tmp/* *
    
    ; 2. Te guardas /tmp/mi-dir-raiz.tar en un disco externo.
    
    ; 3. Actualizas, y si no te gusta el resultado arrancas desde un live-cd, montas la particion / en /mnt, borras todo el contenido de la actualizacion y restauras ahí tu tar.
    mount /dev/sdaX /mnt
    cd /mnt
    rm -rf *
    tar -xvf /midiscoexterno/mi-dir-raiz.tar
    
    ; 4. Ya solo te queda instalar el grub y reiniciar
    grub-install --root-directory=/mnt
    reboot
    

    copy | embed

    0 comments - tagged in  posted by Daedalus on Jan 22, 2010 at 7:52 a.m. EST
  • Copy all .svn directories recursively to /tmp/svn with their dir structure
    find -name .svn -print | xargs -n1 -i cp -R --parents {} /tmp/svn
    

    copy | embed

    0 comments - tagged in  posted by mailo on Jan 22, 2010 at 5:40 a.m. EST
  • Showing Unix System listening ports
    $ netstat -ntlup
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
    tcp        0      0 0.0.0.0:20000               0.0.0.0:*                   LISTEN      28946/perl          
    tcp        0      0 0.0.0.0:2273                0.0.0.0:*                   LISTEN      28855/mysqlmanager  
    tcp        0      0 0.0.0.0:199                 0.0.0.0:*                   LISTEN      28193/snmpd         
    tcp        0      0 127.0.0.1:10025             0.0.0.0:*                   LISTEN      22267/amavisd (mast 
    tcp        0      0 172.26.0.5:3306             0.0.0.0:*                   LISTEN      30760/mysqld        
    tcp        0      0 127.0.0.1:10026             0.0.0.0:*                   LISTEN      22389/smtpd         
    tcp        0      0 0.0.0.0:139                 0.0.0.0:*                   LISTEN      28352/smbd          
    tcp        0      0 127.0.0.1:3310              0.0.0.0:*                   LISTEN      28420/lt-clamd      
    tcp        0      0 127.0.0.1:10030             0.0.0.0:*                   LISTEN      28242/postgrey -d - 
    tcp        0      0 0.0.0.0:110                 0.0.0.0:*                   LISTEN      23007/pop3-login    
    tcp        0      0 127.0.0.1:783               0.0.0.0:*                   LISTEN      22298/perl          
    tcp        0      0 0.0.0.0:143                 0.0.0.0:*                   LISTEN      28148/dovecot       
    tcp        0      0 0.0.0.0:10000               0.0.0.0:*                   LISTEN      802/httpd           
    tcp        0      0 172.26.0.5:80               0.0.0.0:*                   LISTEN      802/httpd           
    tcp        0      0 127.0.0.1:8118              0.0.0.0:*                   LISTEN      28269/privoxy       
    tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      28199/sshd          
    tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN      22339/smtpd         
    tcp        0      0 0.0.0.0:443                 0.0.0.0:*                   LISTEN      28320/perl          
    tcp        0      0 0.0.0.0:445                 0.0.0.0:*                   LISTEN      28352/smbd          
    tcp        0      0 :::22                       :::*                        LISTEN      28199/sshd          
    udp        0      0 172.26.0.5:137              0.0.0.0:*                               28361/nmbd          
    udp        0      0 0.0.0.0:137                 0.0.0.0:*                               28361/nmbd          
    udp        0      0 172.26.0.5:138              0.0.0.0:*                               28361/nmbd          
    udp        0      0 0.0.0.0:138                 0.0.0.0:*                               28361/nmbd          
    udp        0      0 0.0.0.0:10000               0.0.0.0:*                               28320/perl          
    udp        0      0 0.0.0.0:20000               0.0.0.0:*                               28946/perl          
    udp        0      0 0.0.0.0:161                 0.0.0.0:*                               28193/snmpd         
    udp        0      0 0.0.0.0:53455               0.0.0.0:*                               27475/avahi-daemon: 
    udp        0      0 0.0.0.0:5353                0.0.0.0:*                               27475/avahi-daemon: 
    udp        0      0 172.26.0.5:123              0.0.0.0:*                               28787/ntpd          
    udp        0      0 127.0.0.1:123               0.0.0.0:*                               28787/ntpd          
    udp        0      0 0.0.0.0:123                 0.0.0.0:*                               28787/ntpd          
    udp        0      0 fe80::21e:90ff:fe29:123     :::*                                    28787/ntpd          
    udp        0      0 ::1:123                     :::*                                    28787/ntpd          
    udp        0      0 :::123                      :::*                                    28787/ntpd 
    

    copy | embed

    0 comments - tagged in  posted by yvoictra on Jan 17, 2010 at 8:38 a.m. EST
  • clean copy of symfony project for trac by using batch command
    1 create batch_trac.txt in project folder with this content
    mv config/databases.yml config/databases.yml.sample;
    mv config/ProjectConfiguration.class.php config/ProjectConfiguration.class.php.sample;
    rm -rf cache/* log/*;
    find -name *schema.sql -exec rm -rf {} \;
    for DIR in `find -name base -type d`; do rm -rf $DIR/*;done;
    for DIR in `find -name map -type d`; do rm -rf $DIR/*;done;
    for DIR in `find -name om -type d`; do rm -rf $DIR/*;done;
    echo Clean project sucessfully! please do not forget delete all unnecessary file in project folder, For Example: *.txt for batching
    
    2 $chmod +x batch_trac.txt
    3 $./batch_trac.txt
    4 you can import these code in trac system
    

    copy | embed

    0 comments - tagged in  posted by toledot on Jan 15, 2010 at 6:18 a.m. EST
  • Sound problems in Ubuntu
    sudo /etc/init.d/alsa-utils reset
    /sbin/alsa force-reload
    

    copy | embed

    0 comments - tagged in  posted by fegabe on Jan 14, 2010 at 6:05 a.m. EST
  • detect linux distro
    #!/bin/sh
    # Detects which OS and if it is Linux then it will detect 
    # which Linux Distribution.
    
    OS=`uname -s`
    REV=`uname -r`
    MACH=`uname -m`
    
    GetVersionFromFile()
    {
    	VERSION=`cat $1 | tr "\n" ' ' | sed s/.*VERSION.*=\ // `
    }
    
    if [ "${OS}" = "SunOS" ] ; then
    	OS=Solaris
    	ARCH=`uname -p`	
    	OSSTR="${OS} ${REV}(${ARCH} `uname -v`)"
    elif [ "${OS}" = "AIX" ] ; then
    	OSSTR="${OS} `oslevel` (`oslevel -r`)"
    elif [ "${OS}" = "Linux" ] ; then
    	KERNEL=`uname -r`
    	if [ -f /etc/redhat-release ] ; then
    		DIST='RedHat'
    		PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
    		REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
    	elif [ -f /etc/SUSE-release ] ; then
    		DIST=`cat /etc/SUSE-release | tr "\n" ' '| sed s/VERSION.*//`
    		REV=`cat /etc/SUSE-release | tr "\n" ' ' | sed s/.*=\ //`
    	elif [ -f /etc/mandrake-release ] ; then
    		DIST='Mandrake'
    		PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
    		REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
    	elif [ -f /etc/debian_version ] ; then
    		DIST="Debian `cat /etc/debian_version`"
    		REV=""
    
    	fi
    	if [ -f /etc/UnitedLinux-release ] ; then
    		DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]"
    	fi
    	
    	OSSTR="${OS} ${DIST} ${REV}(${PSUEDONAME} ${KERNEL} ${MACH})"
    
    fi
    
    
    echo ${OSSTR}
    

    copy | embed

    0 comments - tagged in  posted by jrguitar21 on Jan 06, 2010 at 11:20 a.m. EST
  • search & apply new perm for files in pattern
    #!/bin/bash
    
    # Search for files with pattern name defined on name var, then
    # apply new user, group and other perms. located in path
    
    old_user='gin';
    new_user='shakka';
    
    old_group='guest';
    new_group='geek';
    
    name='*.ogg'
    path='/home/gin/video/';
    perm='700';
    
    	chmod ${perm} `find ${path} -name ${name} -user ${old_user} -group ${old_group}`;
    	chown ${new_user}:${new_group} `find ${path} -name ${name} -user ${old_user} -group ${old_group}`;
    
    exit 0;
    

    copy | embed

    0 comments - tagged in  posted by gin on Jan 05, 2010 at 6:19 p.m. EST
  • linux view hdd speed
    hdparm -t /dev/sda
    

    copy | embed

    0 comments - tagged in  posted by oz on Dec 23, 2009 at 3:17 p.m. EST
  • Locate Large Files on Linux
    Finds all files over 20,000KB (roughly 20MB) in size and presents their names and size in a human readable format. Replace "find /" with desired directory:
    
    find / -type f -size +20000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }' 
    

    copy | embed

    0 comments - tagged in  posted by abecker on Dec 17, 2009 at 11:35 a.m. EST
  • Set up mail forwarding on linux
    # add a .forward file to your home directory
    touch .forward
    
    # add your email address
    vi .forward
    <user>@<mail>.com
    
    # change permission else it won't work
    chmod 600 .forward
    
    # test mail send, replace 'user' with your login
    mailx -s 'test from cluster' user < /dev/null
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Dec 17, 2009 at 10:19 a.m. EST
  • Generate a text file with randon text data
    < /dev/urandom tr -dc [:print:] | head -c10000 > test.txt
    

    copy | embed

    0 comments - tagged in  posted by ricbat01 on Dec 13, 2009 at 6:36 a.m. EST
  • txt2html sed
    Snipt has been removed. Please contact nick@lionburger.com.
    

    copy | embed

    0 comments - tagged in  posted by voyeg3r on Dec 11, 2009 at 3:13 p.m. EST
Sign up to create your own snipts, or login.