Is the shell permitted to optimize out useless terminating commands?

If a shell is asked to perform a probably useless ( _or partially useless_ ) command known to terminate, such as `cat hugeregularfile.txt > /dev/null`, can it skip that command's execution ( _or execute a cheaper equivalent, say,_ `touch -a hugeregularfile.txt`)? More generally, is the shell similar to C compilers in that it may perform any transformation on the source code, so long as the externally observable behaviour is _as-if_ the abstract machine evaluated it? **EDIT** Nota Bene: My question as originally posed had a title that asked whether the shell is _permitted_ to do these optimizations, not whether it should or even whether implementations that can do them exist. I'm interested in the theory more than the practice, although both are welcome.


Mouse is flickering in new debian install

I initially thought this might be a display driver issue but after installing the proprietary ATI drivers and now the free ones I am still getting it. My mouse disappears when I scroll or write sometimes (but not always). It also flickers when I move, especially when I am in the `system settings` menu hovering over icons (it is only visible when I move the mouse, and even then it flickers a lot). I did a search and this seems to be a common problem. This post for ubuntu suggests removing an unknown monitor, but I only have 1 monitor that I can't remove. This post suggests the problem is `unclutter`, which I don't have installed. Besides, the mouse disappearing doesn't seem to be time-related. Any suggestions? I'm new to linux so I don't know what information I should be providing about my system. I'm running Debian Wheezy with a USB mouse. I have tried attaching it to the PC's usb port as well as a USB hub, without any change. It's a fresh install and this problem has existed since the first boot.


zsh adds tab character when autocompleting

I have zsh 4.3.10 installed on a RHEL 6.4 box. I'm not sure why this happens, but when I but `Tab` to autocomplete things, it _also_ adds a tab character. For example:               rocket@rhelbox www % vim    vim     external command     ----------------     vim vimdiff vimtutor      So, when I type `V``I``M``Tab`, after the `Tab` it adds a tab to my console, then finishes the autocomplete action. The command works fine, it's just annoying. I cannot backspace to remove it either. I don't know what's causing this. Here's my `.zshrc`:               # Initialize Autocompletion and Autocorrection     autoload -U compinit promptinit     compinit     promptinit     #prompt redhat     zstyle ':completion:*:descriptions' format '%U%B%d%b%u'     zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'     zstyle ':completion::complete:*' use-cache 1     setopt correctall          # Custom PS1     autoload -U colors && colors     # http://www.understudy.net/custom.html#Z_color     fg_purple=$'\e[0;35m'     #PS1="%n@%m %c %% "     PS1="${fg_purple}%n@%m %{$fg[yellow]%}%c %% %{$reset_color%}"               # cd is automagically added     setopt autocd          # Save History     HISTSIZE=1000     SAVEHIST=1000     HISTFILE=~/.bash_history     setopt hist_ignore_all_dups          # Keybindings     bindkey "^[OH" beginning-of-line     bindkey "^[OF" end-of-line     bindkey '^?' backward-delete-char     bindkey "\e[3~" delete-char          # Aliases     alias ls="ls --color=auto"          # Set (SVN) Editor to vim     export SVN_EDITOR=vim     export EDITOR=vim


How can I access networked filesystems that I've mounted in Nautilus?

I've mounted a networked filesystem in GNOME by clicking on the icon in the left of Nautilus. However, when I use the terminal, I can't figure out how to access that filesystem. Is it possible?


E: Unable to locate package tlp

I an trying to install `tlp` as explained in the website by addin `ppa` as follows in `Linux Mint 15`               sudo add-apt-repository ppa:linrunner/tlp     sudo apt-get update       and then `sudo apt-get update` produces               Hit http://panthema.net precise Release.gpg     Hit http://archive.ubuntu.com raring Release.gpg                                    Hit http://panthema.net precise Release                                             Get:1 http://packages.linuxmint.com olivia Release.gpg [198 B]                      Hit http://security.ubuntu.com raring-security Release.gpg                          Hit http://panthema.net precise/main i386 Packages                                  Hit http://archive.ubuntu.com raring-updates Release.gpg                            Get:2 http://packages.linuxmint.com olivia Release [18.5 kB]                        Hit http://security.ubuntu.com raring-security Release                              Hit http://archive.ubuntu.com raring Release                                        Hit http://security.ubuntu.com raring-security/main i386 Packages                   Hit http://archive.ubuntu.com raring-updates Release                                Get:3 http://packages.linuxmint.com olivia/main i386 Packages [23.5 kB]             Hit http://security.ubuntu.com raring-security/restricted i386 Packages             Hit http://archive.ubuntu.com raring/main i386 Packages                             Hit http://archive.ubuntu.com raring/restricted i386 Packages                       Hit http://security.ubuntu.com raring-security/universe i386 Packages               Get:4 http://packages.linuxmint.com olivia/upstream i386 Packages [9,237 B]         Hit http://archive.ubuntu.com raring/universe i386 Packages                         Hit http://security.ubuntu.com raring-security/multiverse i386 Packages             Get:5 http://packages.linuxmint.com olivia/import i386 Packages [40.1 kB]           Hit http://archive.ubuntu.com raring/multiverse i386 Packages                       Ign http://panthema.net precise/main Translation-en_US                              Hit http://security.ubuntu.com raring-security/main Translation-en                  Ign http://panthema.net precise/main Translation-en                                 Hit http://archive.ubuntu.com raring/main Translation-en                            Hit http://security.ubuntu.com raring-security/multiverse Translation-en            Hit http://security.ubuntu.com raring-security/restricted Translation-en            Hit http://archive.ubuntu.com raring/multiverse Translation-en                      Hit http://security.ubuntu.com raring-security/universe Translation-en              Hit http://archive.ubuntu.com raring/restricted Translation-en                      Hit http://ppa.launchpad.net raring Release.gpg                                     Hit http://ppa.launchpad.net raring Release.gpg                                     Hit http://ppa.launchpad.net raring Release                                         Hit http://archive.ubuntu.com raring/universe Translation-en                        Hit http://ppa.launchpad.net raring Release                                         Hit http://ppa.launchpad.net raring/main Sources                                    Hit http://archive.ubuntu.com raring-updates/main i386 Packages                     Hit http://ppa.launchpad.net raring/main i386 Packages                              Hit http://archive.ubuntu.com raring-updates/restricted i386 Packages               Hit http://ppa.launchpad.net raring/main Sources                                    Hit http://archive.ubuntu.com raring-updates/universe i386 Packages                 Hit http://ppa.launchpad.net raring/main i386 Packages                              Hit http://archive.ubuntu.com raring-updates/multiverse i386 Packages               Hit http://archive.ubuntu.com raring-updates/main Translation-en                    Hit http://archive.ubuntu.com raring-updates/multiverse Translation-en              Hit http://archive.canonical.com raring Release.gpg                                 Hit http://archive.canonical.com raring Release                                     Hit http://archive.canonical.com raring/partner i386 Packages                       Hit http://archive.ubuntu.com raring-updates/restricted Translation-en              Hit http://archive.ubuntu.com raring-updates/universe Translation-en                                                                                Ign http://security.ubuntu.com raring-security/main Translation-en_US                                                                                Ign http://ppa.launchpad.net raring/main Translation-en_US                                                                                Ign http://ppa.launchpad.net raring/main Translation-en                                                                                Ign http://security.ubuntu.com raring-security/multiverse Translation-en_US                                                                                Ign http://ppa.launchpad.net raring/main Translation-en_US                                                                                Ign http://archive.canonical.com raring/partner Translation-en_US                                                                                Ign http://security.ubuntu.com raring-security/restricted Translation-en_US                                                                                Ign http://ppa.launchpad.net raring/main Translation-en                                                                                Ign http://archive.canonical.com raring/partner Translation-en                                                                                Ign http://security.ubuntu.com raring-security/universe Translation-en_US                                                                                Ign http://packages.linuxmint.com olivia/import Translation-en_US                                                                                Ign http://packages.linuxmint.com olivia/import Translation-en     Ign http://packages.linuxmint.com olivia/main Translation-en_US     Ign http://packages.linuxmint.com olivia/main Translation-en     Ign http://packages.linuxmint.com olivia/upstream Translation-en_US     Ign http://packages.linuxmint.com olivia/upstream Translation-en     Ign http://archive.ubuntu.com raring/main Translation-en_US     Ign http://archive.ubuntu.com raring/multiverse Translation-en_US     Ign http://archive.ubuntu.com raring/restricted Translation-en_US     Ign http://archive.ubuntu.com raring/universe Translation-en_US     Ign http://archive.ubuntu.com raring-updates/main Translation-en_US     Ign http://archive.ubuntu.com raring-updates/multiverse Translation-en_US     Ign http://archive.ubuntu.com raring-updates/restricted Translation-en_US     Ign http://archive.ubuntu.com raring-updates/universe Translation-en_US     Fetched 91.6 kB in 20s (4,571 B/s)     Reading package lists... Done      But when I try               sudo apt-get install tlp tlp-rdw       it gives               Reading package lists... Done     Building dependency tree            Reading state information... Done     E: Unable to locate package tlp     E: Unable to locate package tlp-rdw      In `/etc/apt/sources.list.d/linrunner-tlp-raring.list` I have               deb http://ppa.launchpad.net/linrunner/tlp/ubuntu raring main     deb-src http://ppa.launchpad.net/linrunner/tlp/ubuntu raring main


Check `fsck` automatically

I need to run `fsck` so that it automatically fixes problems (i.e., `fsck -y`). And because I am using "systemd" instead of "init" in the linux system, I cannot modify the `/etc/default/rcS`. So what should I do to make this check run automatically?


setcap fo rhel5

A quick question , I am not able to find much info to run `setcap` on `rhel5` . I searched few packages in my system                    # yum install libcap          Loaded plugins: product-id, security, subscription-manager          Updating Red Hat repositories.          Setting up Install Process          Package libcap-1.10-26.x86_64 already installed and latest version          Package libcap-1.10-26.i386 already installed and latest version          Nothing to do      I also searched binary `find / -name setcap` but it is saying there is no `setcap` command .


Arch linux installation problem

I used to work on Arch Linux at my desktop. One year ago I started to use laptop Samsung np530u3b. This laptop has one bootable HDD Hitachi (500gb) and 16gb ssd (so system from this SSD can't be loaded cause SSD is not present in BIOS ). I've been using Fedora Linux for one year and everything worked perfectly. When I've installed fedora, HDD (`/dev/sda`) was bootable and I installed grub there. And many other people installed distros like Fedora or Ubuntu correctly. Nowadays when I've trying to install Arch Linux I have one big problem: laptop can't load grub installed at HDD (`/dev/sda`). The laptop goes to interminable reboot, and grub doesn't load everytime. I installed Arch from Wiki (prepared hard drive, installed `base` and `base-devel`, etc) but laptop's still unusable to work. I tried to use GPT, MBR partition table at laptop but it wasn't the solution. BTW, Samsung np530u3b makes me crying. All UEFI, secure boot, fast boot were turned off. But laptop still cannot load system correctly. Only displaying blank screen without any symbols for ~1 second and reboot after that. What have I done wrong?


How to have Linux wipe/randomize/sanitize RAM at shutdown?

For mysterious reasons I still double boot sometimes into Windows. My problem is that I fear that information may leak because the RAM memory is accessible to Windows. (the Linux partitions are encrypted and the bootmedia is not inserted, though). Is there a way to setup (in a recent kernel and GNU/Linux based system) a way to have the kernel wipe the memory at shutdown? Also since LUKS plays an important role, does it wipe its memory at shutdown to avoid leakage and also "cold boot attack"?


Can not off output by xrandr

I have 2 monitors, one connect by VGA, one connect by HDMI. When I unplug VGA, the status is still "connected". Xrandr cannot off output VGA. Do you resolve this problem?


VMap Fedora 12 equivalent

I'd like to see how Fedora manages the Virtual Memory. I was used to VMap on Windows, however I can't find anything to download on Fedora 12 that could fit my needs. I can't find something like `memstat` for example. Do you happen to know which package I could use? Is there a software I can download on the internet maybe?


How to convert a video file from mp4 to mp2

I have been searching a lot and I can't find a solution. How do you convert a video from MPEG-4 to MPEG-2? That shouldn't be too hard. But the `avconv` man pages don't give enough info to do this right. If I just do               avconv -i input.mp4 output.mpeg      it does create an MPEG-2 file, but it's unwatchable - the image quality is horrible. The size of the file on disk also is about a third of the size of the input file.   So obviously I need to set some parameter to some value that preserves the quality, and that's where the troubles start. I began with trying the `-b` parameter, like so               avconv -i input.mp4 -b 384k output.mpeg      but that didn't really improve things. It was possible to decrease the quality even further, by using a lower number, but higher than 384k always gave me an error. So `-b` is not the right parameter to use, obviously. I tried many other things, and I could post everything here, and the results, what went wrong, which pages I read trying to find the solutions, but that would be a long and boring list of parameters and error messages and frustrations, so I will spare you these. By now I just want to know what I should use to get a decent picture.


I2c with 16 bit addresses

So, i'm trying to interface with a device that has 16-bit addresses, and the master I'm using also supports this mode. However since this isn't standard I2C (should be 8-bit addresses) I haven't been able to use it in Linux. Is there a way to address this device, without re-writing the Linux I2C bus interface driver? P.S I'm able to write to it, just not read from it.


run bash in script

I want to creat a script to run an another script with a several parameter               exp=([1]=bloc [2]=ins [3]=rep [4]=op)     for j in ${!exp[*]}     do         arr=([1]=mem [2]=gen [3]=usr)         for i in ${!arr[*]}         do         var="bash createGnuploat.sh "${exp[j]}" ../Result/ 0" ${arr[i]} ${exp[j]}         $var         done     done      And i have this error :               run.sh: line 9: =bash createGnuploat.sh op ../Result/ 0: Aucun fichier ou dossier de ce type      What's problem please ?


Backing up partition using dd and changing files

I'm a Linux newbie. From what I've read, you can back up an entire partition like this:               dd if=/dev/sda1 of=/media/external/backup      Can anyone tell me if I need to worry about files being changed while doing this? Could it be that some critical system file might get changed during the dd operation and then when you want to restore the backup, it won't work? I'm on Ubuntu 12.04.


printing to "One Single CUPS Server" can not find queues if 'ServerName' is a CNAME

Running "OpenSuSE 11.4" with "cups-client-1.4.6-6.1.i586" installed, I try to use one single CUPS-server to do all my printing jobs / to manage my queues. In **YaST -> printer** I've selected > [x] Do All Printing Directly via One Single CUPS Server and next to the field "name or IP Address" I enter `print` (as a CNAME for our print server), but no queue comes up in main window. If I change the ServerName to print server's hostname `dom-print`, everything works fine and queues are appearing properly. * * * Additional info: nslookup tells the following about `print` ( `x`/`y`/`z` -> yeah, it's all top secret, you know.. ): > Server: 10.0.x.y   >  Address: 10.0.x.y#53   >   >  print.dom.tld canonical name = dom-print.dom.tld.   >  Name: dom-print.dom.tld   >  Address: 10.0.x.z   >


Very basic Linux for educational purposes

I want to play with Linux to better understand how it works. Thus, I am looking for a very basic and small Linux to play with. I tried small Linux distributions (which copy themselves to RAM), but they have their own structure (like Live CD). Instead, I wish to have a minimal but standard Linux structure. I installed minimal version of Debian on USB and setup GRUB to separate this experiment from my main computer. However, Debian (even minimal) is far more advanced than what I need. What is the best method to copy a very minimal version of Linux on USB and boot with GRUB? Each distribution has its own features and options, but I prefer to be closer to the standard Linux (Linux kernel) without customization of a distribution.


How do you change the root password on Debian?

I want to change the password I assigned to root on my Debian webserver to something longer and more secure. Bit of an obvious newbie question, but how do I do that? I haven’t forgotten/lost the current password, I just want to change it.


What params do I pass to grep to return only file names?

I'm trying to use grep to find a specific piece of text in a bunch of files on my web server. No problem, except that it returns way more information than I want! Ideally it would just return a list of files, and if the text exists in more than one place in the file it would only list the file name once. Currently I'm using something like this:               grep -ir essay_ "mysite"      to do a case-insensitive recursive search for the word essay_ in all directories of my site. What it returns is something like this:               mysite/dot/contest_declaration.php:$questions = $db->get_results("SELECT * FROM dot_essay WHERE active = 1 order by display_order asc");     mysite/dot/contest_declaration.php:     $db->query("DELETE FROM dot_essay_xref WHERE entry_id = $svar_entry_id");     mysite/dot/contest_declaration.php:     $id = $question->essay_id;     mysite/dot/contest_declaration.php:     $answer = ${"essay_$id"};     shoppermarketexpo/dot/print_declaration.php:        $questions = $db->get_results("SELECT * FROM dot_essay WHERE active = 1");      What I'd like to get back is:               mysite/dot/contest_declaration.php     mysite/dot/print_declaration.php


chroot jail that can access the filesystem

chroot jails seem to be simply a different world, with no interaction with the actual filesystem. Thus, the entire environment has to be replicated inside the chroot, which would mean making a full installation of a system inside it. However, is there some way to make the chroot jail have read access to the main filesystem? Additionally, I would also like to have the ability of the chroot preferring its own files. For example, if `/usr/bin/wget` exists within it, then that should be preferred over the system's `/usr/bin/wget`. (I'm actually looking for something that behaves like Sandboxie.) Is the above feasible?


merge pcap files

I'm trying to merge 15 pcap files using wireshark. The merging is successful. I'm using appending function so that the second file is just added to the bottom of the first file. But when this is done, I get -ve value in time column. How can I change this? What I intend to do is, replace these 15 smaller files with this one merged files. ![enter image description here](http://i.stack.imgur.com/BnfzO.png)


How can I search history with what is already entered at the prompt in zsh?

In zsh, I know that I can search history with `Ctrl`+`r`. However, oftentimes I start to type a command directly at the prompt, but then realize I should be searching history. When I hit `Ctrl`+`r`, it brings up a blank history search prompt like this: ![history search prompt not pre-filled](http://i.stack.imgur.com/BbABO.jpg) Notice how there is text at my prompt but not at the history search prompt. How do I start the history search with the text already in the prompt, so it looks like this: ![history search prompt pre-filled](http://i.stack.imgur.com/D012k.jpg)


Cannot authenticate Admin account in Linux Mint

On the "User Accounts" settings in Linux Mint, I changed the settings so that the Admin account didn't require a password. To change any settings I have to click the unlock button and type in a password. However, as I removed the password for the only account I now cannot change the settings. How can this be fixed?


PPTP server with NIC aliases

I have set up a VPN on a VPS Server using PPTP. I have one NIC with two aliases.   * eth0   * eth0:1   * eth0:2 The 3 interfaces have public addresses. `eth0` is a French IP, `eth0:1` is UK, and `eth0:2` is American. I have tried configuring IP forwarding and IPtables, but the users traffic is always routed to `eth0`. When I set up a user to use `eth0:1` to use the UK IP, the user was able to connect but there is no traffic. I want to be able to assign a user to an interface that they might use to access a specific service.


tar files from another directory without copying them

This should be very simple for experts in here. I have a Linux account with user disk quota of only 6GB. There is some data- folder in `/opt` with about 3GB of data with when compressed comes up 1GB. There are some symbolic links within `data-folder`. Usually for taking a work backup I used to do the following.               cp -rvfL /opt/data-folder ~/     cd ~/     tar -zcvf data-folder.tar.gz data-folder     rm -rvf data-folder      Now I have already consumed 2.5GB in my user disk quota, I have just enough space to copy files to my home, but not to `tar` it again. Is there any way to tar and copy the folder with in a single command, say by using a pipe. P.S. I cannot tar in `/opt` because I have only read access to `/opt`.


Configure reboot on Linux kernel panic

You can put "panic=N" on the kernel command line to make the system reboot N seconds after a panic. Is there a config option to specify this (other than the default kernel command line option)?


Center Mutt pager horizontally

Is there a way to horizontally center emails when reading them in a larger terminal using mutt? I'm not interested in centered justification of the text in the email, but I am interested in forcing the block of text to be left- aligned, 78 characters wide and centered in a 120 character terminal. For example, right now I have something that looks roughly like this:               +------------------------------------------------------------------------------+     | This is an email displayed in mutt.                                          |     | Let's say it's 78 characters wide,                                           |     | even though it's clearly not.  Let's                                         |     | also pretend that the width of this                                          |     | box is 120 characters, which is                                              |     | also not true.                                                               |     +------------------------------------------------------------------------------+      Is there a way to configure mutt's pager so that it looks closer to something like this:               +------------------------------------------------------------------------------+     |                     This is roughly centered text that's                     |     |                     left-aligned and (let's pretend) also                    |     |                     78 characters wide.  I'm not worried                     |     |                     about perfection as much as I am just                    |     |                     getting the text closer to the middle                    |     |                     of the screen.                                           |     +------------------------------------------------------------------------------+      I've searched the standard documentation, but I haven't found anything. Should I use something other than the default pager to get this effect?


Bash globbing of multi-part argument

Below are some examples of a `find` command I'm trying to run. I'm looking for different ways that I might be able to use globbing to generate (as an example) a find command with predicates joined together. Doesn't work because `find` needs a -name before each one and a -o between each.               find . -name \*.{sh,pl,sql}     #find . -name *.sh *.pl *.sql      Doesn't work because of trailing `-o`. Could pull a guaranteed to fail argument there, but not ideal. Also, my shortcut is now longer than my output.               find . `for X in {sh,pl,sql}; do echo -name \\\*.$X -o ;done`     #find . -name \*.sh -o -name \*.pl -o -name \*.sql -o      Fails because they're grouped as one argument (`find: unknown predicate '-name *.sh'`). Also, still exhibiting a lack of joining with -o.               find . -name\ \*.{sh,pl,sql}      Works, but doesn't involve globbing (re: non-answer):               find .  -regex '.*\(sh\|pl\|sql\)'


How can I tunnel traffic for a NATted host to another server?

I have a device on my private network which I don't wish to allow to directly access the internet from my gateway. Instead, I want to tunnel that traffic from my gateway to another server (also mine) and have the traffic appear to originate there. My gateway is a smoothwall firewall and the other server is a ubuntu server. I'm hoping there's a solution that will divert all traffic from a given MAC through the tunnel to the remote server... but any solution that will accomplish this is welcome.


learning to output custom rsyslogs

I've installed `rsyslog`. I want to log why my server is refusing to show my index page in the browser in               /var/log/browser.log      Should it be listening on a standard port? I can see `netstat -tpan`. To be frank I need a good tutorial to set this up with editing `rsyslog.conf` as I am more familiar with coding than SSH Unix commands. * * * The logs error and access were handled by `virtualmin`. I uninstalled `virtualmin`, so that I could learn how to secure the server with pure config files. Running `yum list installed` shows `httpd-tools.x86_64` highlighted in yellow as well as the webpage not being available - `ERR_CONNECTION_REFUSED`.


How to insert text after a certain string in a file?

Right now I'm using `echo "Hello World" >> file.txt` to append some text to a file but I also need to add text below a certain string let's say "[option]", is it possible with `sed`? EG: Input file               Some text     Random     [option]     Some stuff      Output file               Some text     Random     [option]     *inserted text*     Some stuff


What permissions should I set for an executable I'm likely to share?

I'm writing a bash script that does a little house-cleaning for me (clearing the log files from any Rails projects in the current directory). I'm making it executable, and I'm not sure what best practice dictates as far as setting the "group" and "others" file permissions. Should I just set permissions to 700 (only the owner can rwx)? Part of my confusion is how "ownership" is determined when a file is copied from one system to another. If my UID is 509 and I set `my_file.sh` file- permissions to 700, I'm guessing the file-ownership is determined by storing a UID on the file. If I share `my_file.sh` and someone downloads it to their system, does the UID get changed to match their own? Does it depend on how the file is transferred (scp, git, http, etc.)?


Preparing a Linux image in a virtual machine

I am trying to set up a system to prepare a Linux system on a virtual machine and then deploy it onto an SD card. The target system has an Atom processor, so there aren't architecture compatibility concerns. **Do any of the mount points have to be in a special, physical location for this to work or can GRUB grok the filesystem?** **How do I set up the SD card to boot this system using GRUB?** Would it be better to rsync the filesystem over or dd a filesystem image? I much prefer the former because I don't have to change my VM much when going between different card sizes. EDIT: I assume that I'll have to prepare the card before hand using something like parted, then I'll have to install GRUB to it, which isn't a big deal. The major question is, **will GRUB find the kernel if it isn't in a guaranteed, physical place on the partition?** In other words, is GRUB smart enough to read an ext2, ext3, or ext4 partition and find the appropriate mount points? My disk will look something like this (2 partitions): [GRUB] [grub loader stuff] [GRUB partition] [OS partition]


Can gdb debug suid root programs?

I wrote a program that calls `setuid(0)` and `execve("/bin/bash",NULL,NULL)`. Then I did `chown root:root a.out && chmod +s a.out` When I execute `./a.out` I get a root shell. However when I do `gdb a.out` it starts the process as normal user, and launches a user shell. So... can I debug a setuid root program?


Bonding wireless and 3g on Fedora 15

I have access to the internet through either wireless or a 3G CDMA card. Is it possible to bond both connections and join the bandiwdth and have a failover?


What's the standard used by yum prompt "Is this ok [y/N]:"?

I can see that uppercase letter means default here. Is there a standard for this? I'd like to read the full standards.


Corosync & Pacemaker IPTables Rules

When using Corosync with two rings via multi-cast addresses 226.94.1.1 (Port 5405) & 226.94.1.2 (Port 5406) what iptables rules are required to allow two nodes to communicate optimally without giving any undue access and making the rules too lenient? I currently have:               iptables -A INPUT -p udp -m multiport --dports 5404,5405,5406 -j ACCEPT      Will that allow all the communication a Corosync/Pacemaker setup requires for both rings? I have heard arguments that something like:               iptables -I INPUT 1 -m pkttype --pkt-type multicast -j ACCEPT      is required. However I cannot seem to replicate a situation where this assists if the first rule I listed above is already in place. The Red Hat documentation would seem to support the first approach. There is some IBM documentation espousing the second but is it just a case of a rule that is far too lenient when the first would do the job equally well whilst leaving no unnecessary ports open? I'm leaning more towards the first rule being sufficient but wanted to get some more opinions on the matter.


How to show the CUPS printer jobs history?

I am printing some files from a remote computer to a network printer with the lpr command. It apparently worked, but some minutes later when I typed lpstat or lpq, the job had already disappeared, it had probably already printed the file. Is there a way to check the history or the log of my successfully completed jobs in the printer queue?


Newly compiled kernel not booting up (vanilla kernel 3.12.14)

I downloaded, configured and installed kernel downloaded from kernel.org. While booting up this new kernel for the first time, this error screen shows which is pointing towards a missing or wrongly mentioned root device probably. But I didn't mention it explicitly, installation scripts did it. So if this is the error, can someone please tell how to fix? Or if the cause may be something else, please tell what it can be? NOTE: I am using VirtualBox for all this process. Don't want my laptop to become unbootable for this experiment.![enter image description here](http://i.stack.imgur.com/pqPMi.jpg) NOTES:   1. Grub entries are fine, as it is same for another kernel running on this system and other kernel is working fine.   2. DEVTMPS is just creating a warning, I think programmers care about errors only, not warnings, so hopefully this is not the major cause as well.   3. TSC is giving an error, I investigated, it is probably a clock mode, nothing very related to root device.   4. Again UUID is not an issue, because other working kernel grub entry is using same ID and booting up correctly.


Blurry image between Radeon / DVI-to-HDMI / LG LCD monitor

I've got an ATI Radeon (not sure exact card; forgot to write it down when I left this morning; will update when I get back) and it is connected to an LG IPS237L 23" IPS LED monitor. As you can seen in the xrandr output below, the resolution is currently set to 1920x1080. The monitor's information panel indicates this as well. The auto- adjustment is disabled as it's connected via HDMI, so the only thing I can really adjust is turning the over-scan on. It helps a little, but the text is still blocky and the output doesn't extend to the end of the screen. It's almost as if 1920x1080 wasn't the monitor native resolution, but everything I've found on the monitor indicates that is the native resolution. I'm using a DVI-HDMI cable, but that really shouldn't make any difference since they both use the same TMDS protocol. What am I missing here? ![Photo of Screen](http://i.stack.imgur.com/mMqGL.jpg)


Where is the cron information stored on my gentoo system?

I have a Linux gentoo system, which performs a cronjob every day at 3:10 in the morning. However, no file in `/etc` contains any related information to this particular cronjob, and the result of `crontab -l` is               # check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly     MAILTO=""     0  *  * * * rm -f /var/spool/cron/lastrun/cron.hourly     1  3  * * * rm -f /var/spool/cron/lastrun/cron.daily     15 4  * * 6 rm -f /var/spool/cron/lastrun/cron.weekly     30 5  1 * * rm -f /var/spool/cron/lastrun/cron.monthly     */10 * * * * test -x /usr/sbin/run-crons && /usr/sbin/run-crons      The directory `/etc/cron.daily` probably contains the job in question, but for a time at 3:01! Why is that? Is the actual cronjobn stored somewhere else? Does it take gentoo 9 minutes to realize to execute a job? Additional information:   * I have a different crontab job for 13:20 (in cron.d) which is executed exactly at 13:20 every day.


How to batch convert bitmaps to SVGs?

I have many gray scale bitmaps that I need to convert to a vector format, such as SVG. I have been using Inkscape, which gives nice results, but this takes about 10-15 minutes to open, convert, and save a file. Is there a batch or command line tool that can convert these?


Manage only a section of a config file with Puppet (multiline file_line)

There is a config file e.g. /etc/network/interfaces. I want to manage only a certain section of that file using Puppet. Example:               # At the beginning at least is some dynamic content that can be different     # from machine to machine and changed by an admin manually     auto eth0     iface eth0 inet static         address 192.168.108.5         netmask 255.255.255.0          # BEGIN PUPPET WLAN0     allow-hotplug wlan0     iface wlan0 inet static         address 192.168.109.5         netmask 255.255.255.0     # END PUPPET WLAN0          # Potentially more stuff that I do not want to touch through Puppet     # But could be static if it makes it more easy. E.g. simply force sections to end of file.      The stdlib file_line resource is very close to what I need. A regex and content to replace a match with. However, unfortunately, there is no way to make file_line match over multiple lines and replace with new content. Alternative 1: create a bash script: ugly Exec resources and temp files. Alternaitve 2: Use Augeas: seems overkill for a simple search & replace. Is there another module than stdlib that allows me to do a regex match & replace over multiple lines? Any other handcraft solutions better than juggling temp bash script and Exec resource?


Asrock H61M-ITX sensors

I just installed a small home server with Ubuntu 12.04.01 but I have a problem with the fan that run on full all the time. The server specs are:   Linkworld Mini ITX 920-01   Asrock H61M-ITX mITX USB3 SATA6   i3 2120 3.3Ghz 3MB Output from `sensors` shows               $ sensors     coretemp-isa-0000     Adapter: ISA adapter     Physical id 0:  +41.0°C  (high = +82.0°C, crit = +102.0°C)     Core 0:         +41.0°C  (high = +82.0°C, crit = +102.0°C)     Core 1:         +41.0°C  (high = +82.0°C, crit = +102.0°C)          nct6776-isa-0290     Adapter: ISA adapter     Vcore:         +0.97 V  (min =  +0.00 V, max =  +1.74 V)     in1:           +0.22 V  (min =  +0.00 V, max =  +0.00 V)  ALARM     AVCC:          +3.44 V  (min =  +2.98 V, max =  +3.63 V)     +3.3V:         +3.42 V  (min =  +2.98 V, max =  +3.63 V)     in4:           +0.55 V  (min =  +0.00 V, max =  +0.00 V)  ALARM     in5:           +1.74 V  (min =  +0.00 V, max =  +0.00 V)  ALARM     3VSB:          +3.42 V  (min =  +2.98 V, max =  +3.63 V)     Vbat:          +3.49 V  (min =  +2.70 V, max =  +3.30 V)  ALARM     fan1:            0 RPM  (min =    0 RPM)  ALARM     fan2:         2673 RPM  (min =    0 RPM)  ALARM     fan3:            0 RPM  (min =    0 RPM)  ALARM     fan4:            0 RPM  (min =    0 RPM)  ALARM     fan5:            0 RPM  (min =    0 RPM)  ALARM     SYSTIN:        +39.0°C  (high =  +0.0°C, hyst =  +0.0°C)  ALARM  sensor = thermistor     CPUTIN:       +127.5°C  (high = +80.0°C, hyst = +75.0°C)  ALARM  sensor = thermistor     AUXTIN:        -35.5°C  (high = +80.0°C, hyst = +75.0°C)  sensor = thermistor     PECI Agent 0:  +40.5°C       cpu0_vid:     +0.000 V     intrusion0:   ALARM     intrusion1:   ALARM      Anyone with same motherboard that knows if its possible to config so Ubuntu can control my fans according to the temperature.


Executing a script from Nagios event handler fails to run

I have Nagios running on a webserver. For this one Nagios service check in particular, if it fails, it will run a script. This script is triggered via Nagios event handlers. Nagios event handler command:               define command{             command_name    testDisableServer             command_line    /usr/local/nagios/etc/objects/event_handlers/testDisableServer.sh     }      I am executing a script called testDisableServer.sh from Nagios event handlers that looks like this:               #!/bin/bash     wall "Script execution started";     /usr/bin/sudo /root/scripts/disableServer.sh force      This script 'testDisableServer.sh' has the following permissions:               -rwxr-xr-x 1 nagios nagios 2.0K Oct 12 14:57 testDisableServer.sh      When the service goes down, I will get a wall post in my SSH connection saying "Script execution started", but it will not trigger my disableServer.sh script. I tried to place another wall post inside of disableServer.sh and it did not trigger it. This script is being run by the user 'nagios'. 'nagios' was added in visudo, as such:               nagios  ALL=(ALL)NOPASSWD:/root/scripts/disableServer.sh      Running this script as the user 'nagios' from a command line works perfectly fine. However, when the event handler triggers it, there is no output. I tried to catch the output into a log file, and I came up with nothing. These are the permissions on /root/scripts/disableServer.sh:               -rwxr-xr-x   1 root root 2.0K Oct 12 15:01 disableServer.sh      Why would the event handler hit 'testDisableServer.sh', but not execute 'disableServer.sh' from a Nagios event handler, but work just fine in an SSH connection as the user nagios? BTW, 'testDisableServer.sh' is just an extra layer added to see if the event handlers were working, which they seem to be. This will be removed after this script execution is all sorted out.


Install Fedora20 on external HD

I've been trying to install Fedora20 on my external HD, but have run into problems. Somehow I cannot choose the hard disk to install Fedora. Here is what I've done: First, I went and downloaded the .iso file from fedoraproject.org, then I erased my external HD and partitioned it (this all happened on windows 8). The external HD now has two partitions and some free space that I left alone. Of the initial 500GB, I now have partitioned   * 1GB to boot Fedora   * 370GB for general use   * 128GB left alone, unformatted Booting Fedora from the ext. HD worked fine. So I tried to _install to hard drive_. That also works fine until I have to specify where to install Fedora. At this point I am shown the following disks ![enter image description here](http://i.stack.imgur.com/O9bjM.png) which shows my external HD as having 128GB free. But then I check that disk and press 'done', suddenly the following pops up ![enter image description here](http://i.stack.imgur.com/J5Fhx.png) with 0B of free space and 0B of reclaimable space?? When I go to 'custom partitioning' and try to automatically set mount points, then I obtain an error message ![enter image description here](http://i.stack.imgur.com/foPfO.png) What am I doing wrong? What should I do instead?


Specifying ciphers and protocol 2 in .ssh/config

I would like to be able to specify in my `.ssh/config` file that ssh uses protocol 2 (command line argument `-2`), and which ciphers to use with it. The following does not seem to work (I get bad configuration option: `Cyphers`)               Host XXX         HostName YYYY         User ZZZZ         Compression no         Cyphers arcfour,blowfish-cbc         ControlPath ~/.ssh/%r@%h:%p         IdentityFile ~/.ssh/seas/id_rsa      Also, how do I know which version of ssh (or OpenSSH) I am using? `which ssh` or `man ssh` does not reveal much information.


Output some sections of a text file

I have input like the following:               >gi|481443199|gb|MH447771.1|     49      0       0       0       1     50      0       0       1       0     >gi|987078004|gb|RTYJ01067061.1|     412     0       0       1       0     413     1       0       0       0     >gi|557075006|gb|ERTJ01078061.1|     41     0       0       1       0     41     1       0       0       0     >gi|787073002|gb|WERJ01045061.1|     612     0       0       1       0     613     1       0       0       0     >gi|887079001|gb|WERJ01045061.1|     715     0       0       1       0     716     1       0       0       0      I want to print some lines, but skip every other line that starts with `>` (along with all the lines after it, until the subsequent `>`). For the example input above, the output would be:               >gi|481443199|gb|MH447771.1|     49      0       0       0       1     50      0       0       1       0     >gi|557075006|gb|ERTJ01078061.1|     41     0       0       1       0     41     1       0       0       0     >gi|887079001|gb|WERJ01045061.1|     715     0       0       1       0     716     1       0       0       0      How can I do that?


Break down a pcap file into individual flows and modify them

I have a pcap file and I want to:   1. separate every flow   2. separate responses and requests in each flow   3. modify ip and port in some packets   4. reply packets Is there any utility in linux that helps me for do this?


Launch a program on boot (Debian server)

Path to folder: `root/CumulusServer` Command to execute: `./CumulusServer --daemon [--pidfile=/var/run/CumulusServer.pid]` I've spent considerable time trying to figure out how to modify `init.d`? Any help would be appreciated in resolving this issue. * * * Errors:               [FAILED] cd /root/CumulusServer | ./CumulusServer --daemon [--pidfile=/var/run/CumulusServer.pid] to /etc/rc.local          [FAILED] /root/CumulusServer | ./CumulusServer --daemon [--pidfile=/var/run/CumulusServer.pid] to /etc/rc.local          [FAILED] cd /root/CumulusServer && ./CumulusServer --daemon


Is it safe to remove a script file from within that script?

Imagine I have a script `foo`. It should be run once when the user logs in and isn't needed after a successful run. My question: Is it safe to remove the script file from within the script? E.g.:               #!/bin/bash          # do something     ...          # if successful     rm /path/to/foo     exit 0


"Could not connect to display" in one user account

I have a GUI application written in Qt and I wanted to run tests by ssh (or Jenkins). There is only one user account, which allows to run it in display mode (ofc when I previously do "export $DISPLAY=:0". On other user, jenkins, I see a nerror:               QXcbConnection: Could not connect to display :0      Aborted (core dumped)      What should I do to allow this user to run applications in graphical mode? I use Ubuntu 14.04.


Redhat subscriptions - synchronise subscriptions

I have inherited a system admin role of a small cluster of redhat machines - most running rhel5 and one machine running rhel6. My sys admin skills are at the moment poor but I would like to improve things. Looking at the CLASSIC SUBSCRIPTION MANAGEMENT System List page (https://rhn.redhat.com/rhn/systems/SystemList.do) for our cluster I am met by the following mess               Updates Errata  Packages    System  Base Channel    Entitlement              319     205     blue1   Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              127     105     bobcat  Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              30      12      cheetah Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              38      19      cougar  Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              137     113     forth   Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              75      44      fox     Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              311     203     jaguar  Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              314     237     leopard Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              25      4       lion    Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              318     200     lynx    Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              312     203     ocelot  Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              65      87      panther Red Hat Enterprise Linux Workstation (v. 6 for x86_64)  Management              25      4       puma    Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              320     194     red1    Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              30      12      serval  Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)   Management              57      32      tiger   Red Hat Enterprise Linux Desktop (v. 5 for 64-bit x86_64)         Basically I have a red warning system on each machine with different numbers of errata and packages missing. What is the best way to normalise subsriptions and packages installed on each system to stop such divergences in the future? Any links on how to properly manage subscriptions / system administrate. I'm in at the deep end at the moment. Best way to learn I guess


cannot ping vagrant machine

My experience with vagrant is very little as most of the time is seems to work. In this case however, I have not been able to get the desired behaviour. I am trying to work on a rails application and it comes with its own Vagrantfile. While I can acess the machine via ssh I am unable to ping the machine or access the rails application running on port 80 on the vm. Btw, I am running Vagrant 1.6.3 and VirtualBox 4.1.3 on an archlinux machine. I would really appreciate it if someone can point me in the right direction.


oh-my-zsh theme doesn't seem to update unless I re-launch zsh

I've begun making my own `oh-my-zsh` theme, but I've run into a bit of a problem. I'm trying to change the color of the git output based on the name of the branch, and it works fine except for one important caveat: it changes the color to the correct one when `zsh` launches, but never re-evaluates what the color should be unless I re-launch `zsh`. Here's a screenshot of the problem in action: ![Screenshot of the problem](http://i.imgur.com/uuzmMwu.png) Here's a gist with my current `zsh` theme. Am I doing something wrong, or does `oh-my-zsh` or `zsh` not support this kind of thing?


How to configure a filesystem+LVM for effective usage of SSD?

ext4 is one of the filesystems recommended for using on SSDs (with a number of built-in techniques and advices how to tune it for better performance and wear-levelling of SSDs). I want to install a Linux system onto an SSD, and I'm going to use ext4, because it is the better tested FS (I don't want to use the more experimetal btrfs). But what if I add LVM between ext4 and SSD? Will the performance and wear- levelling tweaks for ext4 loose their effect? (Because LVM would hide the actual disk layout from the FS.) Can LVM be configured so that it will use the SSD features effectively? (I want to use LVM to able to have snapshots of older states of the system, as well as for more flexibility with the sizes of the partitions.)


How to set up a script to run as root non-interactively?

I need to set up the following script to run _as root_ whenever I log in:               #!/bin/zsh     truncate -s 0 ~yourstruly/.juniper_networks/network_connect/ncsvc.log      I know how to run the script as root interactively (namely through `sudo`), but I can't figure out how to make the script run as root _non-interactively_ whenever I log in. How can I do this? FWIW: the script is currently owned by root, has permissions 6755, and the file to be truncated is also owned by root and has permissions 0644, but when I run the script, the call to `truncate` fails with a "Permission denied" error.


How to setup dualview without restart X11

I'm using latest ArchLinux with dual monitor, but my second monitor is not detected               $ lspci | grep VGA     00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Richland [Radeon HD 8570D]          $ pacman -Q | grep xorg-server     xorg-server 1.15.1-1     xorg-server-common 1.15.1-1     xorg-server-utils 7.6-3          $ pacman -Q | grep catalyst     catalyst-hook 14.4-10     catalyst-libgl 14.4-11     catalyst-utils 14.4-10     lib32-catalyst-utils 14.4-11     lib32-opencl-catalyst 14.4-10     opencl-catalyst 14.4-10          $ cat /etc/X11/xorg.conf     Section "ServerLayout"             Identifier     "aticonfig Layout"             Screen      0  "aticonfig-Screen[0]-0" 0 0     EndSection          Section "Module"     EndSection          Section "Monitor"             Identifier   "aticonfig-Monitor[0]-0"             Option      "VendorName" "ATI Proprietary Driver"             Option      "ModelName" "Generic Autodetecting Monitor"             Option      "DPMS" "true"     EndSection          Section "Device"             Identifier  "aticonfig-Device[0]-0"             Driver      "fglrx"             BusID       "PCI:0@0:1:0"     EndSection          Section "Screen"             Identifier "aticonfig-Screen[0]-0"             Device     "aticonfig-Device[0]-0"             Monitor    "aticonfig-Monitor[0]-0"             DefaultDepth     24             SubSection "Display"                     Viewport   0 0                     Depth     24                     Modes    "1280x1024"             EndSubSection     EndSection          $ xrandr -q     Screen 0: minimum 320 x 200, current 1600 x 900, maximum 16384 x 16384     DFP1 disconnected (normal left inverted right x axis y axis)     CRT1 connected 1600x900+0+0 (normal left inverted right x axis y axis) 434mm x 236mm        1280x1024     75.02 +  60.02          1600x900      60.00*+        1440x900      60.00          1280x960      75.02    60.02          1280x768      75.02    60.02          1280x720      60.00          1024x768      75.03    70.07    60.00          1024x600      75.03    70.07    60.00          800x600       72.19    75.00    60.32    56.25          800x480       72.19    75.00    60.32    56.25          640x480       75.00    72.81    67.00    59.94            $ xrandr --output CRT1 --mode 1600x900 --output DFP1 --mode 1366x768 --right-of CRT1     xrandr: cannot find mode 1366x768      The question:   1. How to fill xorg.conf when I don't know which BusID to put (I'm using onboard graphic card), the current display are the VGA/D-Sub port, the other one is DVI-D/24+1 port --> the one that new monitor plugged in   2. What should I really put when I need horizontal span on my first monitor AOC E2070SWNL (1600x900) and the second new monitor Acer P166HQL (1366x768)?


How to trace a process to original user?

Say, on a Solaris server, `user1` logs in, switches to someother user, say `sruser`, using `su -` and then starts a process of id `X`. And then another user `user2` logs in, switches to `sruser` the same way and starts a process of id `Y`. (Multiple users can log in and swithch to `sruser` simultaneously.) In the above scenario, is there any way we can trace the processes of ids `X` and `Y` to the actual users `user1` and `user2`? How can we trace a process to the original user?


Give a warning when something is about to be deleted (by root)

I know that root can do anything, but is there a way to at least alert root that they are about to delete a folder that perhaps shouldn't be deleted? We keep a work directory in our `/tmp` folder, and from time to time an administrator will come along and purge the `/tmp` folder with roughly `sudo rm -rf *`. Is there a way to give something like a prompt or alert that they are about to delete a specific folder? Something along the lines of:               The folder XXXXX is protected from deletion - do you really want to delete this folder? (y/n)      I know, the best solution is to move this folder elsewhere (the `/tmp` folder is called temp for a reason after all!), but that has other problems. Hence my question. Asking this question makes me wonder, is it bad practice to actually blindly delete all the contents of the `/tmp` folder? Isn't a better approach to only delete files that are more than a certain age?


Can't fetch R updates

since my version of R is not compatible with a package I need for my work I wanted to update it today but received the following error message when trying to download the updates with synaptic: > W: Failed to fetch http://ftp.yalwa.org/cran/bin/linux/debian/squeeze- > cran/r-base-core_2.15.0-1~squeezecran.0_amd64.deb Could not resolve > 'ftp.yalwa.org' > > W: Failed to fetch http://ftp.yalwa.org/cran/bin/linux/debian/squeeze- > cran/r-cran-boot_1.3-4-1~squeezecran.2.15.0_all.deb Could not resolve > 'ftp.yalwa.org' > > ... and several other messages all pointing towards yalwa.org , can't post > them due to spam prevention well the given urls seem to be outdated, how can I fix this?


How to access a shared directory with Virtualbox OSE

I would like to share data between a VirtualBox OSE guest OS and the host. This location should be also writable by either of the two.


Does IP tables need to be configured or is a stand alone firewall sufficient?

I have two desktops and a laptop running Arch Linux. I have not setup any iptable rules on any of the machines, and I am curious if I should. One desktop is only used in my home network and is "protected" by a cheap cable modem/router/firewall that is essentially unconfigured and unmaintained (I changed the default password when I got it and haven't looked at it since in 3 years). The desktop runs standard home user applications (e.g., web browsing and Skype) as well as an SSH server. As far as I can tell the firewall default configuration blocks all incoming connections since I can only connect to the SSH server from within my home network. The other desktop is behind my University's firewall. It is more permissive (I can SSH into the machine from off campus) and hopefully better maintained. Apart from the SSH server the machine doesn't do anything network related other than web browsing and Skype. The laptop is used behind the home firewall, the University firewall and sometime on unsecured public wireless and wired networks (e.g., hotels and coffee shops). Is it worth configuring IP tables and if so should the configuration vary across the machines? Potentially related, is it worth setting up a separate independent firewall to protect my home network?


Colour is not working with ncurses on target embedded system built with buildroot

I have built an embedded linux environment for AMD Geode target. The kernel, cross toolchain and root file system were built using `buildroot` and the root file system resides on my host machine and is mounted over NFS. To test the environment I cross compiled a very basic ncurses application which simply changes the background colour of some text and moves it around the console. Everything is positioned correctly but no colours are displayed. I know the system is capable of displaying colour as the output from `ls` commands are coloured so I know its not a monitor problem. The application also works as expected on my host machine. Is it possible that I need to configure something within the kernel and rebuild it to enable coloured console output using ncurses or is it likely that it is a problem with the buildroot crosstools or cross-compiled ncurses library?? I am not a linux expert and frankly was very surprised that this application didn't work as expected and really am at a loss as to where to start to identify the cause.


Truncate a file on a certain pattern

How would I go about truncating a binary file when a certain pattern is found? For instance, I want to truncate the file at the first occurrence of the pattern `0xFFFFFFFF`. I think something like `awk` could do the trick... but I'm not exactly sure how. thanks


Most idiomatic way to set an optional parameter?

Suppose you have the following problem: Depending on if a script is executed within a pipe or not, you want to append the `-print0` parameter to `find`. There are at least two ways to do this:               [[ -p '/dev/stdin' ]] && local null_terminated='-print0'     find -mindepth 1 -maxdepth 1 ! \( "${args[@]}" \) "$null_terminated"      Or                   if [[ -p '/dev/stdin' ]]; then             find -mindepth 1 -maxdepth 1 ! \( "${args[@]}" \) -print0         else             find -mindepth 1 -maxdepth 1 ! \( "${args[@]}" \)         fi      Which one would be the most idiomatic way?


feeding the password without any terminal window (stdout)

I have a command like this:                echo "12345" | sudo abcde      where `12345` is supposed to be the root password and `abcde` a program or a command. I have a shortcut which runs this command. I have tested the command in a terminal window. It works, as the terminal output shows. But will it work when it is run without terminal window, for instance by a shortcut or shortcut key? (where no output is shown)


Is it possible to have total no. of blocks taken by same files be different on two PCs?

I used               ls -l mysoftware/      on two different machines, each running ubuntu 12.04. But the 'total' returned by this command is different on the two machines. On one machine it is printing 6, and on another machine it is printing 24. Although I can see same number of files listed. Actually I copied compressed folder mysoftware.tar.bz2 from my pendrive to these machines and then untar using the following command:               sudo tar xvfj mysoftware.tar.bz2      After that I used `ls -l` as above. Since I was not able to install some software on the machine where I'm getting 6, I suspect some files are missing. The question is can the two 'total' be different on different machines?


Difference between /dev and /sys/class?

What is the difference between the device representation in `/dev` between the one in `/sys/class`? Is one prefered over the other? Is there something one offers and the other doesn't?


Expected behavior of `find -depth` if execute permission denied for subdirectory?

I'd like to know if I can rely on the behavior I am seeing when using `find` with `-depth` option and user does not have execute permission for a subdirectory. Assume the following directory structure:               drwxrwxrwt. 10 root    root     12288 Mar 14 04:31 .     dr-xr-xr-x. 24 root    root      4096 Dec  6 03:33 ..     drwx------   4 root    root      4096 Mar 14 04:03 jen      Run the following command as non-root user:               find -type d      The output is:               .     ./jen     find: `./jen': Permission denied      So `find` found the directory _jen_ and output that. It then tried to descend into _jen_ , but didn't have permission so it printed the error. The first line above is printed to `stdout` and the second line to `stderr`. Now run the following as non-root user:               find -depth -type d      And the output is:               find: `./jen': Permission denied     .      So the pathname is not output to `stdout` unless the user has permission to list the contents of the directory. This output is perfect for what I want to do. However, I'm not sure if this is just a coincidence or not. **Can I rely on this behavior?** I'm using GNU findutils 4.4.2. I'm wondering if this behavior is the same across all versions of `find`. And if not, is it at least the same across all versions of GNU find. It doesn't matter to me (for this use case) whether or not _jen_ is printed in the first example. I'm just wondering if I can **_depend_** on it being excluded when `-depth` is used. Normally, it's not a good idea to rely on undocumented behavior. But, to me, this side effect makes sense. So I'm thinking that this might be the _intended_ behavior. The manual says: > — Option: **-depth** > > Process each directory's contents before the directory itself. This is _exactly_ what I want, but it's not clear that the pathname of the directory itself will be excluded from the output if it doesn't descend into it. Thanks to a hint from Hauke Laging, I discovered that I can list _only_ directories and explicitly exclude directories where permission to list their contents is denied:               find -type d \( \( -type d \( \! -executable -or \! -readable \) \) -prune -or -print \)      This also has the effect of stopping the "Permission denied" errors because `find` never tries to descend into a directory if it doesn't have permission. Unfortunately, there are two reasons why this will not work for my needs.   * I want the error messages   * I need the `-depth` option Quoting from the manual > If the ‘-depth’ option is in effect, the subdirectories will have already > been visited in any case. Hence ‘-prune’ has no effect in this case. So I am back to where I started. **It's still not clear whether or not "Process each directory's contents before the directory itself." _also means_ "Don't process the directory if you can't process it's contents".**


Difficulty with EncFS on CentOS

I'm trying to figure out `encfs`, but am having some difficulty. This is what I have done so far: I created 2 test folders               mkdir /home/oshiro/Desktop/encrypted     mkdir /home/oshiro/Desktop/decrypted      The difficulty is that the next command gives me a `permission denied` message:               encfs /home/oshiro/Desktop/encrypted /home/oshiro/Desktop/decrypted      When I run that command in Ubuntu 12.04, it works perfectly and both folders work correctly, i.e. I can create files folders in the `decrypted` folder, and they appear in the `encrypted` folder automatically etc. However, when I try to run that command in CentOS 6.5, I get a `permission denied` error. When I add `sudo` infront of that command, it mounts the `decrypted` folder as normal, but I can't open the folder as a normal user, I get a `permission denied` error. On Ubuntu 12.04, I don't need to use `sudo` to run `encfs`. How do I run that command without `sudo` on CentOS 6.5, or is that unsafe? If it's unsafe, how to I mount that folder so I can access that folder by the user logged in? Here is the full error I get when I try to run `encfs` on CentOS 6.5 without `sudo`:               [oshiro@centos- ~]$ encfs /home/oshiro/Desktop/encrypted /home/oshiro/Desktop/decrypted     EncFS Password:      fuse: failed to exec fusermount: Permission denied     fuse failed. Common problems:     - fuse kernel module not installed (modprobe fuse)     - invalid options -- see usage message     [oshiro@centos ~]$


removing each . after ] appear in a line in complete text file

I have a file in which I need to eliminate . after the ] on every line e.g               xyz[1.2]35.23     xyz[1.2.3]35.234      output should be               xyz[1.2]3523     xyz[1.2.3]35234


Copy selected files had subtitutions in name

I have some folders:               oldA with A_1.aaa, A_2.aaa, A_1.bbb, A.def, A.ghi      oldB with B_1.aaa, B_2.aaa, B_1.bbb, B.def, B.ghi     and so on      and need to copy them to another folder with selection. I want only A.def and A.ghi copy to /newA, so do with B. I have written a script but it doesn't work.               for i in A B C D     do       folder="new${i}"       mkdir $folder;       cp path/to/old${i}/${i}{.def,.ghi} $folder       cd $folder; some commands       cd ..     done      The error is `cp: cannot stat ‘oldA/A{.def,.ghi}’: No such file or directory` However, when I use direct command `cp path/to/oldA/A{.def,.ghi} newA`, it works well. What should I do? If I want to copy only A_1.aaa and A_2.aaa, will the procedure be similar? This is my actually script.               #!/bin/bash     folder="Disperse"     mkdir $folder     cp 3B7V.pdb $folder     cd $folder          #awk '$5 != "C"' 3B7V.pdb > 3B7V_temp.pdb     #awk '$4 != "C"' 3B7V_temp.pdb > AB.pdb     sed -n 403,1981p 3B7V.pdb > A.pdb     sed -n 1982,3586p 3B7V.pdb > B.pdb          cd ..;mkdir EM;cd EM     for i in A B     do        folder="${i}_EM"       mkdir $folder       cp ../em.mdp ../Disperse/${i}.pdb $folder       cd $folder            echo -e "\n4" | pdb2gmx -f ${i}.pdb -o ${i}.gro -water none       grompp -f em.mdp -c ${i}.gro -p topol.top -o ${i}_em.tpr       mdrun -v -deffnm ${i}_em       #grompp -f em.mdp -c ${i}_em.gro -p topol.top -o ${i}_em_mead.tpr       cd .. #at EM folder     done          cd ..;mkdir PQR;cd PQR     for i in A B     do       folder="${i}_PQR"       mkdir $folder       cp ../EM/${i}_EM/${i}* $folder       cd $folder            editconf -f ${i}_em.gro -o ${i}_em.pdb       awk '$1 != "REMARK"' ${i}_em.pdb > ${i}_temp.pdb       pdb2pqr --ff=AMBER --apbs-input ${i}_temp.pdb ${i}.pqr -v > log_${i}       #editconf -f ${i}_em_mead.tpr -mead ${i}_gro.pqr       #for j in *.pqr; do sed 1,8d "$j" > ../"${j/.*}"_sed.pqr; done       cd .. #at PQR folder     done          cd ..;mkdir APBS;cd APBS     for i in A B     do       folder="${i}_APBS"       mkdir $folder;ls       cp ../PQR/${i}_PQR/${i}{.pqr,.in} $folder       cd $folder            abps ${i}.in       cd .. #at APBS folder     done      Also, I have another problem in Konsole. I don't know whether it is relevant or not but I will post here too.


Is it possible to create an alias to rlogin and pass login paramteres?

There is a system I need to rlogin to for work, and each time it asks for my username and password and after the login I have to type in a code-word in order to get to the view I want. Is it possible to create an alias that will automate that? I was able to create a login macho with Reflection X, but i want to use putty instead.


Is there a way to tell sudo to set my username as owner for the files created instead of root?

If I do a `sudo cp /etc/foo.txt ~/foo.txt`, the new file is created with `root` as the owner. Right now, I see no way around this other than using the last two commands (`ls` to clarify use-case):               belmin@server1$ ls /etc/foo.txt     >  -rw------- 1 root root 3848 Mar  6 20:35 /etc/foo.txt     >     belmin@server1$ sudo cp /etc/foo.txt ~/foo.txt     belmin@server1$ sudo chown belmin: $_      I would prefer:   1. Doing it in one `sudo` command.   2. Not having to specify my current user (maybe using a variable?).


Does cut support non-white-space to white-space delimeters?

The default delimiter in awk is white-space to non-whitespace change. The default for cut is the tab character. Can I tell cut to use non-white-space to white space delimters? E.g. a:               foo  bar          cut -d' ' -f2 a      prints just a space, but should print _bar_.               awk '{ print $2; } a      print bar. Sure, often you can just use awk as a cut replacement if you need that semantics. But cut has the advantage that it is very memory efficient. Especially it does not load unused columns into memory (unlike some awks).


How do I switch from an unknown shell to bash?

I was surprised that I didn't find this question already on the site. So, today `$` came up after I logged in as a new user. This was unexpected because my main user's prompt starts with `username@computername:~$`. So, how do I switch from this other shell to bash?


What is the file-naming convention for regular text files?

For regular `*.txt` text files that contain documentation and notes and such, and which are not READMEs, is there a Unix convention for naming them? Namely,   * Should the filenames be all lowercase? camelcase? all caps?    * Should words separated by hyphens, underscores, or escaped spaces?   * Should short names be favored over longer, more explicit ones?


nmap script needed to output text into csv format

ultimately I am looking to insert some info into a database. So I'm trying to output a file from something (probably nmap) that is formatted like this:               10.1.150.1,Up,1/3/2012,host.domain.lan     10.1.150.2,Down,1,3/2012,host2.domain.lan      I do not HAVE to get the date from the nmap scan but it would be helpful. I can add it when I insert the data into the DB. I'm pretty sure that nmap can do this along with some grep, awk, and sed foo, but those things aren't my strongest points. EDIT: I'm open to suggestions about output formats.. XML? I need to run this daily (give or take) and import the results to MySQL EDIT2: I've gotten this far;               nmap -sn -oG - 192.168.0.50-100 | grep Host | awk  '{print $2","$5","$3}'      Which gives me this:               192.168.0.75,Up,()     192.168.0.76,Up,(server01.domain.com)     192.168.0.77,Up,(server02.domain.com)     192.168.0.78,Up,(server03.domain.com)      Next; Can I remove the parens? add the date? Nmap always says what time it starts and finishes but it doesn't include that on each line... so I can't grab it w/ the awk statement.


script to scan ip range and return results in a certain format

This script scans IP's and returns a status of Up or Down. How can I alter it so it doesn't scan everything twice? As it sits it scans everything and returns the "Up" addresses only and then scans all over again and only returns the "Down" status addresses.               #!/bin/bash          is_alive_ping()     {       ping -c 1 $1 > /dev/null       [ $? -eq 0 ] && echo $i,Up       [ $? -eq 1 ] && echo $i,Down     }          for i in 10.1.150.{1..10}     do     is_alive_ping $i & disown     done      Bonus points if anyone can make it also return the DNS name of the IP if it has one. Thanks in advance.


Detach a daemon using sudo?

I noticed that `sudo` continues to run after executing any of the following lines. Is there any way to detach the daemon completely so `sudo` does not continue running?               sudo -u user daemon &     sudo -u user -b daemon


Why does tailing an output log sometimes give partial lines?

Sometimes, tailing an output log which is constantly being updated doesn't give the whole lines. Why is that?               grep pattern input_file > output.log &     tail output.log      Why doesn't it print the last line in full?


shell script options pass through to sub-command

I'm writing a wrapper script for that uses `getopts` to set various options for `mysqldump`. It's working well so far. However one thing I would like to do is be able to add another option in my shell script, the contents of which should be passed to the mysqldump command exactly. Sort of like an options pass through like this:   `./mysqldumpwrapper.sh -u username -p password -h localhost -o "--no-create-db --replace"`   with the string content of the -o argument passed exactly through to my `mysqldump` command. Because I'm using `getopts` when trying the above I get the following output:   `Invalid option: --` Does anyone know how to work around this?   Is there a way to escape the entry of options so that `getopts` won't parse the contents as another option? Then when it comes to triggering the actual command from my shell script, this is what I've got:   `mysqldump "$OPTIONSPASSTHROUGH" --host=$MYSQL_HOST --user=$MYSQL_USER --password=$MYSQL_PASS "$DB" > "$FILE_DEST"`   Because there may well be spaces in the OPTIONSPASSTHROUGH variable, I have quoted that variable in that command. Is that correct?


Yum stopped working after upgrading it

I just did `yum upgrade yum` and now I can't use it. It keeps showin this error:               [root@devlon5 www]# yum install pdftohtml     epel/primary_db           100% |=========================| 3.8 MB    00:00          epel-erlang               100% |=========================| 2.3 kB    00:00          Traceback (most recent call last):       File "/usr/bin/yum", line 29, in ?         yummain.user_main(sys.argv[1:], exit_code=True)       File "/usr/share/yum-cli/yummain.py", line 254, in user_main         errcode = main(args)       File "/usr/share/yum-cli/yummain.py", line 109, in main         result, resultmsgs = base.doCommands()       File "/usr/share/yum-cli/cli.py", line 353, in doCommands         self._getTs(needTsRemove)       File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 99, in _getTs         self._getTsInfo(remove_only)       File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 110, in _getTsInfo         pkgSack = self.pkgSack       File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 774, in <lambda>         pkgSack = property(fget=lambda self: self._getSacks(),       File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 564, in _getSacks         self.repos.populateSack(which=repos)       File "/usr/lib/python2.4/site-packages/yum/repos.py", line 279, in populateSack         sack.populate(repo, mdtype, callback, cacheonly)       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 164, in populate         if self._check_db_version(repo, mydbtype):       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 223, in _check_db_version         return repo._check_db_version(mdtype)       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1227, in _check_db_version         repoXML = self.repoXML       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1417, in <lambda>         repoXML = property(fget=lambda self: self._getRepoXML(),       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1409, in _getRepoXML         self._loadRepoXML(text=self)       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1399, in _loadRepoXML         return self._groupLoadRepoXML(text, self._mdpolicy2mdtypes())       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1375, in _groupLoadRepoXML         self._commonRetrieveDataMD(mdtypes)       File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1348, in _commonRetrieveDataMD         urlgrabber.progress.text_meter_total_size(0)     AttributeError: 'module' object has no attribute 'text_meter_total_size'      Is it because its dependencies are outdated? Can anybody help me to resolve this. Thank you so much


What is the recommended filesystem to use when reaching sizes of 50TB?

My initial google searches say XFS or ReiserFS, but what does the community have to say about this? What are your experiences with 50TB sizes and up? Edit: After inquiring on IRC I think I would recommend Ext4, and splitting up the storage into 10TB chunks. But I'd still be very interested to hear experiences.


Fix Fn-keys for keyboard illumination

I've tried following the Ubuntu hotkeys/media keys troubleshooting guide and `/usr/share/doc/udev/README.keymap.txt.gz` to make the `Fn` keys work. After copying the map file and modifying `/lib/udev/rules.d/95-keymap.rules` I get the correct key names from `sudo /lib/udev/keymap -i input/event4`, but none of them do anything at all. How do I make sure that at least `wlan` and `kbdillumup`/`kbdillumdown` work?               $ /lib/udev/findkeyboards     AT keyboard: input/event4     $ cat /sys/class/dmi/id/sys_vendor     SAMSUNG ELECTRONICS CO., LTD.     $ cat /sys/class/dmi/id/product_name     90X3A      `samsung-90x3a` map file:               0xCE prog1 # Fn+F1 Unknown     0x8D prog3 # Fn+F6 Economy mode     0x97 kbdillumdown # Fn+F7 Keyboard background light down     0x96 kbdillumup # Fn+F8 Keyboard background light up     0xD5 wlan # Fn+F12 Wifi on/off      `$ udevadm info --export-db` **Update** : The information below will be from Arch Linux since I no longer have Ubuntu. `xdotool key XF86KbdBrightnessUp` prints nothing, but returns with exit code 0. I'm not sure if that means anything. `acpi_listen` prints nothing when pressing `Fn`+`F7`/`Fn`+`F8`.


Installing yum on CentOS 5

I have a CentOS vm that I'm currently working on. I tried to update `yum` and it broke, so I removed it. So I need to re-install it on my vm, can anybody tell me how to install `yum` on CentOS5?


Xrandr not saving setting

Hello xrandr at install doesnt detect my tv to be 1920x1080@60hz, so I have to add the setting manually and when I do that with xrandr it works this is the commands I used               xrandr --addmode HDMI-0 1920x1080     xranrd --output HDMI-0 --mode 1920x1080 --rate 60      When I do that the monitor works great and it's fine and all, problem is whenever I reboot, it goes back to 1360x768 and the mode that I added is not there anymore, I have to add it everytime, is there any ways to save the settings? Also how can I set the size of dual monitors? I am using fedora 15 Thanks


Emacs: Deleting a line without sending it to the kill ring

I would like to use `C-k` to delete a line without sending it to the `kill- ring`. I have the following on my `.emacs` file               (delete-selection-mode 1)      but this only seems to work for `C-d` (`delete-char`) I have also read the solutions described in this thread: Emacs: how to delete text without kill ring?, but I didn't see anything that addresses this precise problem.


Vim: mouse support lost after using netrw in xterm

Every time I access the filesystem using:   * `:tabe dirname` (e.g.: `:tabe .`)   * `:vsp dirname`   * `:sp dirname` in order to open some file while editing another one, I lose the mouse support inside the Vim session. I'm running **Vim 7.3.346** inside a fresh install of **Debian Wheezy** , using xterm. I've tested with the minimal settings for Vim, for example with this `.vimrc`:               set nocp     set showmatch     set ts=4     set shiftwidth=4     set expandtab     set foldmethod=syntax     syntax on     set autoindent     set smartindent     set mouse=a     set encoding=utf-8     set fileencoding=utf-8      Is there any solution, or a patch to a bug for this version of Vim? * * * **Update** : At work this problem has never happened, the computers and servers we have are:   * Ubuntu 10.04.3, Vim 7.2.330   * SUSE Linux Enterprise Server 11, Vim 7.2.108   * Red Hat Enterprise Linux Server release 6.0, Vim 7.2.411 Should this be a problem of Vim 7.3?


(How) can I create a tmpfs as a regular (non-root) user?

The distribution is an Ubuntu server running the 2.6.35-30 Linux kernel. I would like to have a directory that sits completely in memory. Is this possible without root privileges?


Rsync --backup-dir seems to be ignored

I want to use `rsync` to backup a directory from a local location to a remote location, and store changed files in another remote location. I did use:               rsync -rcvhL --progress --backup \       --backup-dir=user@url.com:/home/user/Changes/`date +%Y.%m.%d` . \       user@url.com:/home/user/Files/      The `--backup-dir` stays empty, while it should be filled. Is it possible what I'm trying to accomplish is not possible or am I doing something wrong?


Mounting Linux root fs NFS share on OS X?

I am attempting to share the root filesystem (`/`) of a CentOS 6.5 virtual machine to my OS X host system. While this should be relatively simple process, I'm hitting some kind of wall. Presently my linux `/etc/exports` contains:               / 192.168.0.0/255.255.255.0(rw,sync,no_root_squash) 127.0.0.1(rw,sync,no_root_squash)      And I can connect to it, while on the linux system (localhost), via this command:               mount localhost:/ /mnt/root     #Where I did `mkdir /mnt/root` first      But when I flip on over to OS X and attempt a variety of iterations of mount, I just can't get it to work. For example, if I issue:               sudo mount -t nfs hostname:/ /mnt/centos      I'll get a `mount_nfs: can't mount / from hostname onto /mnt/centos: Cennection refused` Oddly I don't see any entries in any `/var/log` files and so I don't see the error messages associated with this refusal.


Apache Request Hangs For 2 Minutes Exactly

I am experiencing some odd behavior with apache. I have requests that are hanging for exactly two minutes. The request could be one file one time, and then a completely different file another time. Here are a couple of screenshots of my network inspector. ![ss #1](http://i.stack.imgur.com/hH4y0.png) _original URL:http://tiny- img.com/image.php?di=QNKO_ ![ss #2](http://i.stack.imgur.com/mFeJh.png) _original URL:http://tiny- img.com/image.php?di=3BFS_ ![ss #3](http://i.stack.imgur.com/VoVgd.png) _original URL:http://tiny- img.com/image.php?di=49VN_ I'm not sure how to troubleshoot this, there are no errors in the logs, and I'm not finding anything referring to similar issues on the web. Any ideas on how I can troubleshoot this, and/or if you know what is going on, I would appreciate any insight to what I can do to correct this.


Dealing with overscan without distorting [fglrx-legacy]

My TV forces overscan. I cannot find a way to turn it off, even using the service menu, and I believe the screen may actually have less than 1280x720 pixels. ATI Catalyst defaults to underscan, which I have already fixed. The only acceptable setting I could find was turning the underscan completely off (using a script file to set the size to 1280x720 and position to 0,0 via aticonfig). Otherwise, there is noticeable distortion, and XBMC's test patterns also indicate distortion. This, however means that the TV's overscan is now a problem. XBMC seems to adjust resolution differently, however, and correcting for the overscan in XBMC sizes the screen perfectly without distortion. But, everything outside XBMC still shows overscan. Is there a way to, system-wide, enforce the type of resizing that XBMC does instead of the type that aticonfig seems to do? I don't understand why aticonfig distorts at anything other than max size, yet xbmc allows ANY resolution without distortion. I am using fglrx-legacy on Debian Wheezy. Thanks


How to examine an apt repository?

I am trying to set up riak on Debian wheezy. I've followed their instructions to add the basho apt repositories...               $> curl http://apt.basho.com/gpg/basho.apt.key | sudo apt-key add -     $> sudo bash -c "echo deb http://apt.basho.com $(lsb_release -sc) main > /etc/apt/sources.list.d/basho.list"      ... and performed `apt-get update`:               ...     Hit http://apt.basho.com wheezy Release.gpg     Hit http://apt.basho.com wheezy Release     Hit http://apt.basho.com wheezy/main i386 Packages     Ign http://apt.basho.com wheezy/main Translation-en_US     Ign http://apt.basho.com wheezy/main Translation-en     ...      However apt still says there's no such package:               $> apt-get install riak     Reading package lists... Done     Building dependency tree     Reading state information... Done     E: Unable to locate package riak      I suspect their instructions might be out of date, having an old package name. How can I query the basho apt repositories to see what packages it holds? I think that if I saw the list of packages, I could see which one it was that I wanted.


Process Monitoring on Solaris

$ prstat -t     NPROC USERNAME  SWAP   RSS MEMORY      TIME  CPU     164 oracle   5446M 5445M   8.3%  13:47:50 1.6%     52 root      576M  728M   1.1%  42:29:50 1.0%      1 noaccess  300M  273M   0.4%   0:20:54 0.0%      1 smmsp    2192K 9912K   0.0%   0:00:06 0.0%      1 nagios    584K 4256K   0.0%   0:01:54 0.0%      6 daemon   8360K   11M   0.0%   0:12:39 0.0%          Total: 225 processes, 839 lwps, load averages: 1.68, 1.58, 1.46      Above is the output of `prstat` command on Solaris Box which has `Oracle 11g` installed. The RAM on the Solaris box is `64GB` however the oracle process seems to be swapping around `5.5 GB`, is that normal? Would appreciate any recommendations on getting more fine-grained information!


Find which directories each group can access

I need to take the /etc/group file (RHEL) and check what high level subdirectories each group has access to. Here is a made up example:               Group 100 - \xxx\xxx\xxx     Group 150 - \xx\xxxxx\x      **Is that possible to know in someway? Or perhaps using another workaround rather than /etc/group file?**


Notify on email sent - Postfix

I have a small postfix server, on a Linux server (Arch Linux) mainly used as a http server. I use postfix to send database backups and notifications of my web sites. To avoid spamming, I'd like to monitor the output mail queue (e.g. a report of sent emails). Is there a simple way to do that?


gnome 3 hibernate option

I switched to gnome 3 (which I like) and of all the things that have changed the only one that bothers me is the fact that there is not a hibernate option. Now, I know of the pm-hibernate command but it does not lock my x-window on boot up. Just right back into where I left off without requiring a password. Any suggestions?


How to perform an action only on the first line?

sed 's/.\(.*\)/\1/' myfile      Say myfile contains:               abc     def     ghi      I want to remove the first character only from the first line but the above removes it from all the line.


Linux - How to open a console and display command results on startup?

I have a Linux server with a screen always displaying the end of a very usefull file. How could I automatically enter a shell and display the end of this file when the server starts? I'd like to do absolutely nothing and see the result of tail -fn 50 /very/usefull/file


non-line-oriented tool for string replacement?

I recently asked a question about how to remove the newline character if it occurs after another specific character. Unix text-processing tools are very powerful, but almost all of them deal with lines of text, which is fine most of the time when the input fits in the available memory. **But what should I do if I wish to replace a text sequence in a huge file that doesn't contain any newlines?** For instance replace `<foobar>` with `\n<foobar>` without reading the input line-by-line? (since there is only one line and it is 2.5G characters long).


echo a file without the first and last lines

Is there a simple way I can echo a file, skipping the first and last lines? I was looking at piping from `head` into `tail`, but for those it seems like I would have to know the total lines from the outset. I was also looking at `split`, but I don't see a way to do it with that either.


Debian: How to delay configuration when installing/upgrading?

One of my Debian systems is rarely upgraded. So when it is time to upgrade, there are loads of packages. Right now I basically have to monitor the upgrade, because every 50 packages or so there is a package that needs help deciding if it should keep the config or have a new configuration put in. My system is really slow, so I would prefer if I could tell the system to deal with as many packages as it can on its own and leave the rest for me. So what I am looking for is something similar to `make -k` but for `apt-get` or `aptitude`. What I am not looking for is non-interactive configuration of packages: I _do_ want to configure the packages, but I want the system to install/upgrade as many packages as it can before asking me to configure anything. That way I hope to return later, configure a bunch of packages, and the install the remaining (hopefully) few packages. Edit: Also it would be nice that when I _do_ return to configure that I can get to configure as many as possible. So it should start by postponing all packages that need configuration and when I return it should prioritize all packages that can be configured at this point.


How to deal with end of options -- in getopts

I use getopts to parse arguments in bash scripts as               while getopts ":hd:" opt; do       case $opt in         d ) echo "directory = $OPTARG"; mydir="$OPTARG"; shift $((OPTIND-1)); OPTIND=1 ;;         h ) helptext           graceful_exit ;;         * ) usage           clean_up           exit 1       esac     done          exeparams="$*"      `exeparams` will hold any unparsed options/arguments. Since I want to use exeparams to hold options for a command to be executed within the script (which can overlap with the scripts own options), I want to use -- to end the options passed to the script. If I pass e.g.               myscript -d myscriptparam -- -d internalparam      `exeparams` will hold               -- -d internalparam      I now want to remove the leading `--` to pass these arguments to the internal command. Is there an elegant way to do this or can I obtain a string which holds just the remainder without `--` from getopts?


/etc/init.d/script, or /etc/inittab - respawn on die

I have a daemon/service (milter-regex), that is dying. I'm only using it temporarily (A few months), so don't care too much, but I want it to restart when it dies. It is an init.d script. 'service milter-regex start' etc. The init script lives at /etc/init.d/milter-regex I know if I have something in /etc/inittab, it will automagically respawn if it dies. Are init scripts supposed to do this as well, or do I need to put it in inittab? It could be failing to restart as it isn't cleaning up a stale sock file, which I will fix today, but thought I'd ask the question anyway. Running on RHEL4 (Yes, old) Thanks, Brock


openSuSE, Linux, cannot create directory-permission denied

I am using openSuse 12.3, and logged in as a user. I am trying to create a directory in the `/home/` , but getting permission denied. any idea, how to fix this.               harbir@linux-gn77:/home> mkdir testDir     mkdir: cannot create directory ‘testDir’: Permission denied     harbir@linux-gn77:/home>


What process is sending TCP SYNs on Solaris 10?

Some process on my Solaris 10 machine is sending TCP SYNs to a remote machine. The remote machine never responds, so the connection is not established. How do I find out what process is initiating this? I've been looking at DTrace scripts but a) I don't know Dtrace well enough to create my own, b) haven't found an existing script, and c) some that I have found use probes not available in my version. Thanks for any insight. Gary


Remove old icons in Gnome 3

I have been installing several version of Komodo editor. (The installation consist of extracting a .tar.gz archive and then running an `.sh` script as root.) Yesterday I installed Gnome 3. Now I see in "Application" section of Gnome Shell both "Komodo Edit 7" and "Komodo Edit 5" despite of only "Komodo Edit 7" is installed. How to remove the old icon?


What is the difference between who > lp and who | lp?

Why does the `who > lp` creates a file but `who | lp` leads the output to program `lp`? What is the underlying principle behind these two simple commands? Can somebody explain it with an example?


Gnome Network-Manager OpenVPN

I cannot get OpenVPN to work with GNOME NetworkManager. Authentication-Type is "Certificates (TLS)" I have 3 files:   * UserCert: user.crt   * CACert: ca.key   * PrivateKey: user.key All live in my home-directory. Connection fails with the following message:               Feb 25 23:16:49 archpad nm-openvpn[1138]: OpenVPN 2.3.2 x86_64-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [eurephia] [MH] [IPv6     Feb 25 23:16:49 archpad nm-openvpn[1138]: WARNING: No server certificate verification method has been enabled.  See http://openvpn.n     Feb 25 23:16:49 archpad nm-openvpn[1138]: NOTE: the current --script-security setting may allow this configuration to call user-defi     Feb 25 23:16:49 archpad nm-openvpn[1138]: WARNING: file '/home/mak/Downloads/user.key' is group or others accessible     Feb 25 23:16:49 archpad nm-openvpn[1138]: Cannot load CA certificate file /home/mak/Downloads/ca.key (OpenSSL)     Feb 25 23:16:49 archpad nm-openvpn[1138]: Exiting due to fatal error     Feb 25 23:16:49 archpad NetworkManager[422]: <warn> VPN plugin failed: 1     Feb 25 23:16:49 archpad NetworkManager[422]: <info> VPN plugin state changed: stopped (6)     Feb 25 23:16:49 archpad NetworkManager[422]: <info> VPN plugin state change reason: 0     Feb 25 23:16:49 archpad NetworkManager[422]: <info> Policy set 'tb303' (wlp3s0) as default for IPv4 routing and DNS.     Feb 25 23:16:49 archpad NetworkManager[422]: <warn> error disconnecting VPN: Could not process the request because no VPN connection      **UPDATE** Output of               openssl x509 -in  /home/mak/Downloads/ca.key -noout -text      is               unable to load certificate     140493069354640:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:703:Expecting: TRUSTED CERTIFICATE


High RX packet error count with modem - how to analyze?

I'm testing a CDMA modem on my Debian embedded Linux system. I'm doing some wgets of large files and am seeing the connection drop now and then. Looking at the ifconfig output for the PPP interface I see the count for errors seems to be pretty high (353 errors). Is there any easy way of determining what those errors actually are?               ppp0      Link encap:Point-to-Point Protocol               inet addr:166.248.251.38  P-t-P:66.174.217.80  Mask:255.255.255.255               UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1               RX packets:6490 errors:353 dropped:0 overruns:0 frame:0               TX packets:5901 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:3               RX bytes:7712851 (7.3 MiB)  TX bytes:568635 (555.3 KiB)


Renaming files with its path name

I have a .bdf file inside subfolders. All the .bdf have the same name: Loads.bdf Example:               /home/user/folderxx/folderxxx/Load.bdf     /home/user/folderxx/folderxxx/Load.bdf      I need to find (and copy to a new folder) all Load.bdf files and rename them with its path name. Example: After the intended operation, it should show something like this.               folder001_folderAAA_Load.bdf     folder002_folderBBB_Load.bdf


"Unable to connect to X server" after TTY login

I'm using Ubuntu 13.10. Whenever I login on the command line (tty1-tty6) I get the following output:               Last login: ...     Welcome to Ubuntu 13.10 ...          Unable to connect to X server     Unable to connect to X server      And then the regular prompt. I'm wondering if there is a way to track down what is causing the "Unable to connect to X server" message. What processes/files run when I login this way?


launch x11vnc on bootup

I am using archlinux version 3.10.27-1-ARCH on my remote PC and I would like it to launch x11vnc server on successful bootup. Though i can start the x11vnc server manually, I am having trouble starting it up automatically. The configuration of `/etc/systemd/system/x11vnc.service` is as follows * * *               [Unit]     Description=VNC Server for X11     Requires=graphical.target     After=graphical.target          [Service]     ExecStart=/usr/bin/x11vnc -display :0 -nopw      * * * The status of the service using command:`systemctl status x11vnc`               x11vnc.service - VNC Server for X11        Loaded: loaded (/etc/systemd/system/x11vnc.service; enabled)        Active: inactive (dead)      * * * And the dBus output of command: `dmesg|grep x11vnc`               [    5.467201] systemd[1]: Found dependency on x11vnc.service/start     [    5.467285] systemd[1]: Breaking ordering cycle by deleting job x11vnc.service/start     [    5.467335] systemd[1]: Job x11vnc.service/start deleted to break ordering cycle starting with graphical.target/start      * * * I do feel from the `dmesg` output there is a cyclic dependency, but I am not able to understand what.


Expanding comma-separated list into separate lines

I have a file with some data in this form:               Prefix text: First Name, Second Name, Third--      The prefix differs by line. The number of names varies from one to several. The suffix (`--` in the example) is optional and non-alphabetic. I need to expand the comma-separated list of names into multiple lines (easy: `s/,/\n/g`), but in such a way that prefix and suffix (if present) surround each of the new entries:               Prefix text: First name--     Prefix text: Second name--     Prefix text: Third--      Instead of banging out a too-long python script, I thought it'd be more fun to ask if someone here can think of the perfect one-liner. Any ideas?