[131003460010] |Grub location - did it go to the mbr or elsewhere? [131003460020] |I have a dual boot setup with linux and Windows 7 with Grub as the bootloader. [131003460030] |My partition table looks like this: [131003460040] |I'm curious where GRUB installed itself after I had this setup right here. [131003460050] |I thought the System Reserved partition was Windows 7's booting partition, but if Grub rewrote over it (I assume on the master boot record), it seems like Windows 7 would not be able to run. [131003460060] |Where does Grub install itself and still manage to point to both Windows and linux? [131003460070] |Does it depend on how you set your partitions? [131003470010] |Grub will install itself to the master boot record of your drive. [131003470020] |It's important to realize that the master boot record is the first sector of your partitioned drive, and not a partition itself. [131003470030] |See Wikipedia for more information [131003470040] |Given this information, basically Grub will overwrite the MBR information that Windows 7 installed, but it won't touch the "System Reserved Partition" that Windows 7 creates (unless you ask it to). [131003470050] |The new MBR will simply tell your system to load GRUB, and then GRUB will ensure that the proper OS is loaded. [131003470060] |This makes it easy for you to switch between operating systems. [131003480010] |When Windows installs itself, it puts a bootloader (NTLDR in NT through XP; winboot after that) in the master boot record that reads boot.ini to show you the boot list. [131003480020] |Once you pick something from that list, the bootloader's job is done, and the appropriate kernel is started from an actual partition on your drive. [131003480030] |Grub does the same thing; the bootloader is only there to show the grub.conf/menu.lst list, and once you've picked something it transfers control to a regular partition. [131003480040] |Thus grub will overwrite the NTLDR/winboot in the MBR, but not anything in a normal partition, and it knows how to transfer control to a Windows partition if you choose Windows from the boot list [131003490010] |The only time I'd install GRUB to someplace that isn't the MBR is when on a Mac - the whole dual-booting question gets rather more complex there. [131003490020] |In the general case, GRUB will be installed to the MBR, overwriting NTLDR, and allowing you to boot Linux or Windows. [131003500010] |There are some confusing stuff here. [131003500020] |First of all you need to know that there is a "Partition Boot Record" in each slice when disk is partitioned (slice=primary partition). [131003500030] |When you format your disk, the first sector is called "bootsector". [131003500040] |The bootsector is loaded and executed from the partition flagged as bootable. [131003500050] |GRUB has just 512 bytes in this area, and it's called stage1. [131003500060] |Stage 1 just loads stage2 (or1.5), and this is the file that loads the menu.lst file and other modules. [131003500070] |Since Stage1.5 (or Stage2) loads menu.lst from a little amount of code, its filesystem-specific (need to be able to find /boot/menu.lst in your FS). [131003500080] |Take a look here to read more. [131003500090] |In a nutshell: Stage1 is in MBR, but GRUB isn't just stage1, everything but Stage1 is in /boot. [131003510010] |Explain to a Linux user how do BSD/OSX drivers work [131003510020] |Linux drivers come in a form of kernel modules (*.ko files), which can be given parameters when loaded into the kernel and usually live in /lib/modules/. [131003510030] |What's the similar arrangement for BSD/OSX? [131003510040] |For example, I've just installed MacFUSE and have hard time understanding what exactly did the installer put into my system. [131003520010] |I'm not sure about other BSD, but OSX have kernel extensions (known as kext). [131003520020] |Kexts live in /System/Library/Extensions/. [131003520030] |Each of them is a folder, containing device description and instruction (those that makes a driver). [131003520040] |Things in a kext need suitable file permissions (generally belong to user 0:0 with mask 755) for it to work. [131003520050] |After a kext is in place, the OS will automatically load it on reboot (although sometimes instantly). [131003520060] |Occasionally you need to clear the kext cache (rm -r /System/Library/Extensions/Caches/) before the new kext will work correctly. [131003530010] |How do I see more of the command line with the KDE System Guard Process Table [131003530020] |I often have several java programs running and I can't tell which one needs to be killed. [131003530030] |The command section of the process table only shows java, but doesn't tell me which jar or class files it is running. [131003530040] |Edit: Is there a way to see more of the command call from withing KSysGuard? [131003540010] |
  • ps aux | grep java
  • [131003540020] |
  • You look for the Process ID(PID) of the process you want and then you use kill command (for how to use kill read my post here)
  • [131003540030] |Also read: here and here and here [131003540040] |An alternative: ps -fp $(pgrep -d, -x java) or you might use htop or top and search for java [131003550010] |You want the wide output option "w". [131003550020] |Using it three times will allow unlimited width. [131003550030] |ps auxwww [131003560010] |A GUI alternative to Ksysguard is qps. [131003560020] |It's perhaps less visually appealing that ksysguard, but it shows a lot more information, including the whole command line. [131003570010] |Installing Grub (2) on a USB flash drive [131003570020] |MultiBootISOs is a tool that let you install Grub on a USB flash drive. [131003570030] |I really like it because it lets me boot from ISO files and let me put a bunch of ISOs on my USB and choose which one to boot. [131003570040] |The problem is, this is a Windows tool, and I don't know how to do it through the command lines. [131003570050] |I would also like to know how to install Grub (2) this way, Grub Legacy seems to be easier... [131003570060] |EDIT: I'm not asking for a tool (and definitely not a Windows tool). [131003570070] |I want to know the commands that I have to execute to have the same effects. [131003570080] |I'm having Ubuntu in my mind right now, but if there is a general way that I can boot any ISO in the USB then that would be better. [131003580010] |GRUB2 Bootloader Full tutorial is a good place to start on multi boot configurations with GRUB2. [131003580020] |If you are familiar with GRUB, jump straight to the 5th or 6th section. [131003580030] |There is also a Superuser question on Setting up a multiboot system with GRUB. [131003580040] |There is also a Ubuntu MultiOSBoot community page which suggests you should stick to the Legacy GRUB. [131003580050] |The technique works on flash drives too as long as your machine can boot from them. [131003580060] |I have been working off flash drives for some time now. [131003590010] |You got me curious how this would be done. [131003590020] |The Pendrivelinux site had a tutorial I did this from my Mint 9 install instead of a live cd as the site suggests. [131003590030] |I started with finding the location of my USB drive in a terminal I ran df it returned the location of the device as [131003590040] |after that I ran [131003590050] |and then to install grub 2 [131003590060] |I had to use --force additionally, the example on the site did not. [131003590070] |Then I did [131003590080] |The site gave a link to download a copy of grub.cfg to the /boot/grub directory on my USB drive. [131003590090] |The link was [131003590100] |After that I edited grub.cfg to reflect the iso's on my USB drive. [131003590110] |I found that in the different iso's, vmlinuz and initrd were located in a different directory. [131003590120] |I was able to get all three to start the boot process; but, only Ubuntu to actually load. [131003590130] |If I figure out what I need to get the other two to finish loading, I will add that later. [131003590140] |I have not tried any other iso's just these three. [131003600010] |OpenSuse custom keyboard shortcuts not working [131003600020] |Note: This question is specifically on a clean install of OpenSuse 11.3 with gnome as the display/desktop manager [131003600030] |I can't get custom keyboard shortcuts to work, default shortcuts are working properly, but the ones I changed I can only get one of them to work, I'm using the "windows key" to match functionality of Windows 7 for a few keys like maximize window (winkey+up), minimize window (winkey+down), etc; none of them work; for the record I did the exact same thing in Ubuntu and it worked without any problems. [131003600040] |additional info: I also noticed that gnome-do by default uses a key that I had assigned (winkey+space) and it "wins" (runs gnome-do) over the custom global key I had assigned (show main menu), actually, I can change the key in gnome-do to another that I have in the keyboard shortcuts, and the gnome-do works; this just makes me wonder if there are other applications that are disabling the usage of the "winkey" [131003600050] |update: I also tried using gconf-editor apps/metacity, adding the keys there, still no luck, I tried Windows, Super, Mod4 for the WinKey name, none worked [131003600060] |In some apps it seems the WinKey is completely ignored, i.e. it performs the action associated to the key without the WinKey, though, like I said before, there's one or two custom WinKey+SomeKey that ARE working (changed them to something else, stopped working, changed it back, worked again) [131003600070] |Found this article from 2006 that sounds very much like the problem I'm having, though I followed the steps to fix it but didn't work for me [131003600080] |There seems to be a bug in Gnome / Metacity / X somewhere that means you can't use SUPER_L or SUPER_R (the left and right windows keys on a keyboard) with gnome system commands such as "Lock Screen". [131003600090] |another thread of the same issue I'm having [131003600100] |I've been reading linux forums, it seems this might a be a bug on recent OpenSuse releases: [131003600110] |Many actions do not work with shortcuts in 11.3 [131003600120] |Changing the Keyboard shortcuts in System->personal->Keyboard Shortcuts does not seem to be working. [131003600130] |and several others [131003610010] |Just found an answer, or at least a temporary fix to my problem; you can consider me a Linux n00b, so I'm not familiarized yet with the terms and subsystems available or how to tell what I'm actually running. [131003610020] |simple answer: Disable desktop effects [131003610030] |Long answer: I didn't even know compiz was my window manager!, I thought it was "gnome", somewhere in the configuration I saw "gnome-wm" listed as the "window manager", but I just found out that this is just a script to load the actual window manager [131003610040] |There's also an environment variable WINDOWMANAGER=/usr/bin/gnome [131003610050] |so I guess this raises more questions for me, how do I know which display/desktop manager, window manager, is actually active? well I actually know the display manager is gnome, because that was part of the installation [131003610060] |anyway, for anyone else having the same problem, open up the control center, go to "look and feel", select "Desktop effects" and uncheck the box "enable desktop effects" [131003610070] |a quicker way to get to the same dialog is to run the command simple-ccsm (from the run application dialog, gnome-do, or the terminal). [131003610080] |now, that (I think) I know that I have compiz as my window manager, I also tried going into the gconf-editor/apps/compiz/general/allscreens/options and set my shortcuts there, but that didn't work (did try logging out and back in again) [131003620010] |You do not have to disable Compiz completely. [131003620020] |I had the same issue, but it affected specifically the "Run Application Dialog" and "Open Main Menu". [131003620030] |The problem is that Compiz Fusion takes control over some keyboard shotcuts to keep compatibility. [131003620040] |This can be configured through the Compiz plugin "Gnome Compatibility" and other areas of the Compiz Panel. [131003630010] |Does cut support non-white-space to white-space delimeters? [131003630020] |The default delimiter in awk is white-space to non-whitespace change. [131003630030] |The default for cut is the tab character. [131003630040] |Can I tell cut to use non-white-space to white space delimters? [131003630050] |E.g. [131003630060] |a: [131003630070] |prints just a space, but should print bar. [131003630080] |print bar. [131003630090] |Sure, often you can just use awk as a cut replacement if you need that semantics. [131003630100] |But cut has the advantage that it is very memory efficient. [131003630110] |Especially it does not load unused columns into memory (unlike some awks). [131003640010] |I don't see how to make cut(1) do what you want. [131003640020] |I believe you are correct in believing that if you have mixed whitespace delimiters that the best alternative is awk(1). [131003650010] |You could preprocess your data with something like tr -s ' ' '\t'. [131003650020] |But you wouldn't get any benefit unless your lines were very long. [131003650030] |(How long? measure and find out.) [131003660010] |The future of OpenSolaris [131003660020] |Hi, since OpenSolaris is more or less abandoned by Oracle, is there a nice alternative that implements the unique features of OSOL? [131003660030] |ZFS is one thing, but I liked the image creation system, that let you create images of a master system and then distribute it quickly to other computers. [131003660040] |This was an effort to simplify creation of clusters. [131003660050] |According to the Wikipedia page of OSOL, there's Illumos, which is a fork of OSOL, with all closed source parts replaced by open source parts. [131003660060] |Illumos is in active development. [131003660070] |But is Illumos an alternative to OSOL, with all it's features? [131003660080] |Is anyone using it and could tell us his or hers experiences? [131003670010] |Illumos is not a full replacement to OSOL and I don't think it will be in the future since it's intended to be a base from which others can build a distribution. [131003670020] |But check the Nexenta OS, this system is heavily based on OSOL and they are one of the main sponsors behind the Illumos project. [131003670030] |Although I haven't used it personally and I wouldn't know whether it has what you need. [131003680010] |The folks who've done a lot of dev for opensolaris have pretty much all joined the OpenIndiana bandwagon. [131003680020] |You can find more information at http://www.openindiana.org. [131003690010] |How can i know which unistd.h file is loaded? [131003690020] |I have several unistd.h files in my Ubuntu Linux. [131003690030] |I've one on: /usr/include/asm/unistd.h This file has this directives: [131003690040] |In that folder, i can find those files (unistd_32.h and unistd_64.h). [131003690050] |But in /usr/src/linux-headers-2.6.31-22/include/asm-generic/ there's another unistd.h that starts with this directives: [131003690060] |So, the question is: How can i know, which one is loaded? [131003690070] |Is there any way to check it in runtime with Java? [131003690080] |Thanks! [131003700010] |The exact rules followed by the gcc compiler for finding include files are explained at: http://gcc.gnu.org/onlinedocs/cpp/Search-Path.html [131003700020] |A quick command-line trick to find out where an include file comes from is the following:1 [131003700030] |Then, if you look at the unistd.preprocessed file, yo*emphasized text*u will notice lines like: [131003700040] |These tell you that the following block of lines (until the next # number ... line) come from file /usr/include/unistd.h. [131003700050] |So, if you want to know the full list of files included, you can grep for the # number lines: [131003700060] |On my Ubuntu 10.04 / gcc 4.4.3 system, this produces: [131003700070] |1 Note: The search path for include files is modified by the -I command-line option; so, you should add any -I path arguments to the gcc invocation. [131003700080] |Also, if you are compiling a C++ source, you should substitute -x c with -x c++. [131003710010] |Does installing and using Wine open up your Linux platform to windows virus'? [131003710020] |Just wondering if installing wine might open up a fairly solid linux desktop to the world of windows virus'. [131003710030] |Any confirmed reports about that? [131003710040] |Would you then install a windows antivirus product under wine? [131003720010] |Yes and no. [131003720020] |Virus/trojans are just programs, and will work on wine... [131003720030] |Also, your normally Linux fs is exposed to wine with the user that launchs wine credentials. [131003720040] |BUT, usually virus are based on lots of hacks, and they expect a "standard" and common windows installation. [131003720050] |I doubt that any virus is coded thinking that it will be executed on wine, and if it exists, probably it will not be too success. [131003720060] |Why? because wine users are a small portion of normal users, they have "weird" and strange installation (think in all flavours of linux+wine), usually are avanced users and an they have a strong comunity aware of security. [131003720070] |So: yes, you are exposed to windows viruses, but not totally exposed, and most probably your linux installation will not be contamined. [131003720080] |Just be carefull as you are on windows. [131003720090] |On the other hand, you can use several techniques to increase the security: use chrooted wine (search google for chroot), virtualized environments, etc... [131003730010] |I've heard of people getting viruses in Wine. [131003730020] |This link tells a story of someone who had a virus in Wine. [131003730030] |A Virus is a program like most others. [131003730040] |Depending on the virus it may or may not try to exploit a vulnerability in the system; it may just propagate by sending email or writing itself to disks somewhere. [131003740010] |There is an old Linux.com article, in which trying to infect a Linux install with Wine is actually tested. [131003740020] |If you are of the TL;DNR type: it doesn't work. [131003740030] |You are fine without antivirus. [131003750010] |Yes and no. [131003750020] |Some viruses will work on wine particulary those which uses programs security bugs you are running under wine (wine running old version of adobe flash will not automagically protect you from exploiting it). [131003750030] |Also the Linux FS is exposed in default configuration. [131003750040] |On the other hand viruses may depend on particular configuration and if it tries to exploit Windows kernel - it is bad day for him. [131003750050] |Also emulating IE by gecko may not be helpful for exploits. [131003750060] |At the end - the fact that virus have affected wine does not mean it gain access to all files. [131003750070] |It usually is not aware that Z: is director where you keep your files so it may simply ignore it. [131003750080] |Deleting virus may be as simple as removing ~/.wine and it will not delete most of your settings. [131003760010] |Malware has been known to work via wine... but from memory it has mostly been limited to what you mount in wine, and is not capable of working once wine is off. [131003760020] |Whatever you do, do not mount / in wine. [131003760030] |Anything you mount could get infected, so I recommended mounting as little as possible, lest your mp3's become viral. [131003770010] |When do su and sudo use different passwords? [131003770020] |I am able to run anything using sudo; my password is accepted. [131003770030] |But whenever I try to do su from a shell, it fails with: [131003770040] |su: incorrect password [131003770050] |What can the problem be? [131003780010] |su means substitude user and if its called without any arguments you will become the superuser. [131003780020] |Therefore you have to enter the users password. [131003780030] |This is some kind of unhandy if many people need to use commands for the system administration or similar stuff with extended user rights. [131003780040] |You just don't wan't that people have unlimited rights by sharing all the same root password. [131003780050] |The solution for this kind of problems is sudo ("substitude user do"). [131003780060] |This will allow you to specifiy the commands someone can invoke and define the permissions. [131003780070] |For sudo you don't have to enter the root password, but the password of the user who tries to invoke a sudo command. [131003780080] |Some distributions have the root user disabled for security reasons. [131003780090] |This could be one explanation why you aren't able to use su. [131003780100] |You could try to skip the password by using sudo: sudo su ;-) [131003790010] |The su command without options, will default to allow you to become the root user. [131003790020] |It isn't asking for your password, but the root password. [131003790030] |The sudo command always asks for your password. [131003800010] |vcenter server on Linux? [131003800020] |Hi, i am working with vmware and preparing a vcenter server on windows server, but i will like to know, how good is vcenter in linux, anyone have tried? [131003800030] |i will like to work with ubuntu server, or what do you suggest me? [131003800040] |Thanks in advance and sorry for my bad english. [131003810010] |VMWare is generally supported in linux, however if all your guests are linux, I'd recommend LXC. [131003820010] |Carry-on Ubuntu Customization [131003820020] |Hello. [131003820030] |Like most of us, I have several machines: at home, at work, for travelling... etc. [131003820040] |I mainly write papers or books while I code. [131003820050] |But I'm tired of svn'ing, rsync'ing and so on, so I've decided to carry a pendrive with me, with my Ubuntu customizations (bash, emacs, ...) and at the end of the day, do a rsnapshot. [131003820060] |My question is: how do I minimally run my home directory from a pendrive? [131003820070] |What should I put in there? [131003820080] |Thanks for any input. [131003830010] |The answer is pretty simple :-) You should put in there your documents you are working on and the dotfiles of the applications you use. [131003830020] |Theres no such thing like a minimal set of files you need. [131003830030] |If an application is missing its configuration file, it will usually create a new one like at the first start. [131003830040] |Which files you will need depends on the applications you use, so you are the only one who can answer this. [131003830050] |If you are unable to trace some config files, keep an eye on the subdirectories of ~/.gnome2 or ~/.kde. [131003830060] |To tell the system, where the location of your new home directory is, you should just automount your pendrive to /home/username or simply change the location of your users home directory in /etc/passwd to your pendrives mountpoint. [131003830070] |If this doesn't fit your question, please be more specific. :-) [131003840010] |Have you considered using Ubuntu One to synchronize your stuff? [131003840020] |I'd be afraid to keep my home directory on a single pendrive, I've lost too many of those. [131003850010] |Get list of required libraries when installing something from source [131003850020] |When installing something from source (say, Ruby 1.9.2), what command can I run to get a complete list of all the dependencies needed to install that application? [131003850030] |Is this possible? [131003860010] |Short answer: not possible. [131003860020] |The difficulty of getting the exact dependencies from a source distribution is the reason why package management is so popular on Linux (okay, one of several reasons). [131003860030] |In fact, if you just need to get it done and don't care so much how, the most reliable way to get the dependencies will probably be to grab a distro package (gentoo ebuilds are easy to work with) and pull the list of dependencies from that. [131003860040] |Otherwise, if you're lucky, the maintainers will have created a listing of the dependencies in the README file or similar - that'd be the first place to check. [131003860050] |Failing that, if it's a C project and you don't mind getting your hands dirty, you can look inside the configure script (or better yet the configure.ac or whatever it's generated from) and figure out the dependencies from that based on what it checks. [131003870010] |In Ubuntu (Debian): sudo apt-get build-dep [131003880010] |Processor use and core use. [131003880020] |I want to play around with threading and parallelism. [131003880030] |I know my processor has multiple cores, but do not know how to see what is happening on each of them. [131003880040] |What is the right way to access this information? [131003880050] |More concretely, I am planning the following: I imagine writing a little program that launches several threads, these threads should then be spread over the cores and communicate with each other where needed. [131003880060] |I would like to be able to observe where which thread is running, any hints? [131003880070] |I am completely new to trying this kind of thing (I would also be quite happy with any information related to this that does not directly address this question). [131003880080] |Best, Bart [131003880090] |(googling only got me to "cat /proc/cpuinfo", which seems to tell me I have 7 processors. [131003880100] |This is not a true fact, which tells me I do not know how to read this output.) [131003890010] |Each core gets its own entry in /proc/cpuinfo, so there is a lot of redundant information here. [131003890020] |To get an overview of how many cpus and/or cores you have, do something like this: [131003890030] |This is run on my single-chip, dual-core computer. [131003890040] |So I have two cores, numbered 0 and 1, but both of them belong to the physical cpu 0. [131003890050] |Computer guys like to count from 0, remember. [131003890060] |Here's the output from a dual-cpu, single-core system: [131003890070] |So I have two CPUs, but since no cores are specified I know that each processor chip has a single core. [131003890080] |Something a bit more interesting: [131003890090] |Here's my dual-cpu dual-core system. [131003890100] |I have "processors" 0-3, and each lives on processor 0 or 1, as core 0 or 1. [131003890110] |You get the idea. [131003890120] |All that said, I suspect you have a dual-cpu quad-core system, with processors 0 through 7. [131003900010] |Number of processors: Please note that numbering starts from 0 so if I have processor 1 I have at least 2 of them [131003900020] |Bounding to threads Threads will not be bound to CPU's (unless you do tricks by using cpulimit &co. - in most cases you shouldn't). [131003900030] |Assuming that you have configured kernel with 1000Hz and there is no I/O the context switch is done 1000 times per second. [131003900040] |Now in my 2 Processors setup I have around 300 threads running at this moment which means that 6.(6) slots will be allocated per process. [131003900050] |It is safe to assume that in any second each process will occupy the both core. [131003900060] |Given - the staircase algorithms, I/O make it not necessary true but each thread at one second may be on both cores - as well as running nowhere as it is waiting (so it is not bounded to any core). [131003900070] |Hyperthreading I guess that you have 4 core Intel iX with hyperthreading (unless you have dual processor machine). [131003900080] |Hyperthreading works by emulating a separate core. [131003900090] |So if process is waiting on one core for I/O it can switch to executing another - which of course complicate matter further. [131003910010] |unable to change window name openbox [131003910020] |I am using openbox and usually, I have a lot of windows on the screen. [131003910030] |One window for the browser and a couple of windows to run a few terminals. [131003910040] |The problem is that, when they are minimized, I am not able to figure out what I was doing in which terminal and having to open each terminal to check and see what I was doing is too cumbersome and time consuming. [131003910050] |Not to mention, it also disrupts the flow of work. [131003910060] |I mostly spend my time programming. [131003910070] |So I thought, it would make sense to change the name of the window in the title bar so that I can see what I was doing in it even when it is minimized. [131003910080] |But unfortunately, openbox does not provide an option to change the name in the title bar of the window or maybe it does and I don't know. [131003910090] |I've googled and I couldn't find anything that could help me. [131003910100] |I would like to know if there is a way to change the title of a window in its title bar so that I can see what I was doing in it, even when it is minimized. [131003910110] |Thank you. [131003920010] |You can tell xterm to change its Window title using escape sequences. [131003920020] |At least with Gnome, this is also reflected in the task bar. Issuing the command [131003920030] |at the command prompt e.g. sets the title to user name and hostname. [131003920040] |Of course you can put between "\033]0;" and "\007" any static strings, command output or environment variables you want. [131003920050] |See the xterm title faq for more details and ideas. [131003920060] |This not only works for xterms but for many modern terminal emulators. [131003930010] |Are there any differences between mounting a /proc filesystem inside a chroot compared to mounting it from the outside? [131003930020] |Compare the following: [131003930030] |and: [131003940010] |There are no differences with respect to the underlying kernel state. [131003940020] |There is a minor difference with respect to the operation of the mount command: it keeps track of its actions in /etc/mtab, so running mount under chroot will update a different mtab file. [131003940030] |You could also use mount --bind /proc ./my_chroot/proc. [131003940040] |As far as I know, there is no practical difference between that and mount -t none proc ./mychroot/proc: you can mount the proc filesystem as many times as you like, and mount options are ignored. mount --bind will prevent you from unmounting the filesystem on /proc outside the chroot, but that should never happen anyway. [131003940050] |As an aside, I would recommend mount -r proc proc …/proc because seeing proc in the device field in a mtab or in /proc/mounts is clearer than seeing none. [131003950010] |How can I close a terminal without killing the command running in it? [131003950020] |Sometimes I want to start a process and forget about it. [131003950030] |If I start it from the command line, like this: [131003950040] |I can't close the terminal, or it will kill the process. [131003950050] |Can I run a command in such a way that I can close the terminal without killing the process? [131003960010] |do [131003960020] |and it will run in the background [131003960030] |do [131003960040] |to bring the redshift process back to the foreground [131003960050] |Further reading (googled 'man fg'): http://www2.research.att.com/~gsf/man/man1/fg.html [131003970010] |One of the following 2 should work: [131003970020] |or [131003970030] |See the following for a bit more information on how this works: [131003970040] |
  • man nohup
  • [131003970050] |
  • help disown
  • [131003970060] |
  • Difference between nohup, disown and [131003980010] |If your program is already running you can pause it with Ctrl-Z, pull it into the background with bg and then disown it, like this: [131003990010] |Switch display output without rebooting but not in Xorg [131003990020] |My graphic card has two output (VGA and DVI). [131003990030] |Is it possible to switch from one to the other without rebooting ? [131003990040] |It works in Xorg by restarting the X server (I guess it should be doable with xrandr too) but I'd like to do it in the linux console. [131003990050] |I have looked at vbetool but I am not sure it is the right way (the commands I tried did not work anyway). [131003990060] |I have a nvidia card. [131004000010] |I can't try it right know, but I found this answer to your question: fbgetty /dev/tty8 /dev/fb0 fbgetty /dev/tty9 /dev/fb1 [131004000020] |Where: [131004000030] |- /dev/tty8/9/n are the terminals you want to move [131004000040] |- /dev/fb0/1/v are the framebuffer devices you want to use ... it should switch between your outputs [131004000050] |Solution is taken from this forum thread: http://www.linuxforums.org/forum/debian-linux/96430-move-tty-second-monitor.html [131004010010] |Add Apache to Ubuntu's startup [131004010020] |I'm currently learning the Linux environment, and decided to manually install the Apache server. [131004010030] |For educational purposes, I've compiled it into: [131004010040] |The http.conf location is configured correctly. [131004010050] |It works -- I can open up a browser and navigate to localhost and see the "It works" message. [131004010060] |But how does one goes about adding Apache into Ubuntu's startup so I won't have to do: [131004010070] |all the time? [131004010080] |Can somebody explain how does one goes into adding programs to the Ubuntu startup (10.10 64 bit)? [131004020010] |Here is a good resource, quite close to what you ask for. [131004020020] |Basically to make apache2 start automatically you need to run [131004020030] |This will make the startup script start the service located in /etc/init.d/apache2 after booting up. [131004020040] |Beforehand, you need to make an init script and put it in /etc/init.d/. [131004020050] |In your case [131004020060] |may be good enough. [131004030010] |The easiest way is to take the Apache startup script in Ubuntu's Apache package, and replace /usr/sbin/apachectl by /server/apache/bin/apachectl. [131004030020] |If it's a learning exercise, you have several options (from most flexible to least flexible): [131004030030] |
  • Start Apache through Upstart. [131004030040] |You have to write a file /etc/init/my_apache.conf. [131004030050] |Given the state of Upstart documentation, I recommend reading existing examples and the man pages in parallel.
  • [131004030060] |
  • Start Apache through a SysV script: an executable script in /etc/init.d that starts, stops, restarts or reloads the Apache configuration depending on whether its first (and sole) argument is start, stop, restart, or reload (with force-reload as an alias for reload). [131004030070] |To have the script start on boot, run update-rc.d. [131004030080] |See also the Ubuntu Bootup Howto.
  • [131004030090] |
  • Start Apache from /etc/rc.local.
  • [131004040010] |SME server install from USB crashes with "IOError: [Errno 30] Read-only file system" [131004040020] |I managed to make my 8.0GB USB flash drive boot the current SME Server 8 beta ISO image. [131004040030] |The installation program starts when I boot from USB, and configuration of install options worked fine. [131004040040] |After pressing "Install now", the installation starts, then ends with a python exception error: [131004040050] |IOError: [Errno 30] Read-only file system [131004040060] |I tried it twice and got the same error. [131004040070] |What does this mean, and how should I alleviate this problem? [131004050010] |monitoring activity on my computer. [131004050020] |So recently I find that someone has been using my computer without consent, browsing folders, etc.... [131004050030] |I could change all my passwords straight away, but I'm curious as the what the intruding party was looking for. [131004050040] |So I would like to set up a trap ( evil grin ). [131004050050] |What software will monitor any activity on my computer? [131004050060] |While I know that capturing my screen will work here. [131004050070] |I'd rather use a logfile. [131004050080] |For example: [131004050090] |/var/log/activity.log [131004050100] |[1 Aug 2010 20:23] /usr/bin/thunar accessed /multimedia/cctv-records/ [1 Aug 2010 20:25] /usr/bin/mplayer accessed /multimedia/cctv-records/00232.avi [3 Aug 2010 02:34] /usr/bin/thunderbird was run [3 Aug 2010 03:33] incomming ssh session from 12.32.132.123 [131004050110] |Activities I would like to log is: [131004050120] |
  • Access to files and folders on the filesystem
  • [131004050130] |
  • Commands run ( from console or otherwise )
  • [131004050140] |
  • User Sessions ( login's, ssh sessions and failed attempts )
  • [131004060010] |Have a look at Fail2ban and DenyHØsts. [131004070010] |This isn't exactly what you are looking for, but some apps keep a list of recently-accessed files. [131004070020] |Also, GNOME keeps that list, which can be accessed from its Panel. [131004070030] |Another fix is to use GNOME Activity Journal, though last time I checked, it didn't keep a record of CLI activity, and was only interested in file-related activity (reading, editing), ignoring other activities. [131004070040] |You can also look inside /var/log directory where a bunch of programs store their logs. [131004080010] |Assuming enough naïveté on the side of your attacker, you can simply throw script -qft $USER-$$ 2> $USER-$$-time into his/your appropriate login script to monitor his or her terminal interactions and replay with the appropriate scriptreplay commands. [131004080020] |To monitor file-level access, I recommend attaching an strace -fe open with appropriate logging to the sshd and filtering for login sessions (or maybe it's better to just do this from . [131004080030] |Warning: Huge outputs, since doing anything on a modern system touches a lot of files. [131004080040] |If you just want to monitor specific files, have a look at auditd and its support infrastructure. [131004080050] |Sessions and login attempts can be gathered from syslog as per other answers. [131004090010] |You could use in-kernel mechanism inotify for monitoring accessed files. [131004090020] |First you should check if inotify is turned on in kernel: [131004090030] |Next thing to do is install inotify-tools. [131004090040] |Instructions for various distributions you could find at project page - it should be in repositories of all major distributions. [131004090050] |After that inotify is ready to work: [131004090060] |(m = do not exit after one event, r = recursive, q = quiet) [131004090070] |For example - output after ls /home/pbm [131004090080] |Important thing is to properly set directories for watch: [131004090090] |
  • don't watch / recursively - there is a lot of read/write to /dev and /proc
  • [131004090100] |
  • don't watch your home dir recursively - when you use apps there is a lot of read/write to application configuration dirs and browsers profile dirs
  • [131004090110] |In /proc/sys/fs/inotify/max_user_watches there is configuration option that shows how manu files could be watched simultaneously. [131004090120] |Default value (for Gentoo) is about not so high, so if you set watcher to /home/ you could exceed limit. [131004090130] |You could increase limit by using echo (root access needed). [131004090140] |But before that you should read about consequences of that change. [131004090150] |Options that could be interesting for you: [131004090160] |
  • -d = daemon mode
  • [131004090170] |
  • -o file = output to file
  • [131004090180] |
  • --format = user-specified format, more info in man inotifywait
  • [131004090190] |
  • -e EVENT = what event should be monitored (for example access, modify, etc, more info in man)
  • [131004100010] |Is the other guy on to you? [131004100020] |If he has physical access or root access, he can erase all his traces and even plant a bug to spy on you. [131004100030] |On the other hand, some traces are a pain to erase, and it's hard to think of everything. [131004100040] |Various things are already recorded in the system logs, typically in /var/log (some systems use a different location such as /var/logs or /var/adm). [131004100050] |Under a normal configuration, all logins and mounts are recorded, amongst others. [131004100060] |If you're worried about logs being erased, you can set up remote logging (how to do this depends on the syslog implementation, but it's generally one or two lines to change in a configuration file on the sender and on the receiver). [131004100070] |If you or your distribution hasn't disabled this feature, every file has an access time (“atime”) which is updated whenever the file is read. [131004100080] |(If the filesystem is mounted with the noatime or relatime option, the atime is not updated.) [131004100090] |The atime can be faked with touch -a, but this updates the ctime, so it leaves a trace. [131004100100] |(Even root cannot directly remove this trace, you need to bypass the filesystem code.) [131004100110] |Various programs have a session history. [131004100120] |It's easy to remove or fake, if the intruder remembered to do so. [131004100130] |Bash keeps ~/.bash_history, browsers tend to write lots of stuff in their profile directory, and so on. [131004100140] |You may also find telling errors or warnings in ~/.xsession-errors or /var/log/Xorg.0.log or other system-dependent location. [131004100150] |Many unices have a process accounting¹ feature. [131004100160] |See for example the GNU accounting utilities manual, the entry in the FreeBSD handbook or the Linux howto or the Solaris guide. [131004100170] |Once enabled, it records what user launched what process when (it logs execve calls), and perhaps a little more. [131004100180] |There's a lot of interesting information it doesn't log, such as the files accessed by the process. [131004100190] |If you want to monitor all accesses to a filesystem, you can provide it through loggedfs. [131004100200] |It's very easy to notice if the guy thinks to look. [131004100210] |There are more comprehensive logging programs, but they might require additional kernel support. [131004100220] |On Solaris, FreeBSD, NetBSD and Mac OS X, there is dtrace (there's a Linux port in progress but I don't know if it's reached a usable stage). [131004100230] |You can also trace specific processes through an interface to the ptrace system call, for example strace on Linux; it may induce a noticeable slowdown. [131004100240] |¹ Something that's not in Wikipedia? [131004100250] |Nah, that's crazy talk. [131004110010] |Extracting nested zip files [131004110020] |I have numerous zip archives, each of which contains a number of zip archives. [131004110030] |What is the best way to recursively extract all files contained within this zip archive and its child zip archives, that aren't zip archives themselves? [131004120010] |unzip doesn't do this, because the UNIX way is to do one thing and do that well, not handle all crazy special cases in every tool. [131004120020] |Thus, you need to use the shell (which does the job of "tieing things together" well). [131004120030] |This makes it a programming question, and since ALL possible programming questions have been answered on StackOverflow, here: How do you recursively unzip archives in a directory and its subdirectories from the Unix command-line? [131004130010] |This will extract all the zip files into the current directory, excluding any zipfiles contained within them. [131004130020] |Although this extracts the contents to the current directory, not all files will end up strictly in this directory since the contents may include subdirectories. [131004130030] |If you actually wanted all the files strictly in the current directory, you can run [131004130040] |Note: this will clobber files if there are two with the same name in different directories. [131004130050] |If you want to recursively extract all the zip files and the zips contained within, the following extracts all the zip files in the current directory and all the zips contained within them to the current directory. [131004140010] |As far as I understand, you have zip archives that themselves contain zip archives, and you would like to unzip nested zips whenever one is extracted. [131004140020] |Here's a bash 4 script that unzips all zips in the current directory and its subdirectories recursively, removes each zip file after it has been unzipped, and keeps going as long as there are zip files. [131004140030] |A zip file in a subdirectory is extracted relative to that subdirectory. [131004140040] |Warning: untested, make a backup of the original files before trying it out or replace rm by moving the zip file outside the directory tree. [131004140050] |The script will also work in zsh if you replace the shopt line with setopt nullglob. [131004140060] |Here's a portable equivalent. [131004140070] |The termination condition is a little complicated because find does not spontaneously return a status to indicate whether it has found any files. [131004140080] |Warning: as above. [131004150010] |The easiest way is to use atool: http://www.nongnu.org/atool/ It is a very good script that use zip, unzip, tar, rar etc. programs to extract any archive. [131004150020] |Use atool -x package_name.zip to unzip them all or if you wanna use it in directory with many zip files use simple for loop: for f in *; do atool -x $f; fi (you will have to cd into desired directory with zip files before you use this). [131004160010] |You'll want to be careful automatically unzipping zip files inside of zip files: [131004160020] |http://research.swtch.com/2010/03/zip-files-all-way-down.html [131004160030] |It's possible to concoct a zip file that produces a zip file as output, which produces a zip file as output, etc etc etc. [131004160040] |That is, you can make a zip file that's a fixed oint of "unzip" the program. [131004160050] |Also, I seem to recall people making zip files that would "explode", that is a very small zip file would unzip to multi-gigabytes of output. [131004160060] |This is a facet of the method of compression. [131004170010] |On Gentoo, what is loading up my network interfaces? [131004170020] |I have 2 networking interfaces eth0 (wired) and wlan0 (wireless). [131004170030] |Every time the computer boots it tries to bring up both. [131004170040] |Most often when there is a LAN cable I don't need wlan0, and vice versa, so this looks like a waste. [131004170050] |I want to stop the interfaces from being brought up automatically so that I can bring up the one that I need, if at all. [131004170060] |According to the Gentoo Handbook I need to run [131004170070] |to have eth0 up every time the system boots and I assume the same thing goes for wlan0. [131004170080] |However the result of [131004170090] |does not contain either eth0 or wlan0. [131004170100] |So the question is, who is bringing up the 2 interfaces? [131004170110] |How can I stop that? [131004180010] |Some services requires network service (i.e. they use network ;) ). [131004180020] |The RC_NET_STRICT_CHECKING variable from /etc/conf.d/rc determines when the service is 'up'. [131004180030] |Particulary the "no" setting seems to describe something similar to what you want: [131004180040] |I guess that configuration you described is particulary useful in mobile enviroment and, personally, I prefere to use net-misc/networkmanager to manage network for me and disable Gentoo script managing (which is mostly suitable for servers and have no proper handling of hibernations, dynamic configuration etc.). [131004190010] |Disabling line wrap in Konsole [131004190020] |Is there a way to prevent konsole from wrapping lines? [131004190030] |It would be great if I could do it without disabling any of the other features like extended colors and other of the fancier things. [131004200010] |There's a VT100 control sequence for that, which should be supported by Konsole. [131004200020] |It's called DECAWM, and here's how to emit it: [131004200030] |My question would be though: why? [131004210010] |TAB autocomplete in Bourne Shell [131004210020] |I don't know how to get the TAB key to autocomplete filenames, commands, or anything at all. [131004210030] |I'm on a Unix-like system (OS/390) and depend on several scripts that work in sh (Bourne shell, not BASH), but not in other shells (tcsh, for example), so I can't switch shells. [131004210040] |I usually connect to this system via ssh or telnet from Ubuntu's GNOME Terminal running bash locally. [131004210050] |Other people connect to the OS/390 system via telnet from the Windows XP command prompt, and they are able to autocomplete with the TAB key after issuing "set -o emacs". [131004210060] |When I issue "set -o emacs", I get some of the appropriate functionality (ctrl-p to step backward through the history, for example), but not autocomplete. [131004210070] |I am aware of the "set -o vi" option, but using "ESC-*", etc does not appeal to me because I know that the simple TAB key works for other people. [131004210080] |Is there something about Ubuntu, the GNOME Terminal, bash, or ssh that sends a different tab character than a Windows XP command prompt running telnet? [131004210090] |Does anyone have an idea as to why I might not be able to get tab to autocomplete while people on that same remote machine, running the same shell, can? [131004210100] |Or know how I might fix this? [131004210110] |Thanks! [131004220010] |(No answer to your exact question, but many workarounds.) [131004220020] |You don't need to match your scripting shell with your interactive shell. [131004220030] |(For example, most (t)csh or zsh users write sh scripts). [131004220040] |If you have or can install a better interactive shell than the Bourne shell (zsh, bash, tcsh), go for it. [131004220050] |Even if you can't, look if there's a ksh, which is likely to have slightly better interactive features than a Bourne shell. [131004220060] |You can check what character the tab key sends by entering echo ' Ctrl+V Tab ' | od -t x1 Enter. 0000000 09 0a (i.e. at position 0, two characters, a tab and a newline) is the expected output. [131004220070] |I don't expect this to be the issue. [131004220080] |If you can't get a comfortable environment, you could try doing more things remotely, using your local machine for interaction as much as possible. [131004220090] |This has its ups and downs. [131004220100] |
  • From Linux (or most other unices including OSX, but not from Windows), you can use sshfs to access the remote filesystem.
  • [131004220110] |
  • Within Emacs, you can easily browse remote files via Tramp (open /os390hostname:/path/on/remote/machine, you get completion). [131004220120] |You can also use Eshell to get a remote shell interface (an Emacs built-in shell); if you change to a remote directory (cd /os390hostname:/path/on/remote/machine), the external commands you launch will be executed on the remote machine. [131004220130] |If you need to run commands as root, Tramp (and Eshell which is based on it) can combine ssh with su or sudo.
  • [131004230010] |Is it possible to boot an x86 Linux kernel using both 80x25 text mode consoles and VESA framebuffer consoles? [131004230020] |The Linux kernel documents that you can choose to boot Linux with VESA framebuffer consoles instead of the default 80x25 text mode consoles. [131004230030] |For text application testing purposes, one may need both modes simultaneously. [131004230040] |For instance, ALT+1 to ALT+3 in 80x25 text mode and ALT+4 to ALT+6 in framebuffer mode. [131004230050] |Is there a way to achieve dual mode text displays in a single boot? [131004240010] |If you boot the kernel in text mode (standard on x86), you can change the VESA mode after boot with "vbetool", using the vbemode action. [131004240020] |If you boot the kernel in framebuffer mode (standard on non-x86), you can change the resolution at runtime with "fbset". [131004240030] |When you press ALT+1 etc, the kernel probably sends SIGWINCH to the INIT process (pid 1). [131004240040] |The default init program probably generates a kbrequest event, you may be able to pick up on that by modifying /etc/inittab and have init run a script that sets the mode for you. [131004250010] |How can I disable bells/visualbells in vim? [131004250020] |How can I disable bells/visualbells in vim? [131004250030] |I've tried: [131004250040] |.. but nothing has changed afaik. [131004250050] |Just to be clear, I'm referring to the visual bell I get in vim when I do something that doesn't do anything, for exmaple pressing ESC in normal mode, or pressing h in on col 0. [131004260010] |To disable the bell altogether, you need to [131004260020] |
  • enable vim's internal visual bell¹, with set visualbell (= set vb);
  • [131004260030] |
  • set the effect of the vim visual bell to do nothing, with set t_vb=
  • [131004260040] |(This is explained in the documentation of 'visualbell', but not very clearly.) [131004260050] |¹ Even with novisualbell, you might see a visual bell if vim emits a bell control sequence (usually \a) and the terminal is configured to flash rather than make a sound. [131004270010] |What linux editor can open a 200G file for editing within a minute or two? [131004270020] |I'm looking for an editor that will open the file in chunks (not try to read the whole file into memory) as I'm trying to hand-edit a 200G file. [131004280010] |This may not be exactly what you're looking for, but hexedit will open large files like that. [131004280020] |It only has what's displayed in the buffer (and maybe a little bit more) in memory. [131004280030] |It's made for editing raw disk files (e.g., /dev/sda) and will display in hex side by side with ASCII or EBCDIC. [131004290010] |How to stop avahi-daemon [131004290020] |I'm trying to disable avahi-daemon. [131004290030] |I tried to modify the file /etc/default/avahi-daemon, setting the AVAHI_DAEMON_DETECT_LOCAL=0 instead of 1, but when I connect to a network it starts anyway; is there no way to stop it? [131004290040] |I am trying to stop it because every time I connect to a network it and dhclient starts it gives my NIC another address so I cannot access the network. [131004290050] |I'm on a Debian machine. [131004310010] |You can use rcconf to disable it starting it from boot or you can manually remove it from autostartup with; [131004310020] |Only root can do this so use sudo if you are not root. [131004320010] |Distribution recommendation for a multiseat setup using dual-head and supporting direct rendering [131004320020] |I have two keyboards, mice and monitors and a ATI Radeon HD 4290 onboard a ASUS M4A89GTD PRO/USB3 mainboard. [131004320030] |Can you recommend a distribution or livecd that supports the GPU and offers easy means to setup a dual-head multiseat system where both sessions have direct rendering enabled? [131004320040] |(32 or 64 doesn't matter here, although 64 bit are preferred) [131004330010] |Iterate over the output of a command in bash without a subshell [131004330020] |I want to loop over the output of a command without creating a sub-shell or using a temporary file. [131004330030] |The initial version of of my script looked like this, but this doesn't work since it creates a subshell, and the exit command terminates the subshell instead of the main script which is required. [131004330040] |It is part of a much larger script to configure policy routing, and it is halt the execution if it detects a condition that will cause routing to fail. [131004330050] |So one of the suggested alternatives is to use a command like this to avoid the subshell. [131004330060] |So it seems to me that I should also be able use a command like this to avoid the subshell and still get the output from the program I want. [131004330070] |Unfortunately, using that command results in this error. [131004330080] |I get really confused since this does work. [131004330090] |I could save the output of that command to a temporary file, and use redirect the on the temporary file, but I wanted to avoid doing that. [131004330100] |So why is the redirection giving me an error, and do I have any options other then creating a temporary file? [131004340010] |You missed a <. [131004340020] |Should be: [131004340030] |Think of <(sysctl -a 2>/dev/null | grep '\.rp_filter') being a file. [131004350010] |How to rename a file into a random GUID? [131004350020] |The task is to replace a file's (actually of all the files in a directory) name (but leave extension intact) with a random UUID/GUID. [131004350030] |Any ideas on how to do this? [131004360010] |Something like this: [131004360020] |Using openssl rand 16 gives you 128 bit GUIDs. [131004360030] |Use 32 if you want 256 bit GUIDs. [131004370010] |Short Perl script below - the use of cat to get the uuid isn't the cleanest/fastest way to code it, but it keeps the command short: [131004370020] |The above uses a file in /proc on linux as a source of uuids: [131004380010] |Similar to bahamat answer, but generates actual UUIDs. [131004380020] |UUIDs have some reserved bits that are used to determine the version and variant used. [131004380030] |There are currently 5 types of UUIDs defined, random UUIDs, as you asked, are version 4. [131004380040] |You will note that version 4 UUIDs have this format: [131004380050] |Also, this version doesn't cause damage in case the UUID generation fails. [131004380060] |Using /proc/sys/kernel/random/uuid: [131004390010] |Encode directory with GnuPG [131004390020] |Is there any way to encrypt the whole directory using gpg? [131004390030] |It accepts only file as input argument. [131004390040] |But I need to encrypt a lot of files on external HDD. [131004400010] |I just saw the option --multifile on the manpage: [131004400020] |This modifies certain other commands to accept multiple files for processing on the command line or read from STDIN with each filename on a separate line. [131004400030] |This allows for many files to be processed at once. --multi‐ file may currently be used along with --verify, --encrypt, and --decrypt. [131004400040] |Note that --multifile --verify may not be used with detached signatures. [131004400050] |What you are specifically looking for is --encrypt-files and, again the manpage: [131004400060] |Identical to --multifile --encrypt. [131004410010] |Why not tar the files to be encrypted and then encrypt the tarball? [131004420010] |How to make startx use alternate xinitrc? [131004420020] |I don't have a desktop manager installed (and I don't want to). [131004420030] |After logging in through the terminal I use startx to start the GUI. [131004420040] |I have entries in ~/.xinitrc for my GUI sessions. [131004420050] |Right now I have xmonad in there, but sometimes I want to run a GNOME session, and sometimes a KDE session. [131004420060] |I used to edit ~/.xinitrc for that purpose, but I think there should be a more elegant way (something like using alternate configurations). [131004420070] |However, I can't find anything in man startx or man xinit. [131004420080] |I plan to have several configuration files (one for each GUI session), and then tell startx to load them when I want. [131004420090] |How can I do that? [131004430010] |According to the xinit man page that I read, xinit (and thereby startx) looks in its command line parameters for a client program to run. [131004430020] |If it doesn't find one, it runs ~/.xinitrc instead. [131004430030] |So you should be able to write [131004430040] |and it will do what you want. [131004430050] |You will need to provide a path, though, and not just a filename. [131004430060] |In my testing, startx ./my_xinitrc worked but startx my_xinitrc did not. [131004440010] |How do I read from /proc/$pid/mem under Linux? [131004440020] |The Linux proc(5) man page tells me that /proc/$pid/mem “can be used to access the pages of a process's memory”. [131004440030] |But a straightforward attempt to use it only gives me [131004440040] |Why isn't cat able to print its own memory (/proc/self/mem)? [131004440050] |And what is this strange “no such process” error when I try to print the shell's memory (/proc/$$/mem, obviously the process exists)? [131004440060] |How can I read from /proc/$pid/mem, then? [131004450010] |

    /proc/$pid/maps

    [131004450020] |/proc/$pid/mem shows the contents of $pid's memory mapped the same way as in the process, i.e., the byte at offset x in the pseudo-file is the same as the byte at address x in the process. [131004450030] |If an address is unmapped in the process, reading from the corresponding offset in the file returns EIO (Input/output error). [131004450040] |For example, since the first page in a process is never mapped (so that dereferencing a NULL pointer fails cleanly rather than unintendedly accessing actual memory), reading the first byte of /proc/$pid/mem always yield an I/O error. [131004450050] |The way to find out what parts of the process memory are mapped is to read /proc/$pid/maps. [131004450060] |This file contains one line per mapped region, looking like this: [131004450070] |The first two numbers are the boundaries of the region (addresses of the first byte and the byte after last, in hexa). [131004450080] |The next column contain the permissions, then there's some information about the file (offset, device, inode and name) if this is a file mapping. [131004450090] |See the proc(5) man page or Understanding Linux /proc/id/maps for more information. [131004450100] |Here's a proof-of-concept script that dumps the contents of its own memory. [131004450110] |

    /proc/$pid/mem

    [131004450120] |If you try to read from the mem pseudo-file of another process, it doesn't work: you get an ESRCH (No such process) error. [131004450130] |The permissions on /proc/$pid/mem (r--------) are more liberal than what should be the case. [131004450140] |For example, you shouldn't be able to read a setuid process's memory. [131004450150] |Furthermore, trying to read a process's memory while the process is modifying it could give the reader an inconsistent view of the memory, and worse, there were race conditions that could trace older versions of the Linux kernel (according to this lkml thread, though I don't know the details). [131004450160] |So additional checks are needed: [131004450170] |
  • The process that wants to read from /proc/$pid/mem must attach to the process using ptrace with the PTRACE_ATTACH flag. [131004450180] |This is what debuggers do when they start debugging a process; it's also what strace does to a process's system calls. [131004450190] |Once the reader has finished reading from /proc/$pid/mem, it should detach by calling ptrace with the PTRACE_DETACH flag.
  • [131004450200] |
  • The observed process must not be running. [131004450210] |Normally calling ptrace(PTRACE_ATTACH, …) will stop the target process (it sends a STOP signal), but there is a race condition (signal delivery is asynchronous), so the tracer should call wait (as documented in ptrace(2)).
  • [131004450220] |A process running as root can read any process's memory, without needing to call ptrace, but the observed process must be stopped, or the read will still return ESRCH. [131004450230] |In the Linux kernel source, the code providing per-process entries in /proc is in fs/proc/base.c, and the function to read from /proc/$pid/mem is mem_read. [131004450240] |The additional check is performed by check_mem_permission. [131004450250] |Here's some sample C code to attach to a process and read a chunk its of mem file (error checking omitted): [131004450260] |I've already posted a proof-of-concept script for dumping /proc/$pid/mem on another thread. [131004460010] |When you execute cat /proc/$$/mem the variable $$ is evaluated by by bash which inserts its own pid. [131004460020] |It then executes cat which has a different pid. [131004460030] |You end up with cat trying to read the memory of bash, its parent process. [131004460040] |Since non-privileged processes can only read their own memory space this gets denied by the kernel. [131004460050] |Here's an example: [131004460060] |Note that $$ evaluates to 17823. [131004460070] |Let's see which process that is. [131004460080] |It's my current shell. [131004460090] |Here again $$ evaluates to 17823, which is my shell. cat can't read my shell's memory space. [131004470010] |Windows Media Audio 9 player plugin- something for linux [131004470020] |I need something to play WMA radio. [131004470030] |Do you know any way of doing this on linux? [131004480010] |Mplayer should be able to play WMA radio. [131004480020] |It's possible to set up firefox to direct mms:// URIs to mplayer by setting the firefox configuration setting "network.protocol-handler.app.mms" to /usr/bin/mplayer (or whatever the path is for mplayer). [131004490010] |If you run a Debian-based distro and a particular player is built without WMA support, you may try a build from debian-multimedia.org. [131004500010] |Once sudo su'd to root, is there a command to see my username? [131004500020] |I have sudo rights on a redhat box; once I've "sudo su -" to become root in a shell, are there any commands I can run to see what username I su'd FROM? [131004510010] |The shell's parent process is su, so you need to find out the user running su's parent process: [131004510020] |But you shouldn't be doing sudo su - if your version of sudo is not too old to have sudo -i. [131004510030] |Sudo sets the environment variable SUDO_USER to the name of the user who ran sudo. [131004510040] |You won't see it with sudo su - because su - scrubs the environment. [131004520010] |Run command "who am i" it will return you something like that: [131004520020] |In bold "gladimdim" is the user which was initially logged to system. [131004530010] |Changes to input_get_keycode function in linux kernel (input/input.c) [131004530020] |I'm working on building a kernel module for an input device, and I noticed that in the module source, there's a couple calls to input_get_keycode(data->input_dev, scancode, &keycode); When I was compiling I was getting errors that there's no function with that prototype. [131004530030] |Looking into the input/input.c source code, this is the definition of input_get_keycode: [131004530040] |I tried to look online, and I found a couple obscure references to changing the kernel to be able to deal with large keymaps better, and apparently this function was changed to better handle that. [131004530050] |Looking at an older source from input/input.c, the input_get_keycode function was defined as [131004530060] |My question is, when was this changed. [131004530070] |Is there notes on the change? [131004530080] |I'm building the ubuntu natty kernel from git which is from my understanding from the 2.6.37-rc3 branch. [131004530090] |Is this a ubuntu specific change? [131004530100] |Or is this a change in the mainline kernel. [131004530110] |I also have the maverick source from git which has the old style (3 input) function. [131004540010] |If you are working on a kernel module, I very much recommend that you get a git tree. [131004540020] |Obviously Linus's tree is mandatory - I also get the stable trees. [131004540030] |Since you are working on Ubuntu, I'd check to see if they have a tree with their changes you can pull from. [131004540040] |Using the git tree, I was able to checkout master and run git blame drivers/input/input.c to see that the function signature for input_get_keycode was last changed in commit 8613e4c2. [131004540050] |Running git show 8613e4c2 gives me the commit message for that change (the notes that you wanted) as well as the patch that implements the change. [131004540060] |I can see that the change was made on 2010-09-09. [131004540070] |Starting up gitk (a graphical git viewer) and telling it to go to that commit I can see that the commit precedes v2.6.37-rc1, telling me it was merged into that release. [131004540080] |Following the branch up to when Linus merged it, I can see it was merged on 2010-10-26 in commit 3a99c631. [131004540090] |This is all mainline without looking at Ubuntu patches, so it looks like the change has nothing to do with Ubuntu. [131004550010] |grep pdf files? [131004550020] |Is there a way to search pdf files using the power of grep, without converting to text first in Ubuntu? [131004560010] |You could pipe it through strings first:- [131004570010] |If you have poppler-utils installed (default on Ubuntu Desktop), you could "convert" it on the fly and pipe it to grep: [131004570020] |This won't create a .txt file. [131004580010] |gpdf might be what you need if you're using Gnome! [131004580020] |Check this in case you're not using Gnome. [131004580030] |It's got a list of CLI pdf viewers. [131004580040] |Then you can use grep to find some pattern. [131004580050] |Hope that helps. [131004590010] |No. [131004590020] |A pdf consists of chunks of data, some of them text, some of them pictures and some of them really magical fancy XYZ (eg. .u3d files). [131004590030] |Those chunks are most of the times compressed (eg. flat, check http://www.verypdf.com/pdfinfoeditor/compression.htm). [131004590040] |In order to 'grep' a .pdf you have to reverse the compression aka extract the text. [131004590050] |You can do that either per file with tools such as pdf2text and grep the result, or you run an 'indexer' (look at xapian.org or lucene) which builds an searchable index out of your .pdf files and then you can use the search engine tools of that indexer to get the content of the pdf. [131004590060] |But no, you can not grep pdf files and hope for reliable answers without extracting the text first. [131004600010] |How to add a repository on Fedora? [131004600020] |With one repository I did it like this (as root): [131004600030] |Is this the recommended way to add a package repository under Fedora (>= 14)? [131004600040] |Is there some policy/standard which specifies that each proper Fedora package repository should (or must) contain such a config file (i.e. such a .repo file)? [131004600050] |(basically just for the reason that a user or some tool can copy it to the local /etc/yum directory?) [131004610010] |I googled a bit around with 'fedora add repository' and got some outdated and not very helpful links. [131004610020] |Because of the noise I missed this link: [131004610030] |http://docs.fedoraproject.org/en-US/Fedora_Core/3/html/Software_Management_Guide/sn-using-repositories.html [131004610040] |Which is kind of outdated as well, but it gives me the hint to look for an updated version of the software management guide: [131004610050] |Add New Repositories [131004610060] |(which also mentions the wget method I used to add a .repo file) [131004610070] |I am a bit surprised that the official and as it seems quite extensive fedora documentation is not higher scored in the google results. [131004620010] |See here: Howto: Add a new yum repository to install software under CentOS / Redhat Linux [131004630010] |It appears that in recent versions of Fedora, there was an attempt to integrate a "Media Repo" with PackageKit, but there were enough bugs that it was left out of Fedora 14 (this for example). [131004630020] |It sounds like you're going to have to follow the directions mentioned in the other answers to either copy the packages locally or mount the ISO image as a loopback device, and set up yum file:// URLs to point a the packages. [131004640010] |The Fedora 14 docs. haven't been updated yet. [131004640020] |The latest way to do this with just a .repo file is: [131004640030] |...you can then use "yum-config-mananger --enable" etc. too. [131004650010] |How to specify where files are transferred to using ssh [131004650020] |I know how I can send files to a specific directory on a remote server using ssh, but I don't know how to specify it. [131004660010] |There are a few methods. [131004660020] |The simplest way if you're just transferring a file once in a while. [131004660030] |scp stands for secure copy and it transfers over SSH. [131004660040] |There is also sftp [131004660050] |I guess the only real advantage to using this is that you can transfer multiple files without typing in your SSH password all the time. [131004660060] |(If you don't use a keyring that is) [131004660070] |If you're going to be regularly transferring files take a look at rsync. [131004660080] |A simple usage of rsync might look like: [131004660090] |But take a look at the man page as there are tons of options. [131004660100] |Finally, there is a sshfs. [131004660110] |With this method you can mount an SSH server to your local filesystem like any other filesystem, then you can just copy files into it. [131004670010] |Technically, the answer to your question is that you must specify where the file is. [131004670020] |There is no magic. [131004670030] |For instance with SCP (which uses the SSH protocol) you would specify username@systemname:pathtofile [131004670040] |SCP then logs in to the system that you specify using the username and follows the path that you specify to find the file. [131004680010] |How to send mail from a remote SMTP host? [131004680020] |I have Postfix suite installed locally on Ubuntu 10.10. [131004680030] |I can send/receive mail to my local address, e.g. user@local.com. [131004680040] |I'm given credentials to a remote mail server mailbox, e.g. other@remote.com. [131004680050] |What command line incantation on my local box would connect me to SMTP server at remote.com providing username and password and send mail through it? [131004680060] |I've read sendmail and smtp manpages but that didn't give me any clue. [131004690010] |You will need to have Postfix relay the messages to the remote server. [131004690020] |This will require a change to the Postfix configuration. [131004690030] |You'll need to enable Postfix's SASL authentication to handle the authentication. [131004690040] |Once configured, you can use your local SMTP server as you did with local addresses, and the local server will relay them on the the remote server. [131004700010] |Actually, Postfix turned out to be irrelevant to my problem. [131004700020] |Using it would be an overkill for this task: it requires per-host configuration, where per-user would do. [131004700030] |I figured out msmtp is well enough for my task. [131004710010] |LiteSpeed and Opensuse problem [131004710020] |Hi All, [131004710030] |We have a problem related Opensuse.My problem is; How can I setup Litespeed Web Server on Opensuse? [131004710040] |There are trouble with Opensuse compatibility. [131004710050] |Thanks in advance, [131004710060] |Cheers. [131004720010] |I can't adjust screen brightness of my laptop anymore [131004720020] |My laptop has keyboard buttons for adjusting screen brightness. [131004720030] |After a Debian Squeeze re-installation, they don't work no more. [131004720040] |[laptop] Acer TravelMate 6592; I use Fn< to decrease the brightness and Fn> to increase it. [131004730010] |Is it a problem of key mapping or a problem of acpi support ? [131004730020] |Check in /proc/acpi/ if you have some entries like this one : /proc/acpi/video/GFX0/LCDD/brightness [131004730030] |If you find it, try to set a value maybe like this : [131004740010] |Add "acpi_osi=Linux" to loader [131004740020] |Example: [131004750010] |vim -N mode: where to use it? [131004750020] |I am following the Peepcode screencasts to learn vim. [131004750030] |The presenter mentions about the -N mode but doesn't elaborate it much and says that it should be the default mode. [131004750040] |My questions: [131004750050] |
  • What is the -N mode?
  • [131004750060] |
  • Should I always use it?
  • [131004750070] |
  • If yes, how do I configure it in the .vimrc?
  • [131004750080] |EDIT: The author does mention that it should always be used, but doesn't elaborate why and how. [131004750090] |Thanks for your time. [131004760010] |Running vim -N sets Vim in "nocompatible" mode, which drops strict backwards compatibility with the original vi in favor of better features. [131004760020] |Unless you know that you need (or want) backwards compatibility, it's better to go with the features. [131004760030] |If you have a .vimrc file in the first place, Vim will by default put you in nocompatible mode, but the command set nocompatible will seal the deal. [131004760040] |See the following Vim help topics for more info: [131004770010] |untar a directory of *.tgz files using a wildcard [131004770020] |I've got a directory that looks like [131004770030] |I want to unzip all the files that match the extension *.tgz with a single command, except Broad_hapmap3_r2_Affy6_cels_excluded.tgz. [131004770040] |I can do [131004770050] |for all the *tgz files, but what's a good way to exclude a subset of them? [131004770060] |From reading online maybe find is indicated in this situation, but it seems like overkill. [131004770070] |Thank in advance. [131004770080] |Addendum: I'd also be interested in alternative methods to the question without excluding files. [131004780010] |You could always do: [131004780020] |But I suspect somone will post a cleaner way do do this directly from the bash shell without needing a grep in there. [131004790010] |The following matches all the tarballs with the filename composed by 5 uppercase letters: [131004790020] |without grep it would be [131004790030] |but you will lose the power of regexes that way [131004800010] |For one-off things like this, I'd just brute-force it: [131004810010] |In zsh: [131004810020] |Another possibility in zsh: [131004810030] |In ksh (but not bash or zsh as they don't support and patterns): [131004810040] |Another way in ksh: [131004810050] |In bash: [131004810060] |In any shell: [131004810070] |Yet another hackish way: [131004810080] |If you also want to act on files in subdirectories, find is the natural tool to turn to. [131004810090] |The recursive examples below exclude files named Broad_hapmap3_r2_Affy6_cels_excluded.tgz in any subdirectory. [131004810100] |For a recursive traversal in zsh or bash ≥4, you can use ** in patterns. [131004810110] |In zsh: [131004810120] |In bash ≥4: [131004810130] |You can even use find if you don't want a recursive traversal, though it's not the most convenient way then. [131004820010] |date, get current 15 minute interval [131004820020] |Is there any way I can get the current 15 minute interval using the date command or similar ? [131004820030] |e.g. something like date %Y.%m.%d %H:%M will give me 2011.02.22 10:19 , I need something that yields 2011.02.22 10:15 in the time span from 10:15 to 10:29. [131004830010] |You can get the current unix timestamp with date "+%s", find the current quarter-hour with some simple math (my example is in bash) and print it back with a better format with date : [131004830020] |The @ syntax to set the current date and time from a timestamp is a GNU extention to date, if it don't works on your OS, you can do the same like this : [131004840010] |Am not sure about your exact requirement. [131004840020] |However, if you want to generate the time after 15 min, then you can use something like date -d '+15 min'. [131004840030] |Output is shown below: [131004850010] |If you can live with calling date two times, this one works in bash on Solaris: [131004850020] |Edited on behalf of the comment to: [131004860010] |The following methods make it unnecessary to call date twice. [131004860020] |A system call's overhead can make a "simple" command 100 times slower than bash doing the same thing in its own local environment. [131004860030] |UPDATE Just a quick mention about my above comment: "100 times slower". [131004860040] |It can now read "500 times slower"... [131004860050] |I recently fell (no, walked blindly) into this very issue. here is the link: Fast way to build a test file [131004860060] |or [131004860070] |Both versions will return only [131004860080] |Here is the first one with a TEST loop for all 60 values {00..59} [131004870010] |Here's a way to work on dates in the shell. [131004870020] |First call date to get the components, and fill the positional parameters ($1, $2, etc) with the components (note that this is one of these rare cases where you do want to use $(…) outside of double quotes, to break the string into words). [131004870030] |Then perform arithmetics, tests, or whatever you need to do on the components. [131004870040] |Finally assemble the components. [131004870050] |The arithmetic part can be a little tricky because shells treat 0 as an octal prefix; for example here $(($5/15)) would fail at 8 or 9 minutes past the hour. [131004870060] |Since there's at most one leading 0, ${5#0} is safe for arithmetic. [131004870070] |Adding 100 and subsequently stripping the 1 is a way to get a fixed number of digits in the output. [131004880010] |How do I know where to put things in linux? [131004880020] |Installing something in windows takes a click of a button. [131004880030] |But every time I try to install something in linux, which is not found in APT, I get so confused. [131004880040] |You download a zipped folder, then what? [131004880050] |If you are lucky there is a README, refering to some documentation, which might help you, if you are lucky. [131004880060] |What is the magic trick when "installing" extensions and applications which aren't found in APT? [131004880070] |I love linux, but this problem haunts me every day. [131004890010] |If it is a software which obeys the Filesystem Hierarchy Standard than you should place it in /usr/local and the appropriate subdirectories (like bin, lib, share, ...). [131004890020] |Other software should be placed in their own directory under /opt. [131004890030] |Then either set your PATH variable to include the bin directory or whatever directory which holds the executables, or create symbolic links to /usr/local/bin. [131004900010] |There is no simple answer to this question, but I can give you a general outline of how it works: [131004900020] |Most Linux software is provided by the authors (the "upstream") in source code form. [131004900030] |This allows everyone who has a compiler for their particular platform and system configuration to download the sourcecode and compile it themselves. [131004900040] |Unfortunately for you, many programs rely on functions provided by other programs and software libraries (dependencies). [131004900050] |Windows software usually comes in precompiled form. [131004900060] |That means there's one generic executable file for all Windows computers, and the dependencies often come with it in the install package. [131004900070] |Linux distributions take the sourcecode, precompile it for you and offer it to you as a package, too. [131004900080] |The package doesn't include the dependencies, but it refers to them and forces the package system to install them as well (which can sometimes lead to mess-ups which you've probably experienced yourself already). [131004900090] |If there is no precompiled package, you can always download the source code and compile it yourself. [131004900100] |Most of the time, the following will work: [131004900110] |The ./configure line sets the stage for the compilation process (and spits out errors if dependencies aren't met). [131004900120] |The make line will execute the Makefile, a script that compiles all parts of the program. [131004900130] |Traditionally, you would use make install to then install the software. [131004900140] |This usually puts the executables in /usr/local/bin. [131004900150] |Since you're using apt, I very much recommend getting checkinstall. [131004900160] |You can use it in place of make install, and it will generate a .deb package for you. [131004900170] |This makes it much easier to cleanly remove the software later on. [131004900180] |Note that there are a handful of other compilation sytems, for example cmake; and some software comes precompiled but unpackaged (in which case you can start it right from the unzipped folder); and some software comes as a collection of scripts you have to run yourself. [131004900190] |Fresh code from SVN sometimes comes without configure scripts, so you have to first run the autoconf toolchain ... etc, etc ... you see there are lots of exceptions to the rule, but with a little experience you'll be able to tell what to do with most of those mysterious downloads. [131004900200] |Configure-Make-Checkinstall is a good first start. [131004900210] |PS. [131004900220] |Spend a weekend or two to learn how to program yourself, and things will become very obvious :-) [131004900230] |PPS. [131004900240] |You may wonder why Linux software authors don't just provide precompiled packages instead of the sourcecode. [131004900250] |Well, they sometimes do. [131004900260] |But different platforms and Linux distributions all have their own package formats and file system rules, so as a developer you'd have to provide packages for every possible configuration -- which is a pain. [131004900270] |Ubuntu packages are often the easiest to find though -- you should find out what a PPA is and how it works! [131004910010] |There is a valid, sensible reason this is so confusing (there is also an annoying artifact reason)... [131004910020] |Unix has a history of being multi-user and most users did not have access to install apps outside areas they had been granted specific access to. [131004910030] |So the theory would be that you would build something in your home directory, then copy it to an area you had control over (your own project area, or a shared area). [131004910040] |Windows PCs are generally single-user systems and don't have this constraint, everything goes in Program Files no matter what. [131004910050] |Then there is the stupid, annoying fact that every time a new version of Unix came out the creators felt it necessary to change locations, but the old ones had to still be there for automated scripts. [131004910060] |This gives you a bunch of linked directories serving the same purpose. [131004910070] |The init system is even worse. [131004920010] |You should check out checkinstall. [131004920020] |Instead of [131004920030] |you do [131004920040] |and you'll be able to manage that package as if you had installed it through apt. [131004930010] |Red Hat, Inc. is an [131004940010] |A filesystem is a method of storing and organizing computer files and their data [131004950010] |Compiling is the process of transforming source code into byte codes for a particular computer architecture [131004960010] |RPM Package Manager is a package management system intended primarily for Linux distributions [131004970010] |A free software re-implementation of the SMB/CIFS networking protocol, which provides Windows file and print services [131004980010] |How to make Mutter default window manager [131004980020] |I'm running Debian Squeeze and removed Metacity in favor of Mutter. [131004980030] |How do I avoid having to run mutter --replace each time I start Xorg (GNOME)? [131004990010] |Press Alt + F2 and enter gconf-editor. [131004990020] |Navigate the tree menu to desktop >gnome >session >required-components. [131004990030] |Now, replace the windowmanager key with the window manager of your choice. [131004990040] |Just replace gnome-wm (or metacity) with mutter. [131004990050] |Another possible solution: [131004990060] |You could add mutter --replace to System >Preferences >Startup Applications which opens gnome-session-properties program: [131005000010] |Under Debian, if you want to change the window manager for all users, you can run (as root): [131005000020] |and select the window manager you want as the default. [131005000030] |However, this might only work if you're not using a desktop environment (e.g. GNOME or KDE). [131005000040] |If you're using GNOME, you can tell it which window manager you want by putting the following in ~/.gnomerc: [131005010010] |How can I run Firefox on Linux headlessly (i.e. without requiring libgtk-x11-2.0.so.0)? [131005010020] |I’ve got Dreamhost shared hosting, and I’m trying to run Firefox 3.0 on it headlessly for use with Selenium. [131005010030] |When I try to run it (~/local/bin/firefox/firefox), I get the following error message: [131005010040] |How can I run Firefox on Linux without requiring this shared object file? [131005020010] |You can't; it is linked with the X and Gtk+ client libraries, and I don't think it's even possible to build it without them. [131005030010] |You can't run Firefox without all the Gtk libraries it requires, but that's easily solved by installing the libraries. [131005030020] |Normally you would install Firefox through a package management system and this would pull in all the required libraries. [131005030030] |To run Firefox normally, you need an X server (that's the part that displays the windows and their contents, as opposed to things like Gtk which are libraries that the applicattion uses to build the content). [131005030040] |That's something you wouldn't usually run on a server. [131005030050] |There are a very few things you can do in Firefox without an X server, I don't know if Selenium is one of them. [131005030060] |To run Firefox on your server, run a “virtual” X server. [131005030070] |A simple one is Xvfb (virtual framebuffer X server). [131005030080] |It's in the X.org server distribution. [131005030090] |Sample usage: [131005040010] |Since Selenium is a GUI testing tool, I would find it hard to believe that it can work without X. [131005040020] |So my best guess is that your headless server requires an X installation such as that suggested by Gilles. [131005040030] |There are a number of similar alternatives. [131005050010] |GRUB error 15, no boot menu nor /boot [131005050020] |I am have a fully updated Arch Linux system that was running fine. [131005050030] |Last night I tried to setup autofs per instructions on the Arch wiki, but upon restart there was no boot menu and only a GRUB error message saying "Error 15". [131005050040] |(1) Using Ext2explore in Windows, I can see the following partition structure: [131005050050] |(2) Using fdisk in an ArchLinux live cd, I can see this: [131005050060] |(3) I tried to do "fdisk /dev/sda/" then the commands x, f, w to correct error, but fdisk says my partitions' "ordering is correct already" [131005050070] |(4) Using the root and setup commands in the GRUB shell also ended in failure (it tells me it can't find GRUB files, /boot/grub/, etc. etc.). [131005050080] |Specifically, I tried "root (hd0,1)", then "setup (hd0)", (also hd0,0, hd0,2, etc.), all failed. [131005050090] |Is there any hope of restoring my system? [131005050100] |Thanks for your help. [131005050110] |P.S. here is my menu.lst, which can be seen in Ext2explore: [131005050120] |I tried the solution provided in the first answer, but failed with the following output: Also notice that menu.lst is not there, even though it appeared when I examined the partition in Ext2explore. [131005050130] |Also, here are the contents of /etc/fstab: [131005060010] |Boot from your ArchLinux live cd again and in a command prompt as root run the exact following. [131005060020] |Depending on what you did trying to setup autofs, you might want to check that /etc/fstab or /boot/grub/menu.lst files are valid while you are chrooted in your system (after mount /proc above). [131005060030] |There is also one more (shorter) way this can be done. [131005060040] |Not sure if it is possible with the archlinux live cd, but probably is. [131005070010] |Are certain parts of startup scripts necessary or just good practice? [131005070020] |I'm currently exploring creating a startup script in the form of a system process located in the /etc/init.d/ on my Fedora 14 Linux installation. [131005070030] |It sounds like the following two lines are bare minimum requirements? [131005070040] |What's the purpose of these lines? [131005070050] |Is there a good resource that would help me understand how to better create these and other header lines for such a file? [131005080010] |Look at the docs file /usr/share/doc/initscripts-*/sysvinitfiles (On current F14, /usr/share/doc/initscripts-9.12.1/sysvinitfiles). [131005080020] |There's further documentation here: http://fedoraproject.org/wiki/Packaging/SysVInitScript. [131005080030] |The chkconfig line defines which runlevels the service will start in by default (if any), and where in the startup process they'll be ordered. [131005080040] |And, note that this all becomes obsolete with Fedora 15 and systemd. [131005090010] |The first line is the "she-bang" and is used to execute the script without having to pass it as an argument to a shell command line. [131005090020] |The second line is a comment and is understood only by the chkconfig program. [131005090030] |It is used to ensure the script will start on a specific run-level. [131005100010] |How can I print lines from file backwards (without using "tac")? [131005100020] |Hello! [131005100030] |I have a simple question (I think). [131005100040] |I want to print lines from a file backwards without using "tac" command. [131005100050] |Is there any other solution to do such thing with bash? [131005100060] |Thanks! [131005110010] |You can pipe it through: [131005110020] |The awk prefixes each line with the line number followed by a space. [131005110030] |The sort reverses the order of the lines by sorting on the first field (line number) in reverse order, numeric style. [131005110040] |And the sed strips off the line numbers. [131005110050] |The following example shows this in action: [131005110060] |It outputs: [131005120010] |Using sed to emulate tac: [131005130010] |In perl: [131005130020] |cat | perl -ne 'while(<>) { push @a, $_; } foreach (reverse(@a)) { print; }' [131005140010] |awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }' file.txt [131005140020] |via awk one liners [131005150010] |As you asked to do it in bash, here is a solution that doesn't make use of awk, sed or perl, just a bash function: [131005150020] |The output of [131005150030] |is [131005150040] |As expected. [131005160010] |Setting DHCP lease time to very small time increases security? [131005160020] |Yes or No? :O [131005160030] |And why? [131005170010] |Name resolution issues in Ubuntu 10.04 [131005170020] |I am having an error with name resolution that I am not able to figure out. [131005170030] |The system is able to resolve names, say, www.google.com when using a graphical browser like chrome or firefox. [131005170040] |But on the command line it is not able to (unless I add the domain in /etc/hosts). [131005170050] |This extends to all operations on the command line like ping and others. [131005170060] |We have a proxy in this environment and the proxy information is set using environment variables. [131005170070] |ETA: [131005170080] |I noticed that it does seem to resolve IP addresses but it is still not able to reach them. [131005170090] |This makes it even more perplexing. [131005170100] |pinging www.google.com fails. [131005180010] |In this case the domain resolution is not done in your browser, but in the proxy server. [131005180020] |The command line, and all other "local" programs, rely on the domain resolution capabilities of your OS, unless you use lynx with a proxy configured, of course. [131005190010] |I have had issues with mdns4_minimal in /etc/nsswitch.conf and would suggest testing removing that [131005200010] |How can I monitor disk I/O in a particular directory? [131005200020] |I've got a few processes with a known name that all write to files in a single directory. [131005200030] |I'd like to log the number of disk block reads and writes over a period (not just file access) to test whether a parameter change reduces the amount of I/O significantly. [131005200040] |I'm currently using iostat -d -p, but that is limited to the whole partition. [131005210010] |You can use inotifywait -m DIRNAME from the inotify-tools. [131005220010] |I don't think there's a direct way. [131005220020] |One way to get the data you want would be to access the directory tree through a virtual filesystem that logs accesses. [131005220030] |Loggedfs is one such filesystem, though I don't know if it can show all the data you're interested in. [131005220040] |(If not it would probably be a modest coding effort to that data.) [131005230010] |I realize this is going to sound both simplistic and absurd,but... if you have control over the apps in question (maybe in a test environment) you could mount ONLY that directory on a partition of its on, then. iostat, etc would tell you only about it, and nothing else on that spot. [131005230020] |If there are physical drives involved you could fake it up with a loop back mount ala [131005230030] |that would not completely remove all competing disk I/O, but I'm pretty sure iostat's output would be more specific to your need. [131005240010] |Google Chrome on OpenBSD [131005240020] |How can I install Google Chrome on OpenBSD? [131005250010] |Chrome has been in OpenBSD's ports tree since at least OpenBSD 4.8. [131005250020] |Should do the trick, assuming your PKG_PATH environment variable is properly set. [131005250030] |For more information on ports/packages, see here: OpenBSD Packages and Ports System [131005270010] |How do I find how long ago a Linux system was installed? [131005270020] |How can I find the time since a Linux system was first installed, provided that nobody has tried to hide it? [131005280010] |As requested by OP. [131005280020] |If you are looking for the time, when the system was setup, there isn't a way to determine that. [131005280030] |For one, the system might have been cloned (not installed) which would effectively fake the file creation time. [131005280040] |You can estimate the age by searching for oldest files. [131005290010] |There are a few dates lying around. [131005290020] |
  • All files have dates.
  • [131005290030] |
  • Log files have dates in them.
  • [131005290040] |see /var/log/installer/syslog for the definitive answer if it exists it is part of the log of the instillation. [131005290050] |But beware this is not guaranteed. (see other answers/comments for some of the reasons it may not work.) [131005300010] |In Fedora, anaconda installer stores the config details of your install in root's home folder, that can give you some idea. [131005310010] |Check the date of the root filesystem with dumpe2fs. [131005310020] |I can't really think of how that could be anything other than the date you're looking for: [131005320010] |This will tell you when file system was created. [131005330010] |ls -alct /root -> root home directory is created at install time [131005340010] |I look at the oldest file in /boot (top of "ls -ltr /boot". [131005340020] |Often there is an original boot sector from the first install there. [131005340030] |On my oldest system this gives the date of original installation, despite having replaced everything in the machine and copied the contents of the file system around a few times :) [131005350010] |How to export/extract audio from a DVD under Fedora 14? [131005350020] |i have a DVD's content on my HDD: i have these 2 usually folders, ok: [131005350030] |AUDIO_TS VIDEO_TS [131005350040] |I just can't google a working way to extract the audio from the DVD. the howtos usually write about when the dvd is in the ODD. but i have it on my HDD, and don't want to burn it to a dvd (there are several dvd's exactly). [131005350050] |Are there any good way to extract the audio part from the DVD? [131005350060] |my original problem is that i want to convert them to h263 "AVI". [131005350070] |But theres no sound when i open them with avidemux. but: i can import sound files to avidemux, if i had them. [131005360010] |mplayer dvd://1 -dvd-device /path/to/copy_on_hdd/ -dumpaudio -dumpfile audio.ac3 [131005370010] |Why does `last` show '{' and '|' in the TTY field? [131005370020] |We recently set up a new FreeBSD 7.2 machine on March 11. [131005370030] |When looking at last, we noticed some funny characters for the TTY field. [131005370040] |What do these characters mean? [131005370050] |Note that at this time, the sysadmin was battling with NTP. [131005370060] |And according to man last, I can specify the tty using -t tty: [131005380010] |From utmp(5): [131005380020] |So the I and { are just there to indicate that the system time is being changed. [131005390010] |make --print-data-base unknown failure [131005390020] |Running a simple [131005390030] |, I always get an error from one of the subdirectories that has a makefile: [131005390040] |I know --question returns exit code 1 if the directory is not up to date, but that is not the issue - Other directories which are not up to date do not get listed like this in the output. [131005390050] |The usual exit code of the command above is 1 (presumably because of --question), but after the given message it returns 2. Also, strangely, this command does not print anything on standard error: [131005390060] |No amount of debugging seems to entice make to explain what is wrong: [131005390070] |Any ideas what this could be?