Author: admin

  • RPM – Verify if a package is already installed

    Command to search for an installed package in .rpm systems
    rpm --verify mysql

  • List folders with a slash

    Option for ls command to list directories with and ending slash. Just to visualize directories in a different way.
    ls -p

  • Linux – Mount Bind

    An example of mounting with bind.
    mount --bind Folder NewFolder

  • Enable apache modules

    You can enable mods in ubuntu for apache with a2enmod command. To disable a module you can use a2dismod. Just remeber to pass module name as an argument.

    sudo a2enmod modulename

  • Aliases examples

    Some aliases examples:/

    alias compassing='compass watch'
    alias touchcompass='compass create'
    alias pbrew='pythonbrew' # == CoffeeScript Aliases == #
    alias coffee_pour='coffee -o build -c source/*.coffee'
    alias coffee_brew='coffee --watch -o brew --compile source/*.coffee' # file.coffee
    alias coffee_grind='coffee --join grind/project.js --compile source/*.coffee' # src/*.coffee
    alias coffee_smell='coffee -bpe' # == Dir navigation == #
    alias ..='cd ..'
    alias .='pwd'
    alias ~='cd ~'
    alias more='less' # == LS
    alias lsl='ls -mrA' # "list"
    alias lsL='ls -s | more'
    alias lsa='ls -lar' # all
    alias lsr='ls -spr' # reverse alpha
    alias lsR='ls -R'
    alias lsp='ls -p' # column dir # == File/Dir Managemenet == #
    alias rm='rm -i'
    alias cp='cp -i'
    alias mv='mv -i'
    alias mkdir='mkdir -p'

    http://www.emoticode.net/bash/more-aliases.html

  • Create a filesystem in a file

    Some times you need a new filesystem, for testing purposes or for whatever and you dont have access to a physical device. You can create a filesystem within  a file as follows:

    dd if=/dev/zero of=myfsys bs=512M count=1 # creating a 512M zeros file
    mke2fs myfilesys # creating a file system out of the file

    mount myfilesys /mnt -o loop=/dev/loop0 # mounting it as a loop device

    mkdir /mnt/point1 # creating a mount point
    mount /dev/loop0 /mnt/point1 # mounting

    df /mnt/point1/ # its alive!

    # results with:
    # Filesystem 1K-blocks Used Available Use% Mounted on
    # /dev/loop0 516040 400 489428 1% /mnt/point1

  • Add an existing user to existing group in Linux

    #add the user to the supplemental group(s)
    usermod -a -G group user

    #Change existing user primary group to www:
    usermod -g www user

  • Mounting shared folder in a linux guest in virtualbox

    It took me sometime to find out how to do this.
    mount -t vboxsf SharedFolder /mnt/folder
     

  • Get MAC address of a host in your lan

    With arp command you can find out what mac address any host in your lan has.

    > arp 192.168.0.12

    Address HWtype HWaddress Flags Mask Iface
    192.168.0.12 ether 00:0F:AE:34:03:07 C eth0

  • Urldecode

    php -r "echo urldecode('$@'.\"\n\");"