Why my bash shell displays files with extensions?

According to the mission none of the files should have extensions, but when I am doing the same in the shell on my computer it displays files with extensions and file command does not work for me without adding extension to the file name.

IN THE MISSION:

ON MY COMPUTER:

2 Likes

ls -l : the -l option allows us to display some of the metadata. The l is for long, as it also lists the file in long format. So the command won’t determine if a file has an extension, it will output the file as it is whether it has an extension or not.

Hello @y.perepechenko,

It does not mention anywhere in a mission that “It should not have extensions”

In Dataquest, It did not show extension for if_name file as it does not have one.

Here, I have added two new files with extension demo.py and AppData.csv and then run ls or ls -l command and you can see both showing file names with extension.

image

So command simply printing file names it does not matter if it has an extension or not.
I hope it is clear now.

1 Like

Actually I have a problem with file command, when I enter f.e. file Applestore result is file does not exist, when I put file Applestore.csv it works, but in mission was said that extension is not necessary, bcs file command determines the type of files itself.

1 Like

In UNIX-like operating systems, it does not recognize extensions differently from the rest of the filename. We are giving .csv and .py the file extension for human readability not for the system.

So here extension is part of the file name hence extension does not mean anything special. When you do file Appstore it looks for name Appstore but did not found any as file name is Appstore.csv (remember .csv extension is part of file name) hence we need to do file Appstore.csv

By means, it wants to say in the context of system. The Unix-like system does not determine file type based on the file extension. hence “extension is not necessary”

So how does system know that it is csv or text file?

It Used Magic number store in file it self to determine file type. Not using file extension.

Resource

2 Likes