• Home
  • Cisco
  • Exchange
  • Linux
  • Navision
  • Network
  • Virtualization
  • Windows
  • About
  •  

    Small usefull Linux commands


    Compress a folder to a file with timestamp
    tar cfvz /fil-$TIMESTAMP.tgz /etc

    Postfix
    If changed mail.cf, do a /etc/init.d/postfix reload
    If changed /etc/postfix/virtual run this command: postmap hash:/etc/postfix/virtual
    postmap /etc/postfix/transport

    Copy a hard-drive
    dd if=/dev/hd_originaldisk-partition of=/dev/hd_nydisk-partition

    MySQL Backup
    /usr/bin/mysqldump -A -uroot -p[myCode] > /andet/backup.sql

    Delete a folder containing files
    rm -rf /remove/this

    Create an empty file
    touch file-name

    Disk-use of an folder
    du -sh folder

    Format disk
    cfdisk /dev/hda

    Extract tar.bz2 to a folder
    tar xzf file.tar.bz2

    NMAP scan to a file
    nmap -sS -PT -PI -O -T 3 10.0.0.*>file.txt

    Change file and folder rights
    chown martin filename
    chown -R martin:martin FileAndSubFolders

    chmod
    – user group other
    – 4 2 1 4 2 1 4 2 1
    – r w x r w x r w x

    Boot script in Debian
    /etc/rc.boot/
    Remember: #!/bin/bash
    on top of the text files.

    Set date and time
    ntpdate

    Search inside files
    find /www/test.local/www/ -name * | grep -lir VALID_AZ09 *

    Create sources.list
    http://debgen.simplylinux.ch/index.php

    Show 30 largest folders
    du -m /FOLDER | sort -nr | head -n 30
    Size is in Megabyte