Fedora Linux Support Community & Resources Center
  #1  
Old 3rd June 2012, 06:40 PM
Socrates440 Offline
Registered User
 
Join Date: May 2012
Location: Aspen
Posts: 48
linuxfirefox
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
Reply With Quote
  #2  
Old 3rd June 2012, 06:54 PM
PabloTwo Online
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 6,138
linuxchrome
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.
Reply With Quote
  #3  
Old 3rd June 2012, 07:22 PM
Socrates440 Offline
Registered User
 
Join Date: May 2012
Location: Aspen
Posts: 48
linuxfirefox
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?
Reply With Quote
  #4  
Old 3rd June 2012, 07:31 PM
PabloTwo Online
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 6,138
linuxchrome
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.
Reply With Quote
  #5  
Old 3rd June 2012, 08:49 PM
Socrates440 Offline
Registered User
 
Join Date: May 2012
Location: Aspen
Posts: 48
linuxfirefox
Re: Confused by this man page

Quote:
Originally Posted by PabloTwo View Post
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.
Reply With Quote
  #6  
Old 3rd June 2012, 09:05 PM
PabloTwo Online
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 6,138
linuxchrome
Re: Confused by this man page

Quote:
Originally Posted by Socrates440 View Post
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.
Reply With Quote
  #7  
Old 3rd June 2012, 09:10 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,847
linuxfirefox
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.
Reply With Quote
  #8  
Old 3rd June 2012, 09:22 PM
PabloTwo Online
"Registered User" T-Shirt Winner
 
Join Date: Mar 2007
Location: Seville, FL
Posts: 6,138
linuxchrome
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.
Reply With Quote
  #9  
Old 3rd June 2012, 10:20 PM
Socrates440 Offline
Registered User
 
Join Date: May 2012
Location: Aspen
Posts: 48
linuxfirefox
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?
Reply With Quote
  #10  
Old 4th June 2012, 12:20 AM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,847
linuxfirefox
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.
Reply With Quote
Reply

Tags
confused, man, page

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Home page should be the forum's page... mr.v. Suggestions & Feedback 7 2nd February 2007 03:16 AM
Page Up / Page Down in gnome-terminal Zontar Using Fedora 0 25th May 2005 10:35 PM
creating custom linux distro:confused: :confused: :confused: noobiedora Using Fedora 2 27th February 2005 03:25 PM


Current GMT-time: 22:02 (Saturday, 20-09-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat