Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jan 022010
 

How to generate random password?

Answer:

Install the "makepasswd" package, for example, in Ubuntu, type

sudo apt-get install makepasswd

Then execute command

# makepasswd 

ShdDHNt7z

Or you can use another tool called pwgen

sudo apt-get install pwgen

and execute

# pwgen 8 10

It will generate 10 passwords with length equal to 8

Jan 022010
 

How to change file's modification time?

Answer:

1. To see the current file stats, use

# stats test.txt

stat test.txt
  File: `test.txt'
  Size: 25557           Blocks: 56         IO Block: 4096   regular file
Device: ca01h/51713d    Inode: 32714       Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1001/    user)   Gid: ( 1000/ user)
Access: 2010-01-02 18:53:46.000000000 +0800
Modify: 1970-01-01 17:13:08.000000000 +0800
Change: 2010-01-02 18:53:46.000000000 +0800

2. To change the file's mtime (Modification time), use

touch -m -d '1 Jan 2006 12:34' test.txt

3. To change the file's atime (Last access time), use

touch -a -d '1 Jan 2006 12:34' test.txt