Live Chat!

umask: create new files with specified file mode

          0 votos

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 this case, the file [...]

Posted in Admin, touch, umask | Hits: 12935 | 1 Comment »

Remove file start with special character

          0 votos

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 PostsHow to manipulate files with name like [...]

Posted in Common, mv, rm, touch | Hits: 9529 | 3 Comments »

touch your files

* * * * * 1 votos

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 [...]

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

Generating Random numbers

* * * * * 1 votos

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 read. [...]

Posted in Bash, Misc, echo, od, touch | Hits: 7070 | No Comments »