unix / linux

  • Disable suexec

    To find suexec type in

    whereis suexec

    Result

    suexec: /usr/sbin/suexec /usr/sbin/suexec.saved_by_psa /usr/share/man/man8/suexec.8.gz

    Now move the file to a backup

    mv /usr/sbin/suexec /usr/sbin/suexec_old

    Restart apache

    /etc/init.d/httpd  restart
  • Transfer files from one server to another using scp

    Type this command on the command line to move files from one server to another

    scp bkp.tar username@name_of_the_server:/emplacement_to_put_the_file

    Source: http://www.webmaster-talk.com/php-forum/119073-transfer-files-from-one-server-another.html

  • How do I create a symbolic link?

    ln -s [TARGET DIRECTORY OR FILE] ./[SHORTCUT]

    For example:

    ln -s /usr/local/apache/logs ./logs

    This points a symbolic link “./logs” to “/usr/local/apache/logs”

    Source: http://help.hardhathosting.com/question.php/95

  • unzip – list, test and extract compressed files in a ZIP archive

    Synopsis

    unzip filename.zip

    Description

    Unzip will list, test, or extract files from a ZIP archive, commonly found on MS-DOS systems. The default behavior (with no options) is to extract into the current directory (and subdirectories below it) all files from the specified ZIP archive. A companion program, zip(1L), creates ZIP archives; both programs are compatible with archives created by PKWARE’s PKZIP and PKUNZIP for MS-DOS, but in many cases the program options or default behaviors differ.

    Source: http://linux.die.net/man/1/unzip

  • Linux / Unix rmdir command

    About rmdir

    Deletes a directory.

    Syntax

    rmdir [OPTION]... DIRECTORY...

    –ignore-fail-on-non-empty ignore each failure that is solely because a directory is non-empty.
    -p, –parents Remove DIRECTORY and its ancestors. E.g., `rmdir -p a/b/c’ is similar to `rmdir a/b/c a/b a’.
    -v, –verbose output a diagnostic for every directory processed.
    –version output version information and exit.
    Examples

    rmdir mydir - removes the directory mydir
    rm -r directory - would remove a directory, even if files existed in that directory.

    Source: http://www.computerhope.com/unix/urmdir.htm

  • Pack folder and contents with tar gz

    Packing folders using tar.gz

    tar -zcvf packagename.tar.gz folder/

    Source: http://snipplr.com/view/1755/unix-pack-folder-and-contents-with-tar-gz/

  • How do I unpack a compressed tar file

    Unzipping a .gz file

    gunzip filename.tar.gz

    This replaces filename.tar.gz with filename.tar

    Extracting tar files

    tar xvf filename.tar

    Note: Always move to an empty directory before unpacking a tarfile. When you unpack a tarfile its contents are written to the current directory. Any file or directory with the same name as the contents of the tarfile will be overwritten!

    A quick method

    Alternatively, you can unpack a compressed/zipped tarfile using the zcat or gzcat command. (gzcat is a local alias for the GNU zcat command). This leaves the compressed .Z or .gz tarfile intact. For example:

    zcat filename.tar.Z  | tar xvf -

    or

    gzcat filename.tar.gz | tar xvf -

    The zcat command recreates the uncompressed tarfile, which is then piped into the tar command to extract the files.

    Source: http://info.eps.surrey.ac.uk/FAQ/unpack.html