|
T.K. posted:So does the old advice about not using backticks and cat if you need to loop through a file still apply? Won't the 2nd example load the whole file into memory at once instead of stepping through it line by line (of course it still processes it by delimiters)? I'm not sure how 'read' is actually handled behind the scenes.
|
# ? Nov 1, 2011 16:24 |
|
|
# ? May 13, 2024 11:48 |
|
So my laptop has started overheating a LOT and Im not sure why. Ive been using ubuntu on it for years and I feel like it didnt start overheating really until I upgraded to 11.04. and even when I installed 10.10 from scratch it still overheats. At first I thought it was just when I had my second monitor plugged in (and then when I was playing flash videos which is what usually shutdown my laptop) but no, it just turned off on me and Im not using it. I used to be able to run TONS of stuff (virtual box, chrome and firefox (with multiple tabs), rails server, gedit, and pandora) but now it seems to overheat ALL THE TIME. Im wondering now if it could be a hardware issue tho. I mean, look art my syslogs code:
|
# ? Nov 1, 2011 16:46 |
|
Open 'er up and see if there is any dust clogging the fans.
|
# ? Nov 1, 2011 16:48 |
|
Longinus00 posted:Won't the 2nd example load the whole file into memory at once instead of stepping through it line by line (of course it still processes it by delimiters)? I'm not sure how 'read' is actually handled behind the scenes. I think the `cat` method will fail on a large file for this reason.
|
# ? Nov 1, 2011 22:41 |
|
Is there a way to disable NetworkManager (Debian) for just one interface? I want to share an internet connection but I don't want to manually configure it every time I join the network (using 2 wifi cards) edit: I think I answered my own question, remove 'auto wlan1' from /etc/network/interfaces Bob Morales fucked around with this message at 00:05 on Nov 2, 2011 |
# ? Nov 2, 2011 00:02 |
|
Ninja Rope posted:I think the `cat` method will fail on a large file for this reason. This should not be a practical concern, cat has no reason to buffer significant amount of the contents on the heap and a sniff test shows different catsusing 4k buffer, 32k buffer, and mmap.
|
# ? Nov 2, 2011 01:58 |
|
spankmeister posted:Open 'er up and see if there is any dust clogging the fans. I cracked it open and air dusted the hell out of the fan but it didnt look like there was much in there. My temperatures SEEM to have gone down tho, however they still seem to spike up a lot.
|
# ? Nov 2, 2011 04:37 |
|
covener posted:This should not be a practical concern, cat has no reason to buffer significant amount of the contents on the heap and a sniff test shows different catsusing 4k buffer, 32k buffer, and mmap. I swear I've broken it reading large files but I don't remember the details of how. Ever since then I've used the read method (or used Perl) instead.
|
# ? Nov 2, 2011 05:15 |
|
Ninja Rope posted:I swear I've broken it reading large files but I don't remember the details of how. Ever since then I've used the read method (or used Perl) instead. You can very easily get a "command line size limit exceeded" error by doing something like 'foo $(cat a_large_file)'. I don't know if for is subject to the same limits, though; since the whole thing is a shell construct, it might optimize $() internally by turning it into a pipe, rather than expanding the whole thing before starting the loop.
|
# ? Nov 2, 2011 05:21 |
|
Ninja Rope posted:I swear I've broken it reading large files but I don't remember the details of how. Ever since then I've used the read method (or used Perl) instead. Could be the scenario described by ToxicFrog's, which makes sense. But Longinus00's "read it into memory" aspect is probably off the mark.
|
# ? Nov 2, 2011 13:52 |
|
ToxicFrog posted:You can very easily get a "command line size limit exceeded" error by doing something like 'foo $(cat a_large_file)'. I don't know if for is subject to the same limits, though; since the whole thing is a shell construct, it might optimize $() internally by turning it into a pipe, rather than expanding the whole thing before starting the loop. You usually end up having to use 'find' or 'xargs' http://en.kioskea.net/faq/1086-unable-to-delete-file-argument-list-too-long ls *.toto | xargs rm find . -type f -name *.toto | xargs rm or find . -name "*.toto" -exec rm {} ; IGNORE THIS AND READ THE NEXT POST Bob Morales fucked around with this message at 16:29 on Nov 2, 2011 |
# ? Nov 2, 2011 14:39 |
|
Bob Morales posted:You usually end up having to use 'find' or 'xargs' 1. 'rm *.toto' and 'ls *.toto | xargs rm' have the same wildcard expansion, the latter is just needlessly convolved. 2. 'find . -type f -name *.toto | xargs rm' needs to properly escape the wildcard, otherwise it won't work right if there's any "*.todo" in the current directory. 3. 'find . -name "*.toto" -exec rm {} ;' works fine, but spawns a separate "rm" process to delete every file, which is a bit suboptimal. The two best solutions which aren't mentioned are: 1. 'find . -name "*.todo" -exec rm {} +' which works like xargs and spawns as few "rm" processes as possible. The "{} +" may be a non-standard extension in GNU find, I'm not sure, but it does work in BusyBox which is about the only other case I care about these days. 2. 'find . -name "*.todo" -print0 | xargs -0 rm' uses nulls as delimeters, so properly handles the utterly-perverse case of file names with newlines (as does the above solution). Edit edit: Better accuracy, more content. ExcessBLarg! fucked around with this message at 16:28 on Nov 2, 2011 |
# ? Nov 2, 2011 16:18 |
|
ExcessBLarg! posted:Bah that link is Sorry, I've seen that problem a hundred times on the web and similar solutions posted, I just didn't check the first link I found. Partly because I don't have a directory with half a million files in it...
|
# ? Nov 2, 2011 16:29 |
|
Maybe with some edits and additions (screenshots, BSD's?) this could go in the OP (or at least in the next Linux thread) Ubuntu Currently what most people think of when you say "Linux", for better or for worse. Estimated at 20 million users, Ubuntu offers easy installation, great hardware support, and the latest in user interfaces. Many users aren't happy about the new interface, however. Alternatives exist if Unity isn't your thing: Kubuntu if you like KDE, Xubuntu for XFCE, and starring LXDE - Lubuntu. Although most popular on the desktop, Ubuntu offers solid server and LTS releases. Website: http://www.ubuntu.com/ Forums: http://ubuntuforums.org/index.php Package Manager: APT Mint Mint is a Ubuntu-based desktop distribution where MP3 codecs, Flash player, and other additions are installed and working out-of-box. They have recently added a Debian-based version. Mint claims to be the second most popular Linux distribution, behind Ubuntu. Website: http://www.linuxmint.com/ Forums: http://forums.linuxmint.com/ Package Manager: APT Fedora Fedora is a Red Hat sponsored community project, as they no longer offer a free version of Red Hat Linux. A new version is released every 6 months, and versions are abandoned every 13 months. In order to use non-free software with Fedora (such as MP3 codecs or Adobe Flash), users must add 3rd party repositories such as RPM Fusion. Fedora is the third-most popular Linux distribution Website: http://fedoraproject.org/ Forums: http://forums.fedoraforum.org/ Package Manager: RPM Debian Debian is one of the oldest Linux distributions. Focused on security and stability, Debian offers three releases: stable, unstable, and testing. Often criticized for using old or even obsolete packages in the stable release, the unstable and testing releases are often found in eveyrday use. Debian boasts over 30,000 software packages and the entire distribution spans over 30 CD-ROMs (or a handful of DVDs), although you only need the first one to install a usable system. A true 'free' OS, you won't find built-in support for things like playing DVDs, MP3 or Flash support. You also won't find firmware for hardware like certain wireless cards, but those are easily downloadable from Debian's non-free repositories. Applications such as Firefox are even re-branded as 'Iceweasel', because of copyright and trademark issues. Website: http://www.debian.org/ Forums: http://forums.debian.net/ Package Manager: APT OpenSUSE OpenSUSE started in Germany and is still mainly developed in Europe. They were acquired by Novell but released back to the community. It contains a unique administration tool named 'YaST'. Website: http://www.opensuse.org/ Forums: http://forums.opensuse.org/ Package Manager: RPM Arch Currently developing a large and dedicated following, Arch Linux defines itself as a 'simple, lightweight distribution'. Arch gets back to the core of Linux and prides itself in high-quality documentation. Arch uses the 'Pacman' package management system and a rolling-release system. Website: http://www.archlinux.org/ Forums: https://bbs.archlinux.org/ Package Manager: Pacman CentOS CentOS is a free re-packaging of Red Hat Enterprise Linux. Very popular in production use with servers on the Internet. Website: http://www.centos.org/ Forums: http://www.centos.org/modules/newbb/ Package Manager: RPM Slackware Another of the 'classic' Linux distributions, Slackware is a simpler distribution that sticks to the basics of UNIX. It has fallen behind newer distributions over the past ten years. Website: http://www.slackware.org/ Forums: http://www.linuxquestions.org/questions/forumdisplay.php?forumid=14 Package Manager: PKG Gentoo Gentoo was made by a bunch of crazy bastards who though compiling your entire sytem (takes 2 days if you want KDE and OpenOffice) when you install. I'm not sure who uses it anymore but if you want to play around with it, go right ahead. It can be an educational experience. It's also a rolling-release system. Website: http://www..gentoo.org/ Forums: http://forums.gentoo.org/ Package Manager: Portage FreeBSD The most popular of the BSD's, you can find FreeBSD at hosting providers (originally running sites such as Hotmail and Yahoo!) as well as the desktop. It forms the basis of projects such as m0n0wall, pfSense, and FreeNAS. Website: http://www.freebsd.org/ Forums: http://forums.freebsd.org/ Package Manager: ports/PKG OpenBSD OpenBSD's main goals are security, adhering to the BSD license, and documentation. The project is lead by the controversial Theo de Raadt. The website once bragged about having "only one remote exploit in nearly 6 years!" OpenBSD is found as the base of many networking systems such as firwealls, routers, and VPN systems. Website: http://www.openbsd.org/ Forums: http://openbsd.org/mail.html Package Manager: ports NetBSD The least popular of the big-three BSD's, NetBSD is focused on portability. "Of course it runs NetBSD" is the project's motto. Nearly 60 hardware platforms are supported. is Theo de Raadt left NetBSD in 1994 to start OpenBSD. Website: http://www.netbsd.org/ Forums: http://www.netbsd.org/community/ Package Manager: pkgsrc Bob Morales fucked around with this message at 18:47 on Nov 2, 2011 |
# ? Nov 2, 2011 16:31 |
|
Might be worth mentioning Debian is the upstream provider of Ubuntu, (and mint for that matter) edit: derp spankmeister fucked around with this message at 16:49 on Nov 2, 2011 |
# ? Nov 2, 2011 16:33 |
|
Not a bad idea Bob Morales, though I think screenshots might be overkill. I think there's also a separate thread for BSD-discussion somewhere in the forums already, and I don't think it'd be a good idea to have that under the same thread anyhow.
|
# ? Nov 2, 2011 16:41 |
|
ExcessBLarg! posted:Bah that link is ExcessBLarg! posted:2. 'find . -name "*.todo" -print0 | xargs -0 rm' uses nulls as delimeters, so properly handles the utterly-perverse case of file names with newlines (as does the above solution). quote:This manual page documents the GNU version of xargs. xargs reads items find ... -exec ... + is definitely the cleanest solution, but it's worth noting that xargs also has a -P option for parallelizing that might significantly speed up what you're trying to do (obviously rm is a terrible example). Vulture Culture fucked around with this message at 16:48 on Nov 2, 2011 |
# ? Nov 2, 2011 16:42 |
|
Zom Aur posted:Not a bad idea Bob Morales, though I think screenshots might be overkill. I think there's also a separate thread for BSD-discussion somewhere in the forums already, and I don't think it'd be a good idea to have that under the same thread anyhow. I don't see why we don't combine them, most of the questions are about cross-platform packages or shell coding. I'll make some effortposts later tonight in here too, then we can decide what should go in the next megathread and ask for mod approval.
|
# ? Nov 2, 2011 17:41 |
|
Might want to mention Funtoo Linux in the gentoo blurb, it is a fork by Daniel Robbins, the guy who started gentoo. P.S. it doesn't take days to compile kde etc if you run the compile in tmpfs (ramdisk)
taqueso fucked around with this message at 18:00 on Nov 2, 2011 |
# ? Nov 2, 2011 17:57 |
|
Misogynist posted:The xargs example will likely try to delete all files with names that match those inside any directory named *.toto, which is probably really far away from the right behavior. Misogynist posted:I think you read the same bad information on Wikipedia that I just did -- you don't just have to worry about newlines, because xargs will break arguments on any whitespace by default. I had been assuming the behavior of xargs was to split on newlines for years. I use it rather sparingly but, sigh.
|
# ? Nov 2, 2011 21:20 |
|
So installing ubuntu server on that computer worked great. I'm surprised it went so smoothly. Anyways I just wanted to update you guys with a picture of how the screen looks.
|
# ? Nov 2, 2011 21:33 |
|
MEAT TREAT posted:So installing ubuntu server on that computer worked great. I'm surprised it went so smoothly. Anyways I just wanted to update you guys with a picture of how the screen looks. Remove the NVIDIA (nouveau) drivers, why would you install them on a server anyway? If they automatically installed, try removing or upgrading them. You may be able to pass some sort of command-line option at boot to use VESA graphics and have it work normal but you won't get fancy graphics.
|
# ? Nov 2, 2011 21:41 |
|
MEAT TREAT posted:So installing ubuntu server on that computer worked great. I'm surprised it went so smoothly. Anyways I just wanted to update you guys with a picture of how the screen looks. Didn't you say the screen was messed up in windows? It's probably a hardware fault and I recommend closing the lid and never opening it up again.
|
# ? Nov 2, 2011 22:08 |
|
start it up with nomodeset kernel option, then it will run in ye olde vga.
|
# ? Nov 2, 2011 22:39 |
|
Longinus00 posted:Didn't you say the screen was messed up in windows? It's probably a hardware fault and I recommend closing the lid and never opening it up again. No, read my post again. The screen looks like that as soon as it POSTS. It is a hardware fault, I burned out the video card playing WoW back when I was still in uni. I've had it sitting in my closet for almost 2 and a half years. When my wife saw last week she said I could either fix it or throw it out. It's just that it's completely unusable in Windows, so I figured I could make it into a headless Linux server. At least in Linux I can sorta make out the words in the console, despite the terrible color. But all of that doesn't matter since I just SSH into it from my PC. I won't be using it as a laptop anymore, it's just going to sit under my router for now. I'll try the kernel VESA options and see if it helps, but I doubt it will since it's like that even in the BIOS. Janitor Prime fucked around with this message at 22:57 on Nov 2, 2011 |
# ? Nov 2, 2011 22:55 |
|
MEAT TREAT posted:I'll try the kernel VESA options and see if it helps, but I doubt it will since it's like that even in the BIOS. The old vga=xxx modes are deprecated. Your best use is nomodeset, which runs it in pure text mode. But yeah if even your bios is hosed then there is not really anything you can do. (badram patch for vga? )
|
# ? Nov 2, 2011 23:16 |
|
I thought this a photoshops. Haynes, the people who make chintzy automotive repair manuals, wrote a Linux book. http://www.amazon.com/exec/obidos/ASIN/1844259706/distrowatch-20
|
# ? Nov 5, 2011 16:41 |
|
Bob Morales posted:I thought this a photoshops. Haynes, the people who make chintzy automotive repair manuals, wrote a Linux book. Hah! I got a good laugh out of that.
|
# ? Nov 5, 2011 18:06 |
|
I have a large file (an XML document) and I want to remove a multiline string that is somewhere near the end of the file. How can I do this using sed that is faster than what I'm currently using:code:
|
# ? Nov 5, 2011 20:16 |
|
I just typed crontab -r instead of -e Hope there wasn't anything important in there.
|
# ? Nov 5, 2011 20:30 |
|
spankmeister posted:I just typed crontab -r instead of -e I did that once on a server that generated reports and emailed them from cron. Why are those two keys next to each other?
|
# ? Nov 6, 2011 18:48 |
|
Just put a backup script in your crontab! (or have it be a symlink to a vcs version)
|
# ? Nov 6, 2011 22:37 |
|
Please let me know if there's a good reason not to have /etc backed by a Git repository, because I do it everywhere. I keep meaning to try out etckeeper, which does the same thing in the same way but also hooks into apt/yum/whatever. Plan Git hasn't been a problem for me; I occasionally have commits like "this is apparently what the package manager changed".
|
# ? Nov 6, 2011 23:53 |
|
Lysidas posted:Please let me know if there's a good reason not to have /etc backed by a Git repository, because I do it everywhere. That doesn't mean you don't need to backup, but you might want to keep it in mind when restoring stuff.
|
# ? Nov 7, 2011 00:02 |
|
git doesn't store permissions, which is problematic for things like /etc/shadow. etckeeper does, though.
|
# ? Nov 7, 2011 00:04 |
|
pseudorandom name posted:git doesn't store permissions, which is problematic for things like /etc/shadow. etckeeper does, though.
|
# ? Nov 7, 2011 05:28 |
|
My crusty old UNIX-admin colleague uses RCS for that purpose, but git is fine too.
|
# ? Nov 7, 2011 09:01 |
|
Misogynist posted:etckeeper is just a shim around metastore, which is the piece that does all the actual lifting. There are some annoying caveats. It actually doesn't anymore.
|
# ? Nov 7, 2011 16:04 |
|
pseudorandom name posted:It actually doesn't anymore.
|
# ? Nov 7, 2011 16:16 |
|
|
# ? May 13, 2024 11:48 |
|
Lysidas posted:Please let me know if there's a good reason not to have /etc backed by a Git repository, because I do it everywhere. If you don't mind, why are you doing this? Quick and dirty backup solution for nodes that hold no data? I'm used to good old daily full/incremental via backup software so I'm curious what you're up to here.
|
# ? Nov 8, 2011 00:50 |