Search This Blog

Tuesday, September 27, 2011

How to find file creation date in Linux

I had been struggling a lot, A LOT(I mean it) to find *any* possible solution to get the file creation date on Linux systems. But, I had given up at one point.
All in all, suddenly I came across a post on garage4hackers, and was so happy to see it.
So here we go...

Also AFAIK, this is possible with ext4 filesystems:


user@ubuntu:~$ touch test.txt && ls -l test.txt
-rw-r--r-- 1 user user 0 2011-09-27 18:38 test.txt
user@ubuntu:~$ cat << __eof > test.txt 
Hi there,
Hope you all fine.
__eof
user@ubuntu:~$ ls -l test.txt 
-rw-r--r-- 1 user user 29 2011-09-27 19:44 test.txt
user@ubuntu:~$ ls -i test.txt 
14552801 test.txt
user@ubuntu:~$ sudo debugfs -R 'stat <14552801>' /dev/sda7 
[sudo] password for user:
Inode: 14552801   Type: regular    Mode:  0644   Flags: 0x80000
Generation: 340511001    Version: 0x00000000:00000001
User:  1000   Group:  1000   Size: 29
File ACL: 0    Directory ACL: 0
Links: 1   Blockcount: 8
Fragment:  Address: 0    Number: 0    Size: 0
 ctime: 0x4e81da5b:513cbff4 -- Tue Sep 27 19:44:51 2011
 atime: 0x4e81da5e:c8725434 -- Tue Sep 27 19:44:54 2011
 mtime: 0x4e81da5b:513cbff4 -- Tue Sep 27 19:44:51 2011
crtime: 0x4e81cacc:966104fc -- Tue Sep 27 18:38:28 2011
Size of extra inode fields: 28
EXTENTS:
(0): 58665199
debugfs 1.41.11 (14-Mar-2010)

Please note various timestamps mentioned in output

atime: Last time file was opened or executed
ctime: Time the inode information was updated. ctime also gets updated when file is modified
mtime: Last modified time
And most importantly
crtime: File creation time


Thanks to Hackuin, who had posted about it on garage4hackers forum.
Reference: http://www.garage4hackers.com/f30/did-you-know-330-2.html


..............Done!!!

Monday, July 11, 2011

Clone virtual machine in VirtualBox....

If you have used VmWare Workstation earlier and now working on VirtulBox, you may have to bang your head to create a cloned virtual machine on VirtualBox. As it's not as easy as you do in VMWare workstation.(#FAIL @VirtulBox).

Never mind...here are the steps you can do on your Ubuntu host OS to create clone of a guest OS.

$ vboxmanage clonehd <source-folder/file.vdi> <destination-folder/clone.vdi>
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: e64c4d5f-8ae1-4e69-aa68-cedd3fe5c43e
$

Next, create a New virtual machine.
And while choosing virtual hard disk, just choose the option "Use existing hard disk", instead of creating a new one.
And just give the path of 'vdi' file, you've just created.

..............Done!!!

Friday, April 29, 2011

Ubunt 11.04 is here...

Woohoo...Ubuntu 11.04, codenamed 'Natty Narwhal' has been just released.
Get you copy...

Here are some torrent files, you might be interested :)
-Desktop editions:
    -64 bit : http://releases.ubuntu.com/11.04/ubuntu-11.04-desktop-amd64.iso.torrent
    -32 bit : http://releases.ubuntu.com/11.04/ubuntu-11.04-desktop-i386.iso.torrent

-Server editions:
    -64 bit : http://releases.ubuntu.com/11.04/ubuntu-11.04-server-amd64.iso.torrent
    -32 bit : http://releases.ubuntu.com/11.04/ubuntu-11.04-server-i386.iso.torrent

Enjoy :-)

Thursday, April 28, 2011

Saturday, April 16, 2011

Small tips and tricks

Thought to share few tips and tricks...

1.Ubuntu fresh installation
While making a fresh installation of ubuntu, it's always safer to give separate partitions for boot, root(/), swap(if needed) and home directory. So, while installation, select "Manual partitioning" and delete all the current partitions(ALWAYS REMEMBER TO TAKE BACKUP BEFORE PROCEEDING FOR FRESH INSTALLATION). And specify partitions as follows:(I will take my system configurations as an example, so that may give you an idea)

- /boot   : Primary partition, 100MB space
- /          : Primary partition, 20GB space (min recommended is 8GB)
- /home : Primary partition, rest-complete space

I didn't find any need to give anything for swap partition. As I have 4GB RAM and applications I would be running includes VMWare workstation/VirtualBox, Ubuntu Compiz effects, Firefox, Google Chrome, etc.

So, I didn't find to waste any space for swap, if I won't be needing it. You may decide swap according to your needs.
Here is a link, which can be helpful for taking backup and reinstalling/upgrading ubuntu:
https://help.ubuntu.com/community/Partitioning/Home/Moving


2. Execute command from history
Many times, things may happen like, you want to execute a very long command and you are as lazy as I am. So, here is what you do:

ubuntu@localhost:~$ history |grep rsync
  110  man rsync 
  111  rsync -h
  116  rsync -h |grep time
  117  rsync -h |grep -i time
  122  rsync -arH some/local/dir some-machine-name:/some/remote/dir
  .
  .
  .
  .
  .
  .
  .
ubuntu@localhost:~$ !122
rsync -arH some/local/dir some-machine-name:/some/remote/dir
ubuntu@localhost:~$


3. rsync : Sync and Backup utility in Ubuntu



..............Done(for now)!!!

Thursday, January 20, 2011

[Ubuntu] perl: warning: Setting locale failed.

Hi,

I have faced this problem many more times on either client desktops or when I have to configure some ubuntu server. So I had to search for the solution every time I face this annoying thing again and again.
Just thought of writing about it, and so people(like me, who merely remember what they did to sort out the problem) won't face it again and again.


perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
 LANGUAGE = (unset),
 LC_ALL = (unset),
 LANG = "en_US.utf8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

So, here is what I did to solve it

ubuntu@localhost:~$ sudo locale-gen en_US.UTF-8
[sudo] password for ubuntu:
Generating locales...
  en_US.UTF-8... done
Generation complete.
ubuntu@localhost:~$ sudo dpkg-reconfigure locales
Generating locales...
  en_US.UTF-8... up-to-date
Generation complete.
ubuntu@localhost:~$

..............Done!!!