what is a file ?


Trivia Category: Science: Computers
Difficulty: Medium
The first computer bug was formed by faulty wires.
True or False?

 
Thread Tools Search this Thread
# 1  
what is a file ?

I have few basic doubts about files

1) Windows recognizes file by its extension like (.txt , .csv). How does unix/linux do it ?


2) How does file editor capable of editing various file formats ? Whats the logic behind it ?

3) Does all files have metadata ?

4) If they contain a meta data how to read it (tel me some simple python script)?

5) Are the properties like timestamp, permission, size are stored in the file itself?

6) Is it possible to create my own file and a file editor, such that no other file editor (e.g vi) could read it ?
If yes pls let me know the tutorial link.
# 2  
little odd questions but i can try and answer a few of them.

because unix/linux is mostly command based your files will mostly be text based. this is why when you do a
Code:
cat more vi <file>

you are able to see the contents. similar to a .bat file in windows.

lets say this for example:
you have a script you need to run but you don't know what extension it uses (typically you wont need to know unless your writing the script) - but at the first line you'll see what application it's starting example : perl, ksh. sh, bash etc.

usually looks something like this:

Code:
#!/usr/bin/ksh

this tells the script that it's using "ksh" to run the script.

as for your last question.

unix/linux can be controlled with permissions much like windows, only thing is in unix/linux you'll need to be root in order to change anything i don't want other users to have access to, no exceptions. windows there are many ways to fool around and get access to a file that a user doesn't want you to see but this is one of the things as why unix/linux is a lot more secure. (of course there are other ways but i wont get into that Smilie )

basicly you set the permissions, owner, group to something only you have access to and then other users wont be able to read it, write, or execute.

that's a basic summary. remember for majority of these questions you can find the answers on google.

like i said it's a bit odd of a question and i'm not 100% sure how to answer it but this is my opinion of it "determines what file your using"
This User Gave Thanks to vpundit For This Post:
# 3  
Thanks vpundit, that answered my first two questions..
# 4  
Quote:
Originally Posted by Arun_Linux
3) Does all files have metadata ?
Depends what you mean by metadata. All files have a file name, change-time, modification-time, access-time(though that's frequently left alone), size, and other such things you'd expect of a file, which are not stored inside the file data itself.
Quote:
6) Is it possible to create my own file and a file editor, such that no other file editor (e.g vi) could read it ?
A file is a file. Even if you don't understand the contents you can still look at it unless you don't have permissions to do so. If you want to prevent people from looking at what's in it, chmod -r is more effective than obfuscating the contents.
# 5  
Hi, Arun_Linux.

Welcome to the forum.

You may have noticed that your thread got 100 reads, but very few replies.

That's because many people do not respond to factual questions that can easily be answered by searching on the net.

For example:

Unix File System - Wikipedia, the free encyclopedia

Unix file types - Wikipedia, the free encyclopedia

will probably answer most of your questions.

Google and Wikipedia are your friends.

Best wishes ... cheers, drl
This User Gave Thanks to drl For This Post:
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies

2. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

3. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

Featured Tech Videos