umask: create new files with specified file mode

March 8th, 2008 mysurface

Did you realized that every time we create a new file in Linux, it always been set with certain file mode? Lets see this: touch testing ls -l testing -rw-r–r– 1 mysurface mysurface 0 2008-03-08 01:14 testing Refers to the chmod examples post, read, write and executable permission value is 4, 2 and 1. In […]

Posted in Admin, touch, umask | Hits: 57107 | 2 Comments »

Remove file start with special character

December 5th, 2006 mysurface

In linux, file can be any name, including “–testing”. If you have a file with this name, how you delete it? Command line bellow will fail, rm –testing The correct one is rm ./–testing This works for mv, cp etc. So you can actually create a file with name “–testing” using touch. touch ./–testing Related […]

Posted in Common, mv, rm, touch | Hits: 63372 | 9 Comments »

touch your files

November 14th, 2006 toydi

When you touch a file, you change both its accessed and modified time. Here’s a file and its status: $ stat foobar File: `foobar’ Size: 154 Blocks: 8 IO Block: 4096 regular file Device: 304h/772d Inode: 167769 Links: 1 Access: (0644/-rw-r–r–) Uid: ( 1000/ toydi) Gid: ( 1000/ toydi) Access: 2006-11-14 22:06:06.000000000 +0800 Modify: 2006-11-14 […]

Posted in Common, stat, touch | Hits: 23270 | 2 Comments »

Generating Random numbers

October 27th, 2006 mysurface

We can obtain pure random (NOT pseudo-random) bytes from /dev/random. Linux kernel harnesses a good source of randomness from you. The random bytes in /dev/random is measuring based on the time delay between your input actions. so seems /dev/random provided random bytes, we need to turn the bytes into an integer so that we could […]

Posted in Bash, echo, Misc, od, touch | Hits: 98474 | 10 Comments »