 |
 |
 |
 |
| Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum. |

3rd June 2012, 06:40 PM
|
|
Registered User
|
|
Join Date: May 2012
Location: Aspen
Posts: 48

|
|
|
Confused by this man page
The tutorial I am reading mentioned this #! (called a shabang in the book) as a "magic number." It said that for more information regarding "magic" one should type man magic and read the man page. I didn't get some of what I saw but it seems to me that magic numbers are file headers. It seems to indicate that magic.. whatevers, are used to identify magic patterns, the type of file, and a few other things. I am a little fuzzy and I guess what I am asking for is clarification. What is magic?
Here is a link to an online version of the man page:
http://linux.die.net/man/5/magic
|

3rd June 2012, 06:54 PM
|
 |
"Registered User" T-Shirt Winner
|
|
Join Date: Mar 2007
Location: Seville, FL
Posts: 5,118

|
|
|
Re: Confused by this man page
Quote:
DESCRIPTION
This manual page documents the format of the magic file as used by the file(1) command, version 5.07. The file(1) command identi‐
fies the type of a file using, among other tests, a test for whether the file contains certain “magic patterns”. The file
/usr/share/misc/magic specifies what patterns are to be tested for, what message or MIME type to print if a particular pattern is
found, and additional information to extract from the file.
|
Is there something about the basic Description at the top of the "man magic" manual that you don't understand? I don't see how it could be written to be any clearer. The "magic" referred to here is just data embedded into the header of a file that gives information about the file, as searched for and used by the "file" command. No real magic involved at all.
|

3rd June 2012, 07:22 PM
|
|
Registered User
|
|
Join Date: May 2012
Location: Aspen
Posts: 48

|
|
|
Re: Confused by this man page
Haha that's about what I gleaned, thanks. I was sort of hoping to us it to pull bunnies out of my disk drive but what can you do?
|

3rd June 2012, 07:31 PM
|
 |
"Registered User" T-Shirt Winner
|
|
Join Date: Mar 2007
Location: Seville, FL
Posts: 5,118

|
|
|
Re: Confused by this man page
Well, bunnies are really really difficult to get into your disk drives (you can't pull them out until after you've put bunnies in), especially hdd's or ssd's. But it's somewhat possible with optical disk drives. Of course, you must first prepare the bunnies to be very flat and round, then insert them into your optical disk drives tray. Then, you're all set to amaze your friends and family by pulling bunnies out of your optical disk drive. They will applaud you, or despise you, depending on their personal feelings about bunnies.
|

3rd June 2012, 08:49 PM
|
|
Registered User
|
|
Join Date: May 2012
Location: Aspen
Posts: 48

|
|
|
Re: Confused by this man page
Quote:
Originally Posted by PabloTwo
Well, bunnies are really really difficult to get into your disk drives (you can't pull them out until after you've put bunnies in), especially hdd's or ssd's. But it's somewhat possible with optical disk drives. Of course, you must first prepare the bunnies to be very flat and round, then insert them into your optical disk drives tray. Then, you're all set to amaze your friends and family by pulling bunnies out of your optical disk drive. They will applaud you, or despise you, depending on their personal feelings about bunnies.
|
hahaha
Also, a quick unrelated question that i don't really want to start a whole new thread for... I have been playing around with ls and I ls-ad my Documents folder to see if there were any hidden files in there. There were, including an old password file that I had thought I had deleted. I deleted the hidden files but I have 2 questions.
1. How did some of my deleted files wind up sticking around as hidden files?
2. What happened to the hidden files when I delted them? Do they stick around somewhere?
I did all of my deleting with the rm command.
|

3rd June 2012, 09:05 PM
|
 |
"Registered User" T-Shirt Winner
|
|
Join Date: Mar 2007
Location: Seville, FL
Posts: 5,118

|
|
|
Re: Confused by this man page
Quote:
Originally Posted by Socrates440
1. How did some of my deleted files wind up sticking around as hidden files?
2. What happened to the hidden files when I delted them? Do they stick around somewhere?
I did all of my deleting with the rm command.
|
1) They didn't. If they are still there, then you didn't delete them, even if you thought you did. Maybe you had two files, ~/mypasswords and ~/.mypasswords, and you deleted ~/mypasswords and thought you were done, forgetting to delete ~/.mypasswords. Maybe you're the forgetful or inattentive type, I don't know. All I can say is, "If the file is there, then you didn't delete it".
2) If you deleted them with the "rm" command, they were deleted. No, they don't stick around somewhere. When you delete a file with "rm", it's gone, forever. There is no Trash folder for directories or files removed from the command line.
|

3rd June 2012, 09:10 PM
|
|
Registered User
|
|
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,094

|
|
|
Re: Confused by this man page
1 - it depends on how you deleted them. Some utilities will rename the original file (frequently editors) when updating files to provide a backup recovery if things go south (power failure and such) during the final write. This gives you a chance to get the original file back during recovery. Usually (not always) they are deleted after the update is complete.
2. rm simply tells the filesystem to remove a directory entry, which in turn decrements a link count from the inode. When the inode link count reaches zero it is marked available for reuse. The data blocks are deallocated. It is frequently (depending on which filesystem) possible to recover this if you can mark the inode as "not deleted" by establishing a link (recovery utilities). If the data blocks have not been reused, then the data is also reassigned to the inode... and you have an undeleted file. The longer the time between the delete and recovery makes it more unlikely a recovery is possible as some data blocks may get reused for other files.
|

3rd June 2012, 09:22 PM
|
 |
"Registered User" T-Shirt Winner
|
|
Join Date: Mar 2007
Location: Seville, FL
Posts: 5,118

|
|
|
Re: Confused by this man page
jpollard brings up a good point here. Some GUI text editors do keep copies (backups) of edited files if the option to do so is set in that text editors configuration. I can't even recall which GUI text editor it was that I used long ago (may gedit?), that would auto-save a pre-edit copy of the text file I was editing with the same filename but with a tilda "~" appended at the end of the filename, and the GUI file manager/browser was set to treat any file ending with a tilda as a "hidden" file.
Perhaps the ".filename" file(s) you found were the result of some GUI text editor you were using earlier but didn't realize it was saving backup copies in that manner.
|

3rd June 2012, 10:20 PM
|
|
Registered User
|
|
Join Date: May 2012
Location: Aspen
Posts: 48

|
|
|
Re: Confused by this man page
That is exactly what I saw with my plain text file. I bet that's what happened. It is good to know that gedit does that.
As for the .sh file, the only time that file ever existed in the directory where I found the hiden file was when I was paying with the tar command and the cp command. I packaged all of my .sh files into a tar file, cpd that tar file to my Documents folder, unpacked the tar file, then deleted the tar file and the .sh files with rm. I never intentionally created any hiden files. Could anything in that process have created the hidden .sh file?
|

4th June 2012, 12:20 AM
|
|
Registered User
|
|
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,094

|
|
|
Re: Confused by this man page
That may depend on the desktop environment. Not sure - the sequence of commands you show do not generate hidden files in and of themselves. Well... one way is to have an alias for rm that renames them, but this is frowned on as being useless. And it would tend to scatter lots of such files everywhere.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 18:26 (Sunday, 19-05-2013)
|
|
 |
 |
 |
 |
|
|