Tag : UNIX

Title User Language Tags Description Date
dpkg -L maven2 fahrenx Other

shows all paths related to installed package

August 10
Sync Clock on Unix System jerryvig Bash

The command below should sync the clock on a unix server to the US timeservers at us.pool.ntp.org.

March 22, 2012
List files with details klovera Bash

List files in varying detail

February 1, 2012
MySQL Timestamp to UNIX Timestamp flipace PHP October 13, 2011
Compressing folders in Terminal, excluding .DS_Store files beneberle Bash

If you need to zip a directory named folderName and ignore all .DS_Store files, then do the following:

August 26, 2011
.htaccess domain redirects beneberle Bash August 16, 2011
Color shell prompt farstar78 Bash

insert this to home directory .bashrc file

July 30, 2011
What is the current shell you are in ? mprabhuram Bash

To find out the current shell

June 18, 2011
Get additional group IDs for Unix user (pwd/grp modules) realityexists python

The Python stdlib pwd module provides an easy way to get the primary group ID, but no way to get additional group IDs. This is a simple function that returns the additional group IDs for a given username.

June 3, 2011
Convertir un timestamp en heure lisible Phibo MySQL

MYSQL Convertir un timestamp en heure lisible

May 12, 2011
mySQL UNIX cheat sheet beneberle MySQL February 15, 2011
Convert Unix file to Windows file format jumptrooper CGI/Perl Command line perl statement to convert a unix formatted file to a windows formatted file. November 9, 2010
Convert Windows file to Unix file format jumptrooper CGI/Perl Terminal perl command to convert a windows formatted file to a unix formatted file. November 9, 2010
List directories by size in Linux / AIX mprabhuram Bash October 28, 2010
Creating a tar archive (without using the tarfile module) Benjamin Sergeant python

Creating a tar file is easy if you read the spec (you can look it up on wikipedia). Not every kind of files are supported (it support regular files, folders ans symlinks) and it's generating archives for the original tar file format (path length are limited to 100 chars, no extended attributes, ...). It wasn't tested very much but it was a fun hack :) ... I cheated just a little by looking at the python tarfile code from the stdlib for the checksum computation.

A tar file is very simple, it's a list of header/payload for each entry (file|folder|symlink) you want to archive. There's only a payload for file contents. The header is 512 bytes long and can be written in ascii. Numbers (attributes) needs to be written in octal. The files themselves needs to be written in chunks of 512 bytes, which mean you have to fill the last chunk with zeros when the file size is not a multiple of 512 bytes.

Use it like that:

python batar.py /tmp/foo.tar `find .` &&  tar tf /tmp/foo.tar # or xf if you want to extract it
October 11, 2010