Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.Before you post please read how to get help

After noticing a flood of new threads involving viruses/antiviruses, defragmentation, security, etc, I decided it would be a good idea to whip up a concise (and simple) explanation of why the security/performance measures you're used to taking on Windows are simply not needed in Linux. The two most popular questions I've seen are antiviruses and defragging, so those are the two I'll concentrate on.

The short answer for a normal home user who doesn't want to read any more: neither defragging nor antivirus programs are necessary on a Linux machine. Read below for more!

DefraggingSo what does defragging mean anyway? While you're using a computer, creating and deleting files, moving information, and generally just changing things, the data in your filesystem can become separated, leaving blank spaces on your hard drive. These separate pieces of data are called "fragments," and the problem with them is that they make the blank spaces basically inaccessible. When you talk about "defragging" in Windows, you're actually talking about compressing the fragments in your filesystem. Windows uses a filesystem called NTFS, while Linux (for the most part) uses a different filesystem called ext3. To put it simply, ext3 does not have the same fragmentation issues that NTFS has simply by its design. If you installed a Linux distro with an NTFS filesystem, it would have the same fragmentation problems as Windows. So it isn't necessarily Linux that prevents fragmentation, it's actually the filesystem underneath the system. Because of this, if you installed Linux using the default filesystem (ext3), you will not have to defrag the disk like you did in Windows! For more on fragmentation (and the difference between Linux and Windows in that respect), see this article: Why doesn't Linux need defragmenting?

Note: linuxviolin made a good point in response to this thread. All filesystems (even ext3) will fragment after enough use and could eventually need defragmenting. Although this defragging would be very occasional, and not something you would have to worry about when starting out on Linux, it may want to be something you consider in the future. Personally, I've been running Linux for seven months and haven't even thought about defragging yet.

And on to part 2...

AntivirusStraight from a former newbie, this a great way to think about the issue in my opinion:

Colonel Schell wrote:I hope this helps you a bit, as I tuned in to your confusion about two things which confused me a lot when I first began using Linux.

The first realization I made was that viruses and malware are bits of code that infect the 'software,' not the hardware of the machine. 90% of the PC's connected to the Internet are Microsoft Windows run machines; therefore, the hacker-crackers and 'script-kiddies' write the malware for the Windows operating system. Linux is layed out in a different way, so the same code that infects Windows will not infect Linux or other similar OS's.

Bottom line: Windows viruses will not affect a Linux system. There are very few viruses you have to worry about as a Linux user, and your firewall should protect you from them as long as you don't do anything careless. Although there is a much smaller risk of infection on a Linux system, that doesn't mean you should run around on the web downloading everything you see without hesitation. That being said, you can still carry viruses and spread them to other Windows machines, so it is often considered courteous for a Linux user to scan a file (using something like ClamAV) before sending it to a Windows user. This way, although the virus hasn't been affecting you, it also won't be allowed to affect the recipient of the file you're sending. If you use a service like Google or Yahoo to send email, however, they have built-in virus scans, making a manual scan irrelevant. Basically, it's 100% up to you wether or not you'd like to scan your files. Ever. Many Linux users don't even have an antivirus installed on their system, myself included.

All of this being said, it is possible to expose your Linux system to outside threats, if you try hard enough. No operating system is invincible, but as long as you take common-sense precautions, you'll have no problems with viruses. For more info, here's another article: Linux vs. Windows Viruses

Important: Although Linux is very resistant to viruses, it is not resistant at all to user input. The implication of this is that you should always have some idea of what you're doing before you do it. Sometimes a malevolent user will post something you don't understand, toting it as a "script" that'll solve some problem or improve some functionality. For example, if you're browsing the web for whatever reason, and you come across a script like this:

Absolutely do NOT run it without first finding out what it does. That specific snippet will initiate an attack called a "forkbomb", causing infinite recursion and meaning you'll have to reboot (ie. you'll lose anything you were doing when you ran the code). People can be nasty, don't trust everything you see on the Internet.

Also important: Despite what I said above, there are some nefarious methods that will work on both Linux and Windows, the most prominent of them being JavaScript attacks through Firefox. I've never heard of a JavaScript attack causing a huge system-wide problem, but they can cause big problems with your browser. The good news is that JavaScript is very easy to avoid! When you first run Firefox, go to Tools -> Add-ons, search for NoScript, and install it. With NoScript, these cross-platform JavaScript attacks will never be able to make it through to your browser. Yay! Some more notes on JavaScript from a helpful guru:

DrHu wrote:As well as noscript, I would suggest running without JavaScript enabled in browsers or Adobe acrobat reader or indeed any application, that wants to connect to the Internet for your convenience--javascript can be temporarily tuned on for sites that need it via the noscript addon/extension for Firefox

Additionally in the noscript settings, don't use [x]Scripts Globaly Allowed in the General TAB--I think it is still turned on as the default selection when noscipt is added, but it may not be; I have had noscript running for a long time

And for the browser specifically, the LSO (Local shred object) should be eliminated, Flash magic cookies.--for that a search on these forums will show how, easy in Linux.

So now you know! Defragging and antivirus programs are really unnecessary for your new Linux install. And try not to do anything crazy with the command line until you have an understanding of what's going on. Welcome to Mint, I hope you enjoy your experience

Last edited by Kaye on Thu Aug 27, 2009 10:30 am, edited 8 times in total.

optimize me wrote:I was a n00b once myself, as were we all. But these darned kids today.. they're just hopeless.

And I wish they'd stay off my lawn.

I don't mind the newbie aspect really.. it was only about six months ago that I was on here begging for help with my initial partitioning It would just be nice to see some of the more dependent ones trying a bit harder. It can get old to see 100 posts about the same thing when a two second search would solve the problem just as well. If we took your idea and had a sticky of FAQs, maybe they'd see that before they went to post their topic, thus averting some frustration on our part. In any case, I'm sure Husse and the rest of the team will consider everything thoroughly before making a decision.

Now... if you can figure out how to get people to look or search before they post, you will have a real winner.

I'll help by making it stickyAnd add one thing that I don't think I sawIn your browser (be it Firefox or something else) javascripts run just fine regardless of it it's Windows or LinuxUse Firefox with the NoScript add on (don't know if Opera has something similar)

Now... if you can figure out how to get people to look or search before they post, you will have a real winner.

I'll help by making it stickyAnd add one thing that I don't think I sawIn your browser (be it Firefox or something else) javascripts run just fine regardless of it it's Windows or LinuxUse Firefox with the NoScript add on (don't know if Opera has something similar)

Thanks for the sticky I added the bit about JavaScript, let me know if anything else comes up that you think should be added.

Kaye wrote:The good news is that JavaScript is very easy to avoid! When you first run Firefox, go to Tools -> Add-ons, search for NoScript, and install it. With NoScript, these cross-platform JavaScript attacks will never be able to make it through to your browser. Yay!

As well as noscript, I would suggest running without JavaScript enabledin browsers or Adobe acrobat reader or indeed any application, that wants to connect to the Internet for your convenience--javascript can be temporarily tuned on for sites that need it via the noscript addon/extension for Firefox

Additionally in the noscript settings, don't use [x]Scripts Globaly Allowed in the General TAB--I think it is still turned on as the default selection when noscipt is added, but it may not be; I have had noscript running for a long time

And for the browser specifically, the LSO (Local shred object) should be eliminated, Flash magic cookies.--for that a search on these forums will show how, easy in Linux.

And of course you are right about the anti-virus issue; not much of a concern for Linux users..

This thread is good and I realize it is designed for newbies but I guess we must clarify two points.

1. Linux is not 100% free about viruses and al. Yes Windows is much more attacked, hey there are about 98% Windows computers vs. 2%, but Unix is not absolutely free of all attacks... But as a home user probably you will meet no problem. If you have a server, the problem is different...

I know this was said in a previous post but this had to be repeated. Too many people have a "false" feeling of security just because they run Linux... You must be careful nonetheless and not do "anything" just because you use Linux! By the way, I have at home an issue of a magazine devoted entirely to threats to Unix / Linux / BSD explaining and showing well that to believe him/herself completely immunized just because we use something other than Windows is wrong.

So, à priori you probably do not need protections you use/used with Windows but there are still some threats, so you must remain vigilant and not do anything.

2. About defragging, you are almost right Yes the Unix file systems have few fragmentation but all file systems fragment, and sometimes, defragging is not a bad thing... (even ext4 and XFS: "Offer online defragmentation ability. " "even XFS file system needs defragmentation occasionally. ") E.g. about JFS:

JFS, like all file systems, will degrade in performance over time due to file fragmentation

(Arch Wiki)

OK this is "occasionally" but it should not be "hidden" even if newbies, and maybe home users, have perhaps no real reason to deal with it right now.

K.I.S.S. ===> "Keep It Simple, Stupid""Simplicity is the ultimate sophistication." (Leonardo da Vinci)"Everything should be made as simple as possible, but no simpler." (Albert Einstein)

Just to illustrate my first point, just see this about Arch Linux (ok it is on a server but if a server, which by definition is usually more securised/protected, can be compromised in this way, a home system can be too):

In separate news, it appears that the Archlinux.org server was compromised over the weekend: "Archlinux.org will be down this weekend due to complex server maintenance. Mirrors, including ftp.archlinux.org will remain in operation, as will the AUR. Forums, mailing lists and Wiki will be down as well as the main Arch Linux site. The maintenance is due to an intrusion where an attacker was able to gain root access. The developers have verified that neither the repositories nor the DB were affected, but the machine was compromised, and will need to be cleaned and additional protections added. We're sorry for any inconvenience this has caused."

And thanks to linuxviolin for pointing out the importance of security even when running Linux.

As regards using NoScript, I believe the NoScript documentation indicates that the Java and Java Script options in Firefox preferences should be enabled (checked) in order for NoScript to function properly.

I have had windows crash quite a few times and lost hours of work as a result. This morning I switched over to Linux Mint and am really impressed and appreciative for those who make it possible. I followed your advice, added on no script and add block, I'll get the virus scanner from the software portal so I can try not to infect anyone. I managed to back up my data, but I think the re-occurring problem I had was a result of backing up a virus on the Windows 32 OS. Even when I did a system recovery from the discs Avira immediately detected a virus. When I installed Linux I set it to use all 500GB of my hard drive. I was really concerned that if I copy all my GIMP, Inkscape, Blender, and Reaper files into Linux do I run the risk of it frying my computer again because theres a good chance one of those files has S.A.R.S. or its digital equivalent? I only ask cause I'm sick of re-formatting and loosing half finished projects (I have a lot of brushes, fonts, textures, scripts, midi arrangements, drum, guitar, bass, vocal tracks you know it took a while to get it all). If I partition the drive and order a set of recovery discs from compaq will those files be able to corrupt the windows section again (even if I never open them with windows?) I've decided to make Linux my art computer because all the open source applications I use were super easy to obtain and install, I think the source of my PC issues are corrupt WebCT emails and social networking sites where I can submit my work to the masses (but if you cant get online whats the point lol). One more quick question is Wine an emulator, and does Windows have to be installed for the programs to work correctly, I want to use Reaper, 7 Zip, DVD Fab, VST's with windows .exe. I'll switch forums if I'm in the wrong spot and any direction would be much appreciated. Sorry I'm a roughneck not a computer tech, you guys are awesome.

1. Can an old Windows virus hurt you on Linux? No. A Windows virus is just that, a virus for Windows. Even if the virus somehow made its way into your Linux system, it wouldn't have any adverse effects. You wouldn't even know it was there. The only caveat to this is that you'd have to scan your files before you send them to a Windows system, otherwise it's possible for them to carry the virus with them.

2. Is Wine an emulator and do you need Windows installed for it to work? No and no. WINE actually stands for "Wine is not an emulator" . It doesn't depend on Windows or anything else other than the files that are already installed by default in Mint. But, you'll have to check the Wine website to find out if all of the software you want to run is compatible with Wine.

That was all I was worried about. I'll order a couple compaq recovery discs in the event I ever need to run windows again. With the ability for you to double boot I didn't want to cross contaminate my system, I have a similar one way file transfer system for my laptop which has never been connected to the web. Record, burn cd, upload from this desktop and that is the only way I have kept if from crashing kind of. Windows has been extremely counter productive, between scanning 4 hours a night and it tanking right in the middle of a song or image, I used a lexar jump drive right out of the box, opened up the secure II and it crashed my laptop. I was like son of a princess you have to be kidding me. I went ahead and installed clamav (but I have not been able to find any kind of user interface which is the conundrum of the day) if only to spare die hard windows fans like my brother who is mega gaming supreme cyberdyne systems .011 and its 12 GB of ram. Thank you, I would like the blue pill and will continue lounging in the matrix FYI real quick, all the musicians, check out Linreaper on cuckos forum it will help with instillation immensely, thank you to the linux community I only hope I can help you guys one day.

Probably not related to defragging or antivirus, but would help newbies visualise an image of the structure that windows and linux has. Illustrates the security levels and flaws each could have. Though, it's a little bit biased but in both ways in different parts of the argument.I found this article in the link posted in this thread actually, and got hooked from start to end