sfdisk failing to write partition to disk

I am trying make my microSD card bootable to Ubuntu. I am trying to use `sfdisk` to create the partitions. When I do that this is the error I am getting:               Using sfdisk to create partition layout     -----------------------------     Checking that no-one is using this disk right now ...     OK          Disk /dev/sdb: 30436 cylinders, 64 heads, 32 sectors/track     Old situation:     Warning: The partition table looks like it was made       for C/H/S=*/255/63 (instead of 30436/64/32).     For this listing I'll assume that geometry.     Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0             Device Boot Start   End    MiB    #blocks   Id  System     /dev/sdb1         4  30436- 30433-  31162880    c  W95 FAT32 (LBA)     /dev/sdb2         0      -      0          0    0  Empty     /dev/sdb3         0      -      0          0    0  Empty     /dev/sdb4         0      -      0          0    0  Empty     New situation:     Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0             Device Boot Start   End    MiB    #blocks   Id  System     /dev/sdb1   *     1     96     96      98304    e  W95 FAT16 (LBA)     /dev/sdb2         0      -      0          0    0  Empty     /dev/sdb3         0      -      0          0    0  Empty     /dev/sdb4         0      -      0          0    0  Empty     /dev/sdb: Input/output error          sfdisk: Failed writing the partition on /dev/sdb     Re-reading the partition table ...     /dev/sdb: Input/output error     Error closing /dev/sdb     If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)     to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1     (See fdisk(8).)      Any ideas what would be the issue? The disk is writable.


make grep output without trailing newline

Please consider this snippet: `X=$(grep -m1 'some-pattern' some-file | sed -n 's/.* //p')` I want to put last word in a variable if some pattern condition is matched for lines in arbitrary text file My problem is that variable `X` has CR or LF or CRLF at the end, depending on source file, which I want to get rid of, as it interferes with later operation I intend to do.   I even tried something like: `X=$(grep -m1 'some-pattern' some-file | sed -n 's/.* \\([A-Za-z]\\+\\)/\1/p')` thus expecting `sed` output to be limited on `[A-Za-z]+` but there are still this nuisance bytes inside X variable. How can I get rid of it, without using too much code like see what bytes are at the end with `xxd` then `cut` it and similar complications?


About sector and blocks, and a little confusion in /proc/diskstats

I've been studying about diskstats lately, and I get that the amount of hdd read comes in sectors. But in most places I've noticed that there exists a slight misunderstanding about sectors and blocks. So, what type is this sector which is read by the diskstats? Can I figure it out with:               dumpe2fs /dev/sda7 | grep 'Block size'


code review: automatic completion for bash aliases

I was reading How do I get bash completion for command aliases? and I thought, that the answer Shawn J. Goff needed a little something: less user setup so I wrote a little script that is intended to be sourced from your `.bashrc`, but it doesn't quite work, so hopefully someone can spot my error.               function make-completion-wrapper-1 () {         local function_name="$2"         local arg_count=$(($#-3))         local comp_function_name="$(complete -pr $1|sed -e 's/^\(.* -F \)\([^ ]*\) [^ ]*$/\2/')"         shift 2         local function="             function $function_name {                 ((COMP_CWORD+=$arg_count))                 COMP_WORDS=( "$@" \${COMP_WORDS[@]:1} )                 "$comp_function_name"                 return 0             }"         echo "$function"         eval "$function"     }          function make-completion-wrapper-2 () {         local function_name="$1"         local alias_name="$2"         local comp_function_base="$(complete -pr $3|sed -e 's/^\(.* -F\)\( [^ ]*\) [^ ]*$/\1/')"         echo "$comp_function_base $function_name $alias_name"         eval "$comp_function_base $function_name $alias_name"     }          [ -e ~/.cache/bash_alias_complete ] && rm ~/.cache/bash_alias_complete          alias | \         sed \             -e 's/^alias //' \             -e '/^\([^=]\+\)='\''\1 /d' \             -e "/'.*=/d" -e '/\$/d' \             -e h \             -e "s/.*='\([^ ]*\)\( .*\)'$/\1! \1\2/" \             -e 'y/ -!/__ /' -eG -e 's!\n[^=]*='\''\(.*\)'\''! \1!' \             -e 's/^/make-completion-wrapper-1 /p' \             -e 's/^[^ ]* [^ ]* \([^ ]*\) .*$/\1/' \             -e x \             -e 's!='\''\([^ ]*\) .*$! \1!' \             -e x \             -e 's!^!make-completion-wrapper-2 !' \             -e G \             -e 'y/\n/ /' \         > ~/.cache/bash_alias_complete          . ~/.cache/bash_alias_complete      I'm getting the following error when I pres the `Tab` key:               bash: COMP_POINT - : syntax error: operand expected (error token is "- ")      **NOTE:** The above code can be placed in a file, such as `myfuncs.bash`, which can then either be sourced directly in the shell or from `$HOME/.bashrc`. For full change history on this code see https://github.com/hildred/scripts.git


How to detect if tmux is attached?

I have a Irssi running within a tmux session, and am working on writing a Irssi script (extension) to send me an email when someone PMs or mentions me when I'm not attached to the tmux session. Everything about this is quite easy, less one thing: how do you detect if the tmux session is attached? I've gotten so far with this, and am reaching out here mainly to see if this is the correct/best way to do it, or if I should be doing it differently. Any advice is appreciated!               # Get the current session_name value from tmux     $ tmux display -p '#{session_name}'     2          # Running list-clients while I'm attached yields the following,     # from both the same window as well as another window:     $ tmux list-clients -t 2     (null): 2 [180x42 (null)]           # As well, running list-clients while detached yields no output:     $ tmux list-clients -t 2     $       All told, I _think_ this is the right way to go about this, but I'm certainly open to any better ways to or suggestions on how to check this.


How can I get Apache2 in OpenSUSE to map /srv/www/htdocs/index.php to localhost?

If the document root for Apache in OpenSUSE is `/srv/www/htdocs` and that folder only contains my website with its own `index.php` file, entering "localhost" in a browser should take you to the homepage. **It doesn't!** It takes you to the It works! page instead. Since there is no index.html file in that folder, what is changing the document root to point somewhere else and where is it pointing to? This is the output of httpd.conf minus a huge block of comments at the top:               ### Global Environment ######################################################     #     # The directives in this section affect the overall operation of Apache,     # such as the number of concurrent requests.          # run under this user/group id     Include /etc/apache2/uid.conf          # - how many server processes to start (server pool regulation)     # - usage of KeepAlive     Include /etc/apache2/server-tuning.conf          # ErrorLog: The location of the error log file.     # If you do not specify an ErrorLog directive within a <VirtualHost>     # container, error messages relating to that virtual host will be     # logged here.  If you *do* define an error logfile for a <VirtualHost>     # container, that host's errors will be logged there and not here.     ErrorLog /var/log/apache2/error_log          # generated from APACHE_MODULES in /etc/sysconfig/apache2     Include /etc/apache2/sysconfig.d/loadmodule.conf          # IP addresses / ports to listen on     Include /etc/apache2/listen.conf          # predefined logging formats     Include /etc/apache2/mod_log_config.conf          # generated from global settings in /etc/sysconfig/apache2     Include /etc/apache2/sysconfig.d/global.conf          # optional mod_status, mod_info     Include /etc/apache2/mod_status.conf     Include /etc/apache2/mod_info.conf          # optional cookie-based user tracking     # read the documentation before using it!!     Include /etc/apache2/mod_usertrack.conf          # configuration of server-generated directory listings     Include /etc/apache2/mod_autoindex-defaults.conf          # associate MIME types with filename extensions     TypesConfig /etc/apache2/mime.types     DefaultType text/plain     Include /etc/apache2/mod_mime-defaults.conf          # set up (customizable) error responses     Include /etc/apache2/errors.conf          # global (server-wide) SSL configuration, that is not specific to      # any virtual host     Include /etc/apache2/ssl-global.conf          # forbid access to the entire filesystem by default     <Directory />         Options None         AllowOverride None         Order deny,allow         Deny from all     </Directory>          # use .htaccess files for overriding,     AccessFileName .htaccess     # and never show them     <Files ~ "^\.ht">         Order allow,deny         Deny from all     </Files>          # List of resources to look for when the client requests a directory     DirectoryIndex index.html index.html.var          ### 'Main' server configuration #############################################     #     # The directives in this section set up the values used by the 'main'     # server, which responds to any requests that aren't handled by a     # <VirtualHost> definition.  These values also provide defaults for     # any <VirtualHost> containers you may define later in the file.     #     # All of these directives may appear inside <VirtualHost> containers,     # in which case these default settings will be overridden for the     # virtual host being defined.     #     Include /etc/apache2/default-server.conf               # Another way to include your own files     #     # The file below is generated from /etc/sysconfig/apache2,     # include arbitrary files as named in APACHE_CONF_INCLUDE_FILES and     # APACHE_CONF_INCLUDE_DIRS     Include /etc/apache2/sysconfig.d/include.conf               ### Virtual server configuration ############################################     #     # VirtualHost: If you want to maintain multiple domains/hostnames on your     # machine you can setup VirtualHost containers for them. Most configurations     # use only name-based virtual hosts so the server doesn't need to worry about     # IP addresses. This is indicated by the asterisks in the directives below.     #     # Please see the documentation at     # <URL:http://httpd.apache.org/docs-2.2/vhosts/>     # for further details before you try to setup virtual hosts.     #     # You may use the command line option '-S' to verify your virtual host     # configuration.     #     Include /etc/apache2/vhosts.d/*.conf               # Note: instead of adding your own configuration here, consider      #       adding it in your own file (/etc/apache2/httpd.conf.local)     #       putting its name into APACHE_CONF_INCLUDE_FILES in      #       /etc/sysconfig/apache2 -- this will make system updates      #       easier :)


How to repartition disk to use non-allocated space?

This is how my hard drive (where I have Xubuntu 12.10) is formatted currently, based on a recent GParted screenshot: ![GParted Screenshot](http://i.imgur.com/RzbBIOS.png) I want to expand sda6 (4) to take up the free 11.72 GiB unallocated space. But I can't do it. This is what I did and gathered so far:   * I can't add another primary partition as I have 4 already. I didn't know that prior to starting up GParted and right-clicking the unallocated 11.72 GiB space. :/   * /dev/sda5 is swap.   * /dev/sda2 and /dev/sda3 are Windows partitions and need to remain as they are. I am a bit clueless on how to enhance /sda6 now, I have definitely not enough basic knowledge on how to proceed. :( I don't even know if I have to keep the swap partition but that thought is moot anyway as I can't create another primary partition. Help! I'd appreciate it a lot. :) I'd even be willing a tutorial which could help me get forward via the terminal.


Slow ikiwiki after first run

I have local ikiwiki on my notebook (with apache as local webserver). When I save an edit the first time after booting and logging in, saving is very slow (but the second time saving is at normal speed). Any idea how to fix this? **Edit:** Click edit the first time:~ 30 Sek. (it says "waiting for localhost")   Click save the fisrt time:~1 min 30 Sek (it says "waiting for localhost") Click edit the second time: <3 Sek.   Click save the second time: ~4 Sek. The problem is independent of beeing online or not. I am using git as backend.


Kali Linux: On install, designated root password cannot login - incorrect password

I found an old laptop lying around and I figured I would install Kali Linux on it to learn more about penetration testing and to try to break into my servers for practice and learning more about creating a secure network. I used unetbootin to install the Kali Linux ISO I downloaded via the torrent from their site, and the install to my flash drive went successfully. On the laptop I was wanting to put Kali on, I went into the BIOS and ordered the USB to be the priority to boot from. After that, I booted live into Kali and installed the operating system from there. It loaded up the graphical install page from Kali and the install seemed to go successfully. However, once the installation was successful, it would take me to the login page and prompt me for the root password. I would type in the root password I had used during the initial setup, yet it gives me the `Incorrect password` prompt, even though I am 100% sure I was using the password I had installed at the start. To confirm this, I tried reinstalling from the live boot multiple times, using the same password from the first attempt and even just doing "password" for testing purposes. Neither one worked. As a final measure, I opened up the GParted Partition Editor from the Kali live boot and deleted all of the partitions on my laptop's hard drive. From there, I went through the Kali installation process again successfully, only to encounter the EXACT same issue as before when trying to log in after installation. Does anyone know what is going on? I am clueless as to what I could do to be able to log into my Kali installation... thanks.


How to truely install a tar.gz file on Linux - how to manage manually-installed (or standalone) applications?

I see all these links explaining packages and .debs... I know that... and there are many kludges to get tar.gz files working (eg: update-alternatives for Java or manually dropping the file in /usr/local/bin (or somewhere else, which I had deduced from hours of searching)). If packages are so smart, how are so few Linux applications available in packages or .debs/rpms? I'm speaking as a new user; I know experts probably know it better (I think I can download a compilable version of Eclipse?). Like netbeans and chrome are .sh, eclipse is a plain, launchable directory, java requires this update- alternatives business but I don't think it registers itself into Ubuntu/Debian's "programs list" (just registers as a command), etc. (I know these are sometimes available in repositories, but I'm just confused why download pages don't have proper explanations). **Long story short: If a download or compile a tar.gz file, how do I register it to the system?`update-alternatives` seems to register it as a command, in Ubuntu, it doesn't show up in the search bar. In Debian, I can manually add a shortcut to the GNOME 2 launcher. But what should I really be doing?** * * * **Edit:** So after playing around a bit more with the new solutions, I can sorta refine my "problem": How should I manage my manually installed programs? Firefox and Eclipse are my only examples so far (I don't download a lot of stuff). They can both run out the box, which I like. Except, where should I be installing them? I see Eclipse has it's own instructions, but I'd rather do all my "manual packages" the same way.   1. After some research, I decided to put these programs into `/user/local/bin`.   2. From how to install eclipse, I figured to get something to show up in the launcher, I need to put a `xxx.desktop` file in `~/.local/share/applications/`. Does the name of this .desktop file matter?   3. Stuff with autotools (I look for a `configure` or `unix/configure` file) will work out fine. Some research points that I should use `CheckInstall` to keep track of all these.   4. I should use `update-alternatives` to register paths. From this java thread, it looks like I create a link from `/usr/bin/java` to `/usr/lib/jvm/jdk...`. When I install these "standalone" applications like Eclipse or Firefox, should I always link to `/usr/bin/[app]`? And if assertion 1 is true, I would be doing stuff like `sudo update-alternatives --install "/usr/bin/[app]" "[app]" "/usr/local/bin/[app]" 1` **Are these instructions correct/a good way to manage manual installations? Are there any other steps I should follow? Other suggestions?**


What distribution do you suggest for daily use?

I use my computer everyday for various reasons:   1. programming in c++, android(java), java(in general)   2. listening to music(spotify), watching movies   3. browsing internet, watching youtube clips   4. writing various documents   5. studying in general (I am a student)   6. flashing custom roms to my android phone (now and then) Currently I am using ubuntu 13.04, but it is not really well polished (I think...). I would like to ask for your tips and suggestions, what would fit my needs the most? I really like global menu in ubuntu. To be honest, I really like the whole shell of macs osx. I would buy mac for sure, if I had money for it. For obvious reasons, I have to stick with searching for perfect linux distro which has features similar to osx :) So, your tips and suggestions are more then welcome. Thank you!


Can new glibc versions be used with an old kernel?

Apparently glibc can be compiled with `\--enable-kernel` to support older kernel versions. However, I haven't been able to find information on _what kernel versions are supported on a particular glibc version_. Ideally, I want to see a compatibility matrix for every glibc (2.x) and kernel (2.6.x) releases. Does it exist? If it doesn't exist, perhaps it's because every glibc versions (in the last 5 years or so) supports all kernels since 2.6.0? (Arch = x86-64, if that matters)


Is it possible to source a file in bash, but skipping specific functions?

Suppose I have `bash_functions.sh`:               function test(){     }          function test2(){     }      And in my `~/.bashrc` I do:               source ~/bash_functions.sh      Is it possible to, when sourcing it, avoid sourcing a specific function? I mean, source everything in `bash_functions.sh`, except for `test`?


Different sleep binaries on Mac (Darwin) and in Linux. How to properly handle the differences?

In my Linux box, `sleep` accepts seconds, minutes and hours. So:               sleep 10m      Sleeps for 10 minutes (or 600s). `sleep` on Mac only accepts seconds as argument. `sleep 10m` doesn't work, only `sleep 600s`. What can I do? Create a function named `sleep` that converts when 10m or 10h is passed as a parameter to seconds, and calls the builtin sleep?


How to list all running X applications?

I'd like to get a list of all of the apps (across all users) on my machine that are talking to the X server. What's the most reliable way to do that? Find the socket X runs on and lsof for connections to it? I'm running both Linux and Solaris boxes, so I'd be interested in answers for both OS's.


cd two levels down from root

I'm a web developer (Drupal mainly). When I develop websites I do so within a /workspace folder. So I have folders like this.               /workspace/project/     /workspace/project/sites/default/files/     /workspace/project1/     /workspace/project1/sites/all/modules/contrib/date      I would like to have a command which takes me to my project root, which is always               /workspace/something/      So that when I am in:               /workspace/project/sites/default/files/      [specialcdcommand] will take me to:               /workspace/project/      But when I am in:               /workspace/project1/sites/default/files/      [specialcdcommand] will take me to:               /workspace/project1/      At the moment I tend to do this:               cd /workspace/p[tab]      ... which is not good because I sometimes land in a different project version without noticing. If it helps, I use zsh.


How to search for Debian packages by tags?

At Debian's Packages page, one can search amongst the software available on Debian. In the package descriptions, they are categorized by tags, described here. For instance, the package `[xterm][3]` has the following tags: > Tags: Implemented in: C, User Interface: X Window System, Role: Program, > Scope: scope::utility, uitoolkit::athena, Purpose: Need an extra tag, X > Window System: Application, Terminal Emulator Is there a way to search or browser for packages according to these tags?


Create clickable links in terminal

It's possible to create grep-command results file names like a link - for open editor? I want click to filenames in grep result and open my editor with selected line               $ grep "mServiceIntent" -R ./src/     ./src/com/example/android/threadsample/PhotoThumbnailFragment.java:67    private Intent mServiceIntent;     ./src/com/example/android/threadsample/PhotoThumbnailFragment.java:194        mServiceIntent =     ./src/com/example/android/threadsample/PhotoThumbnailFragment.java:203                getActivity().startService(mServiceIntent);      Actualy I know how register protocol in system for open editor. For example all urls like sblm://* in my system open by SublimeText. My question is: how create custom links in guake terminal (or may be it's not dependes on quake and work for default terminal program)?


Linux security vulnerabilities?

A while back I started an embedded project using the 3.2.10 kernel. Now the project should go into production and the stable kernel is 3.2.16. I would prefer not to upgrade anything to avoid incompatibilities etc. but if serious security vulnerabilities has been plugged from 3.2.10 to 3.2.16 I have to do so. Where can I find out if security vulnerabilities has been plugged between the two versions? I have not been able to find the answer in obvious places like kernel.org.


Flash drive won't boot or mount after trying to create installation medium

I have a 1GB USB flash drive which I wanted to use as an installation medium for Linux distros. My first experiment was to be installing Arch on an old laptop (old enough that if I really messed it up, it wouldn't matter). I downloaded the ISO image, and put the USB into the port; it mounted automatically. Following the instructions on Arch's installation how-to page, I ran `dd if archlinux-XXXX.iso of /dev/sdg1`. I then could not see any files on the USB (whether using `ls` or nautilus). I umounted it, then plugged it back in, and it had some files on it. I'm afraid I can't remember exactly what they were, but I'm pretty sure I saw a directory named `/boot`. I then plugged it into the laptop, which would not boot from the flash drive. I plugged the USB back into my main computer, only to be told:               Unable to mount 168 MB Filesystem     Error mounting: mount: wrong fs type, bad option, bad superblock on /dev/sdg1,     missing codepage or helper program, or other error     In some cases useful info is found in syslog - try dmesg | tail or so      That command, `dmesg | tail`, gives the following: [338915.672127] UDF-fs: No anchor found [338915.672133] UDF-fs: No partition found (1) [338955.452708] UDF-fs: No anchor found [338955.452714] UDF-fs: Rescanning with blocksize 2048 [338955.479829] UDF-fs: No anchor found [338955.479834] UDF-fs: No partition found (1) [338955.527366] UDF-fs: No anchor found [338955.527373] UDF-fs: Rescanning with blocksize 2048 [338955.555208] UDF-fs: No anchor found [338955.555213] UDF-fs: No partition found (1) So I'm curious about what has happened here. Did I do something wrong somewhere? Why is the error message referring to a 168 MB device, when it's supposed to be 1 GB? Also, is there any way to salvage the flash drive, or is it toast? Edit: Information from `fdisk /dev/sdg` Command (m for help): p [print the partition table]               Disk /dev/sdg: 1021 MB, 1021125120 bytes     64 heads, 32 sectors/track, 973 cylinders, total 1994385 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0xe797d5bb             Device Boot      Start         End      Blocks   Id  System     /dev/sdg1   *           0      327679      163840   17  Hidden HPFS/NTFS


How do I transfer multiple files with a common suffix and prefix using an offset?

I have thousands of files whose names are of the form:               sequence_1_0001.hmf       sequence_1_0002.hmf       sequence_1_0003.hmf     ...            sequence_1_0001.jpg       sequence_1_0002.jpg     sequence_1_0003.jpg     ...            sequence_2_0001.hmf       sequence_2_0002.hmf       sequence_2_0003.hmf     ...        etc.. I'm using sftp to transfer only the files whose suffix and prefix are 'sequence_1' and '.hmf', respectively. However, I don't want to transfer all the files that match this format. Instead, I want to transfer every hundreth file. That is:               sequence_2_0001.hmf       sequence_2_0101.hmf       sequence_2_0201.hmf     ...        Is there a way to do this?


Recursively rename subdirectories that match a regex

I have a media server with a folder called `Series`. (`/media/Expansion2/Series/`) In it, I have (surprise!) TV series. These are just the show names, e.g., `/media/Expansion2/Series/The Big Bang Theory/` Inside each show's folder (and this is where the problem lies) I have season folders. I currently have a mixture of the following 2 conventions (along with a few more, probably):   1. `/media/Expansion2/Series/The Big Bang Theory/The Big Bang Theory Season 1`   2. `/media/Expansion2/Series/The Big Bang Theory/Season 2` In the end, I want to rename all folders to just `Season #`. As a regex, I would probably say something like `s/.*(Season \d)/$1` Only applicable to folders, not files. I should probably also mention that this is for about 50+ show sub folders, so it needs to start at the `/media/Expansion2/Series/` level and look into each series :)


crontab "0/15" minutes + "11-15" hour field: when does that end?

Given a crontab expression like "0 0/15 11-15 ? * MON-FRI", how is that parsed? I am correct in assuming the 11-15 does not mean "between 11 and 15" but "when the hour is 11-15, inclusive" - i.e. the expression will trigger every 15 minutes starting at 11:00 and ending at 15:45? Or will it end at 14:45? Or maybe 15:00?


How do I remove multiple files with a common prefix and suffix?

I have many files named               sequence_1_0001.jpg       sequence_1_0002.jpg       sequence_1_0003.jpg       ...      and files named               sequence_1_0001.hmf       sequence_1_0002.hmf       sequence_1_0003.hmf       ...      and files named               sequence_2_0001.jpg       sequence_2_0002.jpg       sequence_2_0003.jpg       ...      and               sequence_2_0001.hmf       sequence_2_0002.hmf       sequence_2_0003.hmf       ...      I just want to remove the files that begin with 'sequence_1' and end in '.hmf', but I don't want to remove them one by one, since there are thousands of files. How can I specify to the rm command that I want to remove all that begin with the prefilx 'sequence_1' and end in '.hmf'? I'm currently working with a RedHat Linux system, but I'd like to know how to do it on other distributions as well.


Automatically update MPD database upon external storage insertion

I have an Alix board in my living room running Voyage MPD edition and acting as jukebox. In order to play "guest" music, I would like that MPD automatically updates its database with the content of the USB sticks one could connect to the box. Is there a straightforward way to do it (via udev or MPD) ? Thanks


Enable compiz window grid with visual effects set to none. Ubuntu 10.04

I have to disable "Visual Effects" (system -> preferences-> appearance -> visual effects -> none) because I get a terrible flicker/blinking when it is enabled, but I'd really like to use compiz window grid shortcuts. They only work w/ visual effects set to "extra". Is there any way to specifically enable compiz grid functionality without turning on everything else that seems to bog down the grapics? Thanks.


printing .cpp file from command line using emacs

The goal is to print a set of *.cpp files on a network printer, but... in a way that the (color) printer prints the files like they appear in the c++ editor including the colors and highlighting. And all of this from the command line. I succeeded in sending all the files to the network printer but they are (of course) all printed in black and white (text) format. I used : lp -d 'printername' *.cpp Is there a way to open the files in something like emacs and pass the print command to emacs from the command line? BTW: I'm on mac OS X.


How can I expand ext4 partition size on debian

I have a drive with this configuration:               fdisk -l          Disk /dev/sda: 500.1 GB, 500107862016 bytes     255 heads, 63 sectors/track, 60801 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x000f1b8b             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *           1        2612    20971520   83  Linux     /dev/sda3           60736       60801      525312   82  Linux swap / Solaris      There is 478GB unallocated space, how would I go about adding this space to /dev/sda1 without losing the data that is currently on /dev/sda1? (the filesystem is ext4) The OS is debian 6. Thank you in advance. :)   (it is a server with only SSH, no GUI for running stuff like gparted)


xterm warning: Tried to connect to session manager

I am writing a quick script to read user input and put into commands of a couple different programs. I'm using `xterm -e` to open a terminal for each separate program. The script is working fine, but each time `xterm -e` is executed, an error message is displayed: > Warning: Tried to connect to session manager, None of the authentication > protocols specified are supported Any ideas on how to stop this from displaying?


How to uninstall java on Linux Mint 12

Today, I downloaded the latest java `jre` which is a **.bin** file By mistake, I installed it on my desktop by running `./jre`. I want to remove this installation, move the **.bin** file to somewhere else and install it again I tried `sudo apt-get remove --purge jre` gives               Reading package lists... Done     Building dependency tree            Reading state information... Done     Virtual packages like 'jre' can't be removed     0 upgraded, 0 newly installed, 0 to remove and 19 not upgraded.      Note: I can't use synaptic package manager, here's why, so I have to do everything from the terminal until the problem gets fixed. The folder where the JRE is located is called **jre**. **Edit: @stew** just installed java jre               sudo echo 'deb http://www.duinsoft.nl/pkg debs all' >> /etc/apt/sources.list     sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 5CB26B26     sudo apt-get update     sudo apt-get install update-sun-jre      it's the latest version. so i just have now to remove the **.bin** file and the extracted **jre** folder, would your method still works? and could you please tell me why to use open jdk over jre sir?


How can I tell which version of Varnish I'm running?

How can I get the installed Varnish cache version string from the command line?


Linux Mint Kde boots to Xsession fail

I've been trying to figure out this error I have. Its a fresh install of linux mint 15 kde. During the process of installing graphics drivers, steam, and a few other things I get this error at some point after I log off (at this point during the install I've usually done a full reboot a couple of times, it is the logoff thats causing the problem). Instead of logging off the computer goes through almost a boot loop, just rebooting linux not showing BIOS, and then boots me into a command line login screen. After logging in I install `mdm` and reboot (I'm set to auto login if that makes a difference). When it boots straight into KDE I get two windows on a screen of black. One is a terminal and one is an `xsession` that has failed and produced this error sheet message.               /etc/mdm/Xsession: Beginning session setup...     localuser:b being added to access control list     Script for cjkv started at run_im.     Script for default started at run_im.     Failed to connect to the VirtualBox kernel service     Failed to connect to the VirtualBox kernel service     Failed to connect to the VirtualBox kernel service     Failed to connect to the VirtualBox kernel service     Failed to connect to the VirtualBox kernel service     Script for cjkv started at run_im.     Script for default started at run_im.     QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.     QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.      So that's the error sheet that I've got I've tried searching up stuff from it but I haven't found any answers yet. For things I've done to attempt a fix; None of the session options from the login screen seem to help. Trying to `startx` doesn't help. I did a completely clean install and the problem has happened again, which makes me think its related to something I installed. When this had happened I had only installed 4 things; AMD Catalyst control beta drivers, Steam, burg and burg manager, and transferred my Firefox profile over from a backup. So yeah does anybody have any idea whats going on? I don't want to do a fresh install again since it seems fruitless. oh also if it makes any difference my `/home` is on a separate partition which I've kept between fresh installs. I suppose there could be something in there thats causing the `xsession` error but I don't know what.


Adblock rule to block g+ / twitter / etc.

Looks like this rule works to blocking facebook domain, when not visiting the facebook domain (ex.: "like/share" etc. buttons on other pages then facebook):               ! don't allow facebook outside facebook..     ||facebook.com$domain=~www.facebook.com     ||facebook.net$domain=~www.facebook.com     ||fbcdn.net$domain=~www.facebook.com     facebook.com###appsNav     facebook.com###pagesNav     facebook.com###groupsNav     facebook.com###pagelet_friends_online     facebook.com###pagelet_bookmark_nav     facebook.com###pagelet_rhc_footer      But how can I block completely twitter / g+ / etc sites with adblock rules? (Is this really effective, or it only makes me not to see the fcb buttons/etc.)?


Preventing zsh from using aliases in CWD (prompt)

I have the following personalized theme activated with `oh-my-zsh` (latest version of `zsh` and `oh-my-zsh`):               local return_code="%(?..%{$fg[red]%}%? %{$reset_color%})"          local user_host='%{$terminfo[bold]$fg[green]%}%n @ %m%{$reset_color%}'     local current_dir='%{$terminfo[bold]$fg[cyan]%} %~%{$reset_color%}'     local rvm_ruby=''     local git_branch='$(git_prompt_info)%{$reset_color%}'          PROMPT="${user_host} %D{[%a, %b %d %I:%M:%S]} ${current_dir} ${rvm_ruby} ${git_branch}     %B$%b "     RPS1="${return_code}"          ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"     ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"      I have noticed that in the prompt, whenever I have an alias to a directory, it displays the name of the alias as my current directory as opposed to the actual path. While this is an interesting feature, I would like to disable that. I am relatively new to `oh-my-zsh`, and I am not sure if this is an `oh-my- zsh` or `zsh` feature, but how can I disable it?


pureftpd - login authentication failed

I am on openSUSE 10.2, using pure-ftpd v1.0.21 I've added new virtual user, but I cannot connect (password is ok) Output of verbose log:               Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [INFO] New connection from xxx.yyy.zzz.uuu     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 220-Welcome to Pure-FTPd.     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 220-You are user number 1 of 10 allowed.     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 220-This is a private system - No anonymous login     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 220-IPv6 connections are also welcome on this server.     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 220 You will be disconnected after 15 minutes of inactivity.     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] Command [user] [someuser]     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 331 User someuser OK. Password required     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] Command [pass] [<*>]     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 530 Login authentication failed     Apr 10 17:10:35 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [WARNING] Authentication failed for user [someuser]     Apr 10 17:10:41 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [INFO] Logout.     Apr 10 17:10:41 hostzzz pure-ftpd: (?@xxx.yyy.zzz.uuu) [DEBUG] 530 Logout.      It's an old production server, and apparently there are some ftp users who can connect, so it seems that's a new user problem only Any ideas for further debugging? Some others logs to check? Some configuration to verify?


How to delete lines where the given part of the line is more than 100 chars?

I know I can delete lines that are longer than 100 chars with this:               sed '/^.\{100\}..*/d'      But I have the following example line:               YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
      So I need to only delete the lines where "YYY":               ">Y...Y...Y
      is longer than 100 chars. How can I do this? I'm using OpenBSD.


How does ACL calculate the effective permissions on a file?

I ran the following command to give the `wheel` group `rwx` permissions on new files and subdirectories created:               [belmin@server1]$ ls -la     total 24     drwxr-sr-x+   2 guards guards  4096 Aug 27 15:30 .     drwxr-xr-x  104 root   root   12288 Aug 27 15:19 ..          [belmin@server1]$ sudo setfacl -m d:g:wheel:rwX .          [belmin@server1]$ getfacl .     # file: .     # owner: guards     # group: guards     # flags: -s-     user::rwx     group::r-x     group:wheel:rwx     other::r-x     default:user::rwx     default:group::r-x     default:group:wheel:rwx     default:mask::rwx     default:other::r-x      However, when I create a file as root, I am not completely clear how the `effective` permissions are calculated:               [belmin@server1]$ sudo touch foo          [belmin@server1]$ getfacl foo     # file: foo     # owner: root     # group: guards     user::rw-     group::r-x                      #effective:r--     group:wheel:rwx                 #effective:rw-     group:guards:rwx                #effective:rw-     mask::rw-     other::r--      Can someone elaborate on what this means?


Replacing pattern after nth match is found on each line?

I have a file containing lines:               india;austria;japan;chile     china;US;nigeria;mexico;russia      I want to replace all the occurences of semicolon on each line with e.g. `;NEW;`, but starting from the 2nd occurence only. The result should look like this:               india;austria;NEW;japan;NEW;chile     china;US;NEW;nigeria;NEW;mexico;NEW;russia      I tried this with gsub, but it replaces all the occurences: `awk '/;/{gsub(/;/,";NEW;") }{print}'`


How to get cinnamon window styling

I think I may have chosen `Mint-with no codecs` from the downloads section. What should I do to get the nicer `cinnamon` window styling as in this page?. I have attached a file to show how my window title bar looks like.               2026:rag@rag-work-laptop:~/Documents$  findp muffin     rag       8195  2757  0 17:56 pts/0    00:00:00 grep --color=auto -i muffin          2027:rag@rag-work-laptop:~/Documents$  findp cinnamon     rag       1771  1214  0 14:05 ?        00:00:00 gnome-session --session cinnamon     rag       1848  1771  0 14:05 ?        00:00:00 /usr/bin/ssh-agent /usr/bin/dbus-     launch --exit-with-session gnome-session-cinnamon     rag       1851     1  0 14:05 ?        00:00:00 /usr/bin/dbus-launch --exit-with-session gnome-session-cinnamon     rag       2101  1771  2 14:05 ?        00:04:42 /usr/bin/cinnamon      display managers:               2028:rag@rag-work-laptop:~/Documents$  findp gdm     rag       8199  2757  0 17:56 pts/0    00:00:00 grep --color=auto -i gdm          2029:rag@rag-work-laptop:~/Documents$  findp mdm     root      1213     1  0 14:05 ?        00:00:00 /usr/sbin/mdm     root      1214  1213  0 14:05 ?        00:00:00 /usr/sbin/mdm     root      1244  1214  1 14:05 tty8     00:04:16 /usr/bin/X :0 -audit 0 -auth /var/lib/mdm/:0.Xauth -nolisten tcp vt8     rag       8201  2757  0 17:56 pts/0    00:00:00 grep --color=auto -i mdm      window managers: before i tried installing `muffin`               2041:rag@rag-work-laptop:~/Documents$  dpkg -l | g muffin     ii  gir1.2-muffin-3.0                           1.1.2+nadia                               amd64        GObject introspection data for Muffin     ii  libmuffin0                                  1.1.2+nadia                               amd64        window manager library from the Muffin window manager     ii  muffin-common                               1.1.2+nadia                               all          shared files for the Muffin window manager      I have now installed `muffin` but muffin does not start on X start up and I still have the same old style.               2056:rag@rag-work-laptop:~/Documents$  dpkg -l | g -i muffin     ii  gir1.2-muffin-3.0                           1.1.2+nadia                               amd64        GObject introspection data for Muffin     ii  libmuffin0                                  1.1.2+nadia                               amd64        window manager library from the Muffin window manager     ii  muffin                                      1.1.2+nadia                               amd64        lightweight GTK+ window manager     ii  muffin-common                               1.1.2+nadia                               all          shared files for the Muffin window manager


Why does it take up to several minutes to clean a listening TCP port after a program dies?

If I kill a program that is listening on a TCP port, it takes up to several minutes until the port is reclaimed by the system and usable again. I've seen several Q/A mentioning this phenomenon, but without an explanation. Why does that happen, why doesn't the system reclaim the port right away? Does it also happen on another systems, such as Windows or Mac?


rsh shows "poll: protocol failure in circuit setup", why?

In the starting rsh worked properly, but after making some changes it shows some error [changes are shown in the end of this question, see that], I am sharing the same. **Command** $ /usr/bin/rsh localhost ulimit -n **Output**               poll: protocol failure in circuit setup      After facing this problem, I followed this link, but didn't get any help. It works properly, but when I made some changes, from this link, then after that it shows the output as above. Now I revert all changes, but it shows the same output. Why? These are the lines that I added in files, showing in left hand side, by seeing the above link.               /etc/pam.d/login:       session    required     pam_limits.so     /etc/pam.d/sshd:        session    required     pam_limits.so     /etc/pam.d/su:          session    required     pam_limits.so     /etc/pam.d/system-auth: session    required     pam_limits.so      Here is the link of what I am trying to do. **Edit No. 1** `strace -o log.txt rsh localhost pwd`, some lines of output are as,               connect(3, {sa_family=AF_INET, sin_port=htons(514), sin_addr=inet_addr("127.0.0.1")}, 16) = 0     socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4     bind(4, {sa_family=AF_INET, sin_port=htons(1022), sin_addr=inet_addr("0.0.0.0")}, 16) = 0     listen(4, 1)                            = 0     write(3, "1022\0", 5)                   = 5     poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}], 2, -1) = 1 ([{fd=3, revents=POLLIN|POLLERR|POLLHUP}])     write(2, "poll: protocol failure in circui"..., 40) = 40     close(4)                                = 0     close(3)                                = 0     rt_sigprocmask(SIG_SETMASK, [], [URG], 8) = 0     exit_group(1)       **Edit no. 2** **Command** - `strace ~/rshd.trace in.rshd` **Output**               execve("/usr/sbin/in.rshd", ["in.rshd"], [/* 22 vars */]) = 0     brk(0)                                  = 0x2b3054ec2000     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b303671d000     uname({sys="Linux", node="jhamb.XXX.XXX", ...}) = 0     access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b303671e000     arch_prctl(ARCH_SET_FS, 0x2b303671e6d0) = 0     --- SIGSEGV (Segmentation fault) @ 0 (0) ---     +++ killed by SIGSEGV +++


Cron job to delete files older than 3 days

I need to remove files older than 3 days with a cron job in 3 different directories. (these 3 directories are children of a parent directory `/a/b/c/1` & `/a/b/c/2` & `/a/b/c/3`) Can this be done with one line in the crontab?


How to give All privilege rights to user ubuntu 12.04

I am working with my first VPS.I created a new user                   adduser username      and then I added this line                  username ALL=(ALL:ALL) ALL      under root in                  visudo      I saved the changes and exit the editor but my new user don't work as root. (i.e. when i want to restart apache it asks me to login as root) Is anything else I have to do? Thanks in advance!


Rsync large dir, bigger than destination, need to stop and start

I have an Ubuntu server with 4TB storage. Most of it is taken up by one dir. I was told the dir was about 1.5TB, so I attached a 2TB drive on USB, and started a rsync -arW inn tmux to copy it over. Now I have figured out it is about 3.6TB. I have the USB drive on /dev/sdb1. If CTRL Z that rsync, swap out the 2TB drive for another, will it start back up? Or do I have to copy the data already there to, say a 4TB drive, swap that into the enclosure on sdb1, and restart.


brasero.toc.bin is very big -- why?

I have a file in my home directory: brasero.toc.bin, which ls gives as:               -rw-rw-r--. 1 Harry Harry 633M 2013-09-26 15:53 brasero.toc.bin      in fact it is the second largest file listed, only sdc at 1.9G is bigger. My question is, please, what is it, why is it so big, does it matter, and should I do anything abut it?


How do I install TazPkg in SliTaz Linux

How do I install TazPkg in SliTaz Linux? Usually to install tazpkg packages you need TazPkg but I unsintalled TazPkg because it was broken now how do I install it again?


Livesearch with first 10 matches as preview for zsh-history?

I have seen a history-livesearch with a preview, that shows the 10 first matches in the history in a list below the BUFFER-line, which is updated on every keystroke, and acts like the standard ctrl+r search the rest of the time. (But the user who has that feature is gone for 3 weeks and unreachable) **tl;dr: Does anyone know this plugin/script and can link it to me** or help me programm it with updating the list properly? my current code looks like that, but has no updating (just the static list from the start and the search does not look totally naturally)               zle -N search          bindkey "^R" search          search () {     echo "";     fc -ln -30 | grep $(printf "%q\n" "$BUFFER");     <standard-history-backwards-search-widget>; #not on linux atm     }


Wget fails to download PNG files from Blogger

I am trying to mirror a blogger site so that I can have an exact copy of it on my filesystem to view. I have tried issuing the following command on Linux:               wget -r -k -x -e robots=off --wait 1 http://your.site.here.blogspot.com/      I have even tried using the -D flag to list a comma-separated list of domanins to follow (would prefer to just follow any domain though without having to specify all of them). I have even tried changing the .com part of the URL to the top-level domain for my country (.it) (without which for some reason I don't understand and would like to know, wget retrieves only index.html and no other page, perhaps someone here can explain why). So, even when I do a               wget -r -k -x -e robots=off --wait 1 http://your.site.here.blogspot.it/      several HTML and also the favicon.ico are downloaded but none of the .png images from blogger are downloaded. Why is this so and how can I get wget to work properly. I've read the wget man page but had no luck. Thanks.


mount changes directory permissions to admin:admin?

I'm mounting a samba share from one CentOS server to another using:               mount -t cifs -o blarg,password //10.151.170.170/events /var/blarg/copy-to      When I do this the permissions of `/var/blarg/copy-to` change to admin:admin. When I unmount using `umount //10.151.170.170/events` the permissions change back. I don't want this to happen as this affects some other functions. **How can I prevent the permissions changing to admin?**


How do I run the same linux command in more than one tab/shell simultaneously?

Is there any tool/command in Linux that I can use to run a command in more than one tab simultaneously? I want to run the same command: _./myprog argument1 argument2_ simultaneously in more than one shells (I want to increase this so as to put my code under stress later on) to check if the mutexes are working fine in a threaded program. I am kind of looking for something like what wall does. I can think of using tty's, but that just seems like a lot of pain if I have to scale this to many more shells.


What is the size of the TaskList?

While reading through the Linux Kernel Development by Robert Love, I went through the following line : > The kernel stores the list of processes in a circular doubly linked list > called the task list. I would like to know what is the size of this Task list.


Changing the bash prompt

Where is the setting that determines what the bash prompt looks like? Specifically on Arch, but I'm sure others would like to know for other distros too if it's different. Speficially I'd like to use (K)Ubuntu's prompt


for loop with multiline data

I need to create a script with a loop through a list of items. I want to insert a string in the script. I tried:               for i in "     a     b     c";     do      echo "test "$i     done      But that only outputs one string:               test a b c      How would I get this?               testa     testb     testc      (`a`, `b` and `c` are just examples for some longer words, which I got from an OpenOffice Calc file)


Is there a back-"button" in w3m?

Does w3m offer a keyboard shortcut to go back one page? I couldn't find anything in the man pages.


Am I installing CentOS 5.5 right?

I'll probably be in here a bit over the next few months. The only exposure I've had to Linux is just some basic dabbling with Ubuntu and using Knoppix as a recovery DVD for when things go wrong. I need to setup a VM with CentOS 5.5 64bit. I downloaded the iso from the main site. Have mounted it with VMWare workstation. This link seems to be the best one I can find on getting things setup. However it differs to some of the YouTube videos I have seen installing 5.4 Should I be doing a Network Installation? Theres a step in the above guide that points to a mirror to pull the image from a webserver. Surely the image is on the ISO I downloaded? However, I do not see any other option to install other than network install. Can anyone tell me where I am going wrong? I am sure it is something silly.


How to calculate (weighted) majority over columns?

I have two files: the first one contains lines where the first column is an ID, and the remaining columns are votes, e.g. > 3242 -1 1 -1 1 1 1 In a first step I want to calculate the majority for the IDs. For the example above, the vote is 1 (since there are more positive votes then negative ones). I would like to store the results in an output file with lines such as > 3242 1 I also have a file that contains the 'weights' of the respective votes, e.g. > 3242 0.9 0.1 0.9 0.2 0.1 0.2 In a second step, I also want to calculate the weighted votes for the different lines. In this case this would be > (0.9 * -1) + (0.1 * 1) + (0.9 * -1) + (0.2 * 1) + (0.1 * 1) + (0.2 * 1) = > -1.2 The result is negative, so the vote should be -1. Again, I would like to store this in an output file, where each line contains the ID and the resulting vote. Would this be possible with awk, perl,...?


getopts - how to avoid read next $OPTARG as argument?

Just started use getopts and found one problem... For example - have a script with:               while getopts "h:loav" opt; do     case $opt in     h)       h=$OPTARG       echo $h       ;;      But whet I run it:               $ ./ftpclean.sh -h -l     -l      I got second option as argument for first option... So - if user forgot set argument:               $ ./ftpclean.sh -h argument     argument      `getopts` will set `echo *second option*`... Is there any "legal" way to avoid it? Best solution wich I found - is to add function:               function checkargs () {     if [[ $OPTARG =~ ^-[a/l/o/a/v]$ ]]       then       echo "OPTERR"       exit 1     fi     }      And run it before set variable:                while getopts "h:loav" opt; do       case $opt in     h)       checkargs       h=$OPTARG       echo $h       ;;      So now:               $ ./ftpclean.sh -h -l     OPTERR


!fmt for current line only

When I want to format part of text with `fmt` in `vim` I usually select parts of interesting lines in Visual Mode, with: `Ctrl`+`V` `Arrows`, and than type `!`+`f`+`m`+`t`. When there are couple of lines they are other ways of doing this:               :11,22!fmt      When text to be formatted is places between 11 and 22 line. For one line I could write :               :22!fmt      But this is not comfortable to type new number, each time I change line. Is there a way of doing this : `:22!fmt` without `22` but some mark, variable, that means _"current line"_ ?


FreeBSD zfs timeout errors

I have FreeBSD 8.2 with ZFS v28. 8 cpu core, 16Gb ram. Two disk drives (1.5Tb WD Green) on zfs mirror raid. My system strangely uses memory. With alot of free (wired) memory it start to use swap and then doesn't clean it! Swap usage keeps growing. munin-graph swap And then I see on my kvm this messages: ![kvm log](http://i.stack.imgur.com/Q57TO.png) All file reads or writes seems very slow. When I use ssh and for example do `nano /etc/rc.conf` it pauses for 3-5 seconds before it works. Will my disk drives die soon? Or is the problem elsewhere?


How can I retain the console input in mplayer when reading from stdin?

I'm playing around with the **command line interface** of `mplayer`. I'd like to script it in the following way               find /some/path/ -type f | grep -vif blacklist | mplayer -shuffle -playlist -      where `blacklist` is a text file with artist or song names I'd rather ignore when I have visitors or my son is around (lot's of swear words... :D) When `mplayer` encounters the `-` character, it disables the console input. From the man page:               -noconsolecontrols               Prevent MPlayer from reading key events from standard input.                 Useful when reading data from standard input.  This is automatically                 enabled when - is found on the command line. [snip]      This blocks me from seeking in the file and skipping individual songs. Funnily, this works for videos, because the video window still accepts the usual keyboard inputs. How can I have the regular console input back? I would like to avoid using a temporary file, although this is of course the easiest solution. `-slave` and `-input` don't seem suited and trying `-consolecontroles` does not work.


Linux open source tool for Request tracking, Inventory control and MRBS

I have installed the `Request tracker tool` in my RHEL machine. I have also a meeting room booking system (MRBS) in my RHEL machine. Also, I can see there are some open source `Inventory of items tools` available. I wanted to know if there is any open source tool which has all these 3 features combined together so that I can use a single login to all these tools.


No sound in USB headphones using fedora 16

The volume control buttons on the usb headphone work, they can increment or decrement the system sound.   However the **headphone have no sound**. How to make it work? kernel 3.2, pusleaudio is used by default.


Running an application with alternate/modified system time

I am looking for a way to start an application with an alternate system time than that which is set. Basically one of the beta programs I use has a bug (it really is a bug) that no longer lets it work past January 29th. Setting my system time to a few day prior fixed the issue and the app works fine now. However some of my other applications are not working properly anymore. As a general question (I could see my self using this for other things), is it possible to launch an application and make it think there is an alternate system time? Specifically though, I am running Mac OS 10.7.2 and I'm trying to launch MouseShare with an alternate system time than that which is set.


Debian install failed, grub

I have been trying to install debian wheezy on my desktop with no sucess. During the install when I get to the grub screen it says if I see my operating systems listed to go ahead with grub. During this screen it only lists windows vista(loader)(this is actually windows 7) but no debian. I succesfully installed debian on my laptop no problem with the same disk, my laptop only runs debian in comparison though. After the install and my computer loads past my BIOS I get a black screen with a blinking cursor in the top left corner. I believe that debian has installed properly but that grub did not.


Problem in secure copying (scp) filenames with spaces

I am trying to copy files using secure copy(scp). I am trying to execute the following command but I get error due to the space in the absolute path of the location of the directory.               scp -r -P 8484 root@172.31.72.103:/media/New Volume/lj /home/pratheep      I am getting the following error:               scp: /media/New: No such file or directory       scp: Volume/lj: No such file or directory      I tried using the same command putting extra back slash like               scp -r -P 8484 root@172.31.72.103:/media/New\ Volume/lj /home/pratheep      but I am still getting the same error. Can somebody tell me how to correct it?


"ss" command in iproute package; why query slab table for timewait sockets?

Forgive me if this isn't the best forum for this question, but it seems more relevant to the kernel than to the programming itself. I'm writing a script that queries the system for open ports so that we can graph and monitor the statistics. For this, I'm using the "ss" command from the iproute package. If you execute `ss -s|grep estab` you will receive output similar to this:               TCP:   296 (estab 6, closed 238, orphaned 0, synrecv 0, timewait 238/0), ports 0      My question has to do with the timewait variable, which shows the computed sockets in TIME_WAIT state. When I tried to figure out what number was referenced after the slash, it became a whirlwind adventure of searching for source code which ultimately led me to find the following snippet:               printf("TCP:   %d (estab %d, closed %d, orphaned %d, synrecv %d, timewait %d/%d), ports %d\n",            s.tcp_total + slabstat.tcp_syns + s.tcp_tws,            sn.tcp_estab,            s.tcp_total - (s.tcp4_hashed+s.tcp6_hashed-s.tcp_tws),            s.tcp_orphans,            slabstat.tcp_syns,            s.tcp_tws, slabstat.tcp_tws,            slabstat.tcp_ports            );      I must admit, my searching for what "slabstat" was supposed to mean ultimately led to my learning about the slab caches and their reporting interface at /proc/slabinfo. The question: What does the slabtable have to do with TIME_WAIT socket calculations? I'm failing to figure out why this number is reported, as every time I've run the command across every server I've tried it on, the number has always been zero.


Where does the -i option in sed store the lines matching a regex?

I am trying to release space in my server's hd so I'm matching old dates in a log file with sed and it is decreasing but my root partition is now using 98% percent of it's space instead of 91% it was using before I invoke sed. I did this `sed -i '/^Jan/ d' file.log` and my log file decrease from 6G to 400M. I'm using `find / -size +1G` trying to search a temporal file or something like that but it's not matching new files. **Edit:** I did `echo -n > file.log` to avoid a service crash but it's temporal because the issue remains


sort output by column

I'd like to take this command `find -maxdepth 1 -type d | while read -r dir; do printf "%s:\t" "$dir"; find "$dir" | wc -l; done` ( from here ). which has an output of basically               ./kennel:       11062     ./shadow:       15449     ./ccc:  9765     ./journeyo:     14200     ./norths:       10710      and sort it by the numbers largest to smallest. but I'm not sure how to make `sort`, or whatever operate on a different column.


What is /usr/local/bin? Came across it in an script installation for Applescript but would like to know more

Before today, I've used Terminal to a limited extent of moving in and out of directories, changing the dates of files using the `touch` command, but had realised the full extent of Terminal after installing a fun script in Mac and having to `chmod 755` the file to make it executable afterwards. I'd like to know what is /usr/local/bin though. /usr/, I assume is the user of the computer. I'm not sure why /local/ is there though. It obviously stands for the local computer, but since it's on the computer (Or a server), would it really be necessary? Wouldn't /usr/bin be fine? And what is /bin? Why is this area usually used for installing scripts into Terminal?


Connect psftp between Unix and Windows server

I need to transfer files from Unix to Windows server. After creating a folder in the windows server files need to be copied from Unix to Windows. I am using `psftp` to do this process.So, I am trying to automate this process using shell script but I do not know how to connect Unix and Windows by using `psftp` in the shell script. Please some one guide me on this.


Get X to ignore specific mouse?

I have a program which needs control of a mouse. I have a specific mouse attached for this, and I would like X to leave it alone. Unfortunately whatever mechanism in X autodetects and configures input devices, it is overriding any settings I make in Xorg.conf. I know this because:   * I have disabled "AutoEnableDevices" in Xorg.conf, and this stops it from interfering with my mouse. Unfortunately this is not a solution as it also stops it from correctly configuring my other mouse and keyboard, as a result buttons on both devices do not work correctly. (I know this is because my manual configuration of these devices in Xorg.conf is wrong, but I don't know how to fix it and can't find any helpful documentation.)   * The second mouse has its own entry in Xorg.conf, along with /input/mice, and both have the driver set to void. Also, when I made a mistake configuring the first mouse it still worked when AutoEnableDevices was set. **How do I stop X using the second mouse?** (I have tried disabling the device using xinput, but it always ends up re- enabled after a minute or so. This may be because I am changing permissions so my program can access it without su privileges, but again I need to do that and would prefer a more stable solution than not touching it in the hope that udev forgets its there...)


Command not working in shell script, but works on command line

I have a shell script that executes the following command:               bash -c "screen -dmS node /home/nodejs/bridge/bridge.js"      However, the screen is not being started. Typing the command...               screen -dmS node /home/nodejs/bridge/bridge.js      ...in a terminal(logged as the same user that launches the script) the screen starts up properly.


Playing mkv files

I'm having trouble playing mkv files in Kaffeine, or any other player on openSUSE, which generally doesn't come with this type of codec. I've already installed a mkv codec that I found in the openSUSE repository. Still, the player can't play this format. I tried installing VLC with a built-in codec for mkv, but ended up with lots of problems and decided to back out. What solution could I use to solve this problem?


Why was '~' chosen to represent the home directory?

I have often wondered why the `~` represents the home directory of a user. Is there a reason behind this, or is it just some infrequently used character?


How is /proc/self implemented in Linux?

I was tinkering around with the `/proc` filesystem in Linux, and I came across `/proc/self`, which is a symbolic link to the process directory of the current process. I would like to know how it is implemented. One solution would be to change that symlink on _every context switch_ , but that's obviously very expensive as it involves a disk access.


How to Create a Unix Executable File

Is it possible to create what the Mac Finder specifies as a "Unix Executable File" and run it in Terminal like any other command instead of creating a `.sh` or `.command` file? If so how and where can I learn how to make them? If not, how can I create a `.sh` file that can take options? For example, with the `ls` command you can type `ls -a` to list invisible files as well as visible ones. How can make an executable that will only execute certain code with a `-a` option?


Cancel SSH (after using it to browse) without logging out?

I'm afraid I'm not an expert on Unix and its command line (I'm using a Mac), so do bear with me (possibly an extremely stupid or basic question). I've used the command `ssh -D 8080 -f -C -q -N user@IP` to SSH into a VPS and set it to browse in the SOCKS proxy settings in System Preferences (on my Mac). How do I cancel the SSH session (and browse normally) without having to log out? Edit: I know `Ctrl`+`C` 'cancels' certain commands that are running, but once I do the `ssh -D` it immediately logs out of the VPS. Also, unrelated question: Does logging out cancel the SSH 'binding' on the port?


where is `/var/www` in arch

I install Apache web server in arch Linux, my Apache work(when i type localhost in my browser see this:               Apache/2.2.25 (Unix) mod_ssl/2.2.25 OpenSSL/1.0.1e DAV/2 PHP/5.5.7 Server at localhost Port 80      i don't have `/var/www` folder, I created this but when I create a simple file like `index.html` i have 404 error. how i can fix this error?


Apache2 does not run on IPv4 tcp port

Can you help me please. I need run Apache2 on my Debian 7 server. But it run only on tcpv6 port, not on tcpv4 port. I installed it with apt-get install. I read some tips for this problem, but it does not help me. And if I go to localhost or 127.0.0.1 or my server IPv4 address it does not display any website. My `/etc/apache2/ports.conf`:               # If you just change the port or add more ports here, you will likely also     # have to change the VirtualHost statement in     # /etc/apache2/sites-enabled/000-default     # This is also true if you have upgraded from before 2.2.9-3 (i.e. from     # Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and     # README.Debian.gz          NameVirtualHost *:80     Listen 80          <IfModule mod_ssl.c>      # If you add NameVirtualHost *:443 here, you will also have to change      # the VirtualHost statement in /etc/apache2/sites-available/default-ssl      # to <VirtualHost *:443>      # Server Name Indication for SSL named virtual hosts is currently not      # supported by MSIE on Windows XP.      Listen 443     </IfModule>          <IfModule mod_gnutls.c>      Listen 443     </IfModule>      `netstat -plntu`:               tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      3558/sshd            tcp        0      0 0.0.0.0:3466            0.0.0.0:*               LISTEN      2820/mysqld          tcp6       0      0 :::80                   :::*                    LISTEN      2097/apache2         tcp6       0      0 :::22                   :::*                    LISTEN      3558/sshd


Installed library packages cannot be found on OpenWRT

I have been compiling / installing custom packages for OpenWRT. I kept running into problems when I was compiling getting errors like:               Package x is missing dependencies for the following libraries:     libc.so.6      I solved this by adding the line `libc.so.6` to a `libc.provides` file. Now I am running into this error: ![OpenWRT Screenshot](http://i.stack.imgur.com/jULUa.png) Even though the packages are installed (in the list of installed packages and in the `bin` folder), they don't get run when I type them in. Somebody suggested that it may be because a linked library is missing. If anybody has any idea, I would appreciate any comments! **Update** In another install where `amld` **is working** , and `amldmonitor` **is not**               root@OpenWrt:~# file /bin/amld     /bin/amld: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), corrupted section header size     root@OpenWrt:~# file /bin/amldmonitor     /bin/amldmonitor: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.24, dynamically linked (uses shared libs), corrupted section header size      Question on r/openwrt


Two questions about building packages from source on Manjaro

I recently asked this question which was closed for being unclear. I'll ask clear questions now, and I hope to get clear short answers, not a link to Arch Wiki. I'm on Manjaro Openbox, no Internet, Yaourt isn't installed by default, I need to build packages from source, and not any package, lets be clear, I want to build this package. I have two questions.   * Is Abs installed by default on Manjaro or do I need to install it before building? * * *   * Makepkg: gives permission denied   * Sudo Makepkg: using sudo is a bad idea, use --asroot instead   * Makepkg --asroot: gives permission denied   * pacman -U broadcom-wl-5.100.138.tar.bz2 gives error or the file maybe damaged or something, can't remember, i tried it again and again with different packages and didn't work. * * * So how do you build that particular package on an Arch/Manjaro system? I want a short answer, Majaro forum users gave me every single page of ArchWiki to read, I don't want to see ArchWiki anymore please, if I was willing to waste a day building packages, I would have gone for Arch, not Manjaro, I think any Manjaro user would have done the same. * * * **Edit** I need fakeroot to install packages, I can't install base-devel using pacman, no Internet, how to install it from source?


Dir diff and removal

Is there a simple way to (recursively) remove all files from a directory A that are identical (same name and same hash) to files in directory B while preserving the structure? e.g. A/file1 gets removed if B/file1 exists; but A/file1 gets not removed although B/d/file1 exists


gpg-agent fail: undefined symbol gpg_err_set_errno

We started to get some odd issues yesterday; possible due to a yum install gone bad? One of the issues, PS -ef hanging indefinately (actually an ps command that looks at other user state) was fixed with a reboot. However we still have two issuse. When trying to run vncserver I get an error that:               Gtk-Message: Failed to load modle "canberra-gtk-module": libcanberra-gtk-module.so: cannot open shared object.      This error is valid; because the libcanberra-gtk-module does not exist anywhere on our system. I would just remove the module from the list to load, as I think it's non-mandatory, but I don't know what is causing vncserver to try to load it. The more important error though is GPG-agent. We get the error a few places, but it boils down to the fact that when I try to run gpg-agent I get the error:                ImportError: /usr/local/lib/libgcrypt.so.11: undefined symbole: gog-err-set_errno      none of the files listed on the gpg-agent man page even seem to exist. We tried re-installing libgpg-error package which didn't fix anything. Any idea what would cause this, or how to debug it? Thanks.


Opening TTY or using IBus freezes Linux?

For some reason, whenever I open a TTY, if I switch back to X11, it will be completely frozen except for the cursor. The exact same thing also happens whenever I use IBus to switch to ibus-mozc for Japanese input, or try to open the IBus settings application. Linux 3.11-2 under Crunchbang (Debian) upgraded to Testing. IBus 1.5.3-7 ibus-mozc 1.11.1522.102-2 EDIT: I uninstalled IBus and now the TTY works fine, so presumably it was an IBus problem. I still don't know why IBus was causing that problem though.


Driver install, kernel source not found

I am trying to install a NVidia Cuda driver on a Amazon EC2. GPU instance (Amazon Linux AMI (HVM) 2013.09.2 - ami-e9a18d80) following the instructions laid out in a blog. It worked for the last two weeks, but today it fails. The instructions state               sudo yum -y groupinstall "Development Tools"     sudo yum -y install git libcurl-devel python-devel screen rsync yasm numpy openssl-devel     wget http://developer.download.nvidia.com/compute/cuda/5_5/rel/installers/cuda_5.5.22_linux_64.run     sudo sh cuda_5.5.22_linux_64.run      error is > Installing the NVIDIA display driver... The driver installation is unable to > locate the kernel source. Please make sure that the kernel source packages > are installed and set up correctly. If you know that the kernel source > packages are installed and set up correctly, you may pass the location of > the kernel source with the '--kernel-source-path' flag. There is a comment on the instructional on how to possibly fix but I do not understand the commands, I cant seem to navigate to the paths specified. If someone could explain it like I am 5 for me I think it would be helpful. > For people having trouble with installing CUDA (fails with some complaint > about the kernel source), here's the fix I found… The kernel source in > /usr/src/kernels wasn't the same version as the kernel I was running (which > you can find with `uname -r`). I went into /boot/grub/menu.lst and made sure > that the only enabled kernel version was the one I had the source for.


How to use a “hardware key” to control Linux networking

Sometimes I have trouble controlling myself while in front of the computer and I tend to procrastinate a lot doing Internet surfing. Fortunately I do not need Internet for most of my work. So I would like to have a way to completely disable networking on Linux. To enable it again I would need a USB stick which would act as a key. Do you have any advice how one could go about implementing such a scheme? Ideally the enabling/disabling of networking should be as quick and automatic as possible. Also I would like a solution which, once implemented, is easy to set up on different machines. EDIT: I have a similar set-up for my laptop, but it is not as automatic as I like. I simply delete all the wireless drivers and keep a copy of them on a USB stick. But this solution is not easily portable. So I am looking for ideas how to improve it.


Arch Linux, Openbox and Desktop

I' m installing Arch with OpenBox, I' ve done everything but when I type               openbox-session      I have this error               Failed to open the display from the DISPLAY environment variable.      What's the problem?


How to turn on Keyboard Autorepeat permanently on VMware instances of CentOS 6?

In my lab we have about 40-50 machines, all cloned with the same image of CentOS 6. For some reason the keyboard auto repeat function decides to randomly turn itself off. Typically we just have students type `xset r on` which will turn it on. However, all throughout the day and random intervals it turns itself off again. There seems to be nothing in common with the times it does it, or the actions that were being performed on the system at the time it turned off. Recently it will even remain off even after typing `xset r on` multiple times in a row as both root and a normal user. It's highly annoying and I can't seem for the life of me to figure out how to permanently turn this on. My only real solution I've thought of was to create a `cron` job that turns it on every minute or so, however this only seemed to work temporarily. Hours after it starts running it just turns off again and the script seems to be rendered null and void. I've tried adding it to start up scripts, bash_profile, xinit scripts etc. But it will not stay on. What may be causing this and how can I permanently fix it? I have found others with similar issues that seem to believe it has something to do with VMware's mouse and keyboard driver that allows seamless integration of desktops. Which could be the case since we do run VMware Workstation on the machines. But sometimes it will happen even if a Virtual Machine isn't running even after a fresh reboot. **UPDATE #1:** I found a few potential fixes when searching around. None of which have actually fixed the problem. Here is what I tried: **Potential Fix #1 (Unsuccessful)** Source: VMware update: Keyboard repeat problem solved Added: `divider=1- clocksource=acpi_pm` to `/etc/grub.conf` This didn't work, nor do I understand why it would work. But was worth a shot. Also this fix is for the Guest OS. My problem isn't related to the Guest, it's a problem with the Host which carries over to Guest OS's to include Windows and Linux VM's. **Potential Fix #2 (Unsuccessful)** Source: VMware and the fubar keyboard effect This user had a different problem with the keyboard keys remapping randomly. However, I thought I'd try his fix to see if it would fix mine. It was not successful. Add: `xkeymap.nokeycodeMap = true` to `/etc/vmware/config` (if it doesn't exist create it) http://sgros.blogspot.com/2012/01/keyboard-autorepeat.html **UPDATE #2** So I ran a search to see what files and processes have a handle on XChangeKeyboardControl since that is the function which controls the keyboard auto repeat toggle. Here is the command I ran and my results:               PATH=$PATH:$HOME/bin:/usr/lib:/usr/lib64:/usr/share:/usr/include:/usr/libexec          IFS=:; find $PATH -type f -exec grep -lw XChangeKeyboardControl {} +        My results were:               /usr/lib/vmware/bin/vmware-remotemks     " "                /vmware-vmx-debug       " "                /vmware-vmx       " "                /vmware-vmx-stats       /usr/lib64/libX11.so.6.3.0       " "       /gnome-settings-daemon-2.0/libkeyboard.so       " "       /libxklavier.so.15.0.0       /usr/share/vm/io/L-master/linuxop-cl1.vmdk       /usr/include/X11/Xlib.h      I also ran the same command searching for `"XAutoRepeatOff"` and found this string in `/usr/bin/expresskeys` which is some sort of program that enables the use of PDA's and tablets style stylus's with the system. But its not running and isn't loaded at startup. **UPDATE#3** Note I verified I am using VMware Workstation 9.0. So all answers I've found that simply suggested upgrading to 8.0+ shouldn't really work. Still no resolution to this problem.


where is browser.js file in firefox in rhel?

i want to modify the browser configuration and i was unable to find "browser" java script file in installation directory i.e. /.Mozilla/Firefox/default/profile/. please provide me the link for browser.js


How to get a list of images in a a prticular folder?

My folder contains 5 -6 images, I want to display a list of the names of all images only. However the folder contains two text files.


allowing users to access certain ports on server

I have an RHEL 6 system which has 20 users. I have 20 ports on which separate versions of a service is running. I want user a to access port a, but not other ports. Is there a way to do this? (possibly by modifying iptables)?


How do I diagnose why Ubuntu is freezing?

I am running Ubuntu 12.04 LTS 64bit Desktop as a server at home. I run a Teamspeak server, and some php scripts every minute. After 12 to 168 hours (1 week) of being online, the server will freeze. What displays on the monitor is the login screen background, but is completely unresponsive. I cannot access the server through Putty either. The only way to fix it is to hold the power button down to turn off, and then turn it back on. How would I go about diagnosing such an issue? I am very new to linux and have only been running this "server" for around 6 months.


How to parallelize the for loop while scp the files?

I am running my below shell script from `machineA` which is copying the files `machineB` and `machineC` into `machineA`. If the files are not there in `machineB`, then it should be there in `machineC`. The below shell script will copy the files into `TEST1` and `TEST2` directory in `machineA`..               #!/bin/bash     set -e          readonly TEST1=/data01/test1     readonly TEST2=/data02/test2     readonly SERVER_LOCATION=(machineB machineC)     readonly FILE_LOCATION=/data/snapshot          dir1=$(ssh -o "StrictHostKeyChecking no" david@${SERVER_LOCATION[0]} ls -dt1 "$FILE_LOCATION"/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] | head -n1)     dir2=$(ssh -o "StrictHostKeyChecking no" david@${SERVER_LOCATION[1]} ls -dt1 "$FILE_LOCATION"/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9] | head -n1)          echo $dir1     echo $dir2          if [ "$dir1" = "$dir2" ]     then         rm -rf $TEST1/*         rm -rf $TEST2/*         for el in $test1_partition         do             scp david@${SERVER_LOCATION[0]}:$dir1/pp_monthly_9800_"$el"_200003_5.data $TEST1/. || scp david@${SERVER_LOCATION[1]}:$dir2/pp_monthly_9800_"$el"_200003_5.data $TEST1/.         done         for sl in $test2_partition         do                 scp david@${SERVER_LOCATION[0]}:$dir1/pp_monthly_9800_"$sl"_200003_5.data $TEST2/. || scp david@${SERVER_LOCATION[1]}:$dir2/pp_monthly_9800_"$sl"_200003_5.data $TEST2/.         done     fi      Is there a way to run process parallelly in the loop of a bash script Currently it copies the file from `machineB` and `machineC` into `machineA` `TEST1` directory first, and if it is done, then only it will go and copy the files from `machineB` and `machineC` into `machineA` `TEST2` directory.. Is there any way I transfer the files both in `TEST1` and `TEST2` directory simultaneously? I am running Ubuntu 12.04


sed regex issue

I'm trying to replace a string in a file:               $RELEASE     = '1234';      The whitespace between RELEASE and the = symbol could be either spaces OR tabs. The quotes around the version number could be either single or double. I currently am assuming spaces and single quotes at the moment just to try to get it working:               sed 's/$RELEASE[[:space:]]*\=[[:space:]]*'\''[0-9]*'\'';/$RELEASE = '\''1234'\'';/g' config.ini > config.ini      So after a lot of work, this works. But only if the string is spaces (as apposed to tabs) and single quotes as apposed to doubles. Here is what I have so far for trying to tackle the tabs...:               sed 's/$RELEASE([[:space:]]|\t)*\=([[:space:]]|\t)*'\''[0-9]*'\'';/$RELEASE = '\''1234'\'';/g' config.ini > config.ini      I've just read that /t isn't supported in most sed regular expressions... Is this true? Is there a [[:tab:]] type replacement? (I did try that) Any help would be appreciated.


How do you view a sql.gz file as plain text SQL from the command line? I want to read the SQL statements stored in a `.sql.gz` file, from the command line on the server. I've tried `tar -xzvf`, but get `tar: This does not look like a tar archive`. `cat` returns garbage because it's compressed.


Play Video files in fedora

I installed a Fedora 18 and added rpm-fusion repositories for fedora18 and also installed all gstreamer codec such as good,ugly,bad, but i can not play videos with `.mkv` , `.mp4`, `.wmv` , extensions yet. it shows this error when I play a video file: ![enter image description here](http://i.stack.imgur.com/LhN91.png) ofcourse i should say that `.webm` and `.flv` videos play very well and I dont want to use **VLC**!


Copy/Mirror traffic to WAN interfaces without “iptables tee” support

I want to copy every outgoing packet to other WAN interfaces but my `iptables` (v1.2.7) doesn't have TEE target support. I wonder if there is another way (maybe using `iproute2` or `ebtables`) to copy every outgoing packet to an selected interface. I prefer another way than getting xtables-addons because I'm working with a embedded device (an UClinux distribution) and I would prefer avoid new versions of `iptables` (I don't know if the syntax remains the same among versions), cross-compiling problems or changing Makefiles.


How do I build a read-only Linux system that only writes to the RAM?

This is my current partition structure:               Filesystem            1K-blocks      Used Available Use% Mounted on     tmpfs                   127428         0    127428   0% /lib/init/rw     udev                    122976        96    122880   1% /dev     tmpfs                   127428         0    127428   0% /dev/shm     rootfs                  127428     11008    116420   9% /     /dev/sda1              1827534    933144    800029  54% /ro     rootfs.tmpfs            127428     11008    116420   9% /rw     rootfs.aufs             127428     11008    116420   9% /      I want to set up another system exactly like that, or at least close. The other disk looks like this, as shown by `df`:               Filesystem           1K-blocks      Used Available Use% Mounted on     /dev/hda3               678551    594050     84501  88% /     tmpfs                   124004         0    124004   0% /lib/init/rw     udev                     10240       520      9720   6% /dev     tmpfs                   124004         4    124000   1% /dev/shm     /dev/hda1                19515     15940      3575  82% /boot     /dev/hda2               253807      7002    246805   3% /var/log_compressed     tmpfs                   124004         0    124004   0% /tmp     tmpfs                   124004      3552    120452   3% /var/log     tmpfs                   124004         0    124004   0% /var/tmp     tmpfs                   124004        20    123984   1% /var/run     tmpfs                   124004         0    124004   0% /var/lock     tmpfs                   124004         0    124004   0% /var/spool      I read a lot, but I don't know how to set this up using unoinfs or initramfs. I will really appreciate help and explain I did read a lot and but I don't get how to do it by unoinfs or initramfs .


How do I diagnose a font rendering problem?

I recently updated my Fedora Rawhide system, and after doing so, fonts in Firefox (now 31) are ugly. But... not all of them. I traced it down to some fonts being rendered as "Helvetica" (the element inspector in Firefox tells me so), and this being rendered with no anti-aliasing. I don't think there is an open-source Helvetica, so something is being substituted. How can I:   1. figure out what font is actually being used,   2. discover why it isn't rendered nicely, and   3. fix the problem?


Why are directories created with permissions 2070 and files with 060 in a directory with setgid bit?

I have the following directory:               $ ll -d neptune     drwxrws---+ 5 beamin psych 4096 Mar  7 16:18 neptune          $ getfacl neptune     # file: neptune     # owner: beamin     # group: psych     # flags: -s-     user::rwx     group::r-x     group:sysadmins:rwx     group:psych:rwx     mask::rwx     other::---     default:user::---     default:group::r-x     default:group:sysadmins:rwx     default:group:psych:rwx     default:mask::rwx     default:other::---      I am logged in as `beamin`:               $ id beamin     uid=1000(beamin) gid=1000(beamin) groups=1000(beamin),2000(sysadmins)          $ umask     0002      However, when I create a directory or file, this is what I get:               $ cd neptune          $ mkdir dir          $ touch file          $ ll     total 8     d---rws---+ 2 beamin psych 4096 Mar  7 16:25 dir     ----rw----+ 1 beamin psych    0 Mar  7 16:25 file      Why is this?


Where do I find versions of Turnkey Linux made to run on 32-bit VirtualBox?

What I found on the main site turnkeylinux.org/core is the file turnkey- core-12.1-squeeze-amd64-vmdk.zip which I suppose is for 64-bit OSes (corrections accepted..).


How is built the initrd of a fresh install [RHEL55]

I'm trying to understand how is built the `initrd.img` file during an install process, I mean the one that will be boot up right after a fresh install. I updated the `initrd.img` file with new version of some drivers, I now need to update the "runtime" img (e.g : `initrd-2.6.9-89.ELhugemem.img`) file because the driver were loaded during the PXE boot but not after the install process. **Let me refine my question to:** Where should I put new modules (drivers) in order to make them available after the install process, given that I have a KS (Kickstart) infrastructure that does pre and post install steps? **My own answer (may not be the best) :** Looks like the initrd to be deployed after installation is nowhere, it looks like it is built using mkinitrd (but I am not sure), so I used our post-install scripts to handle the driver update process.


unrar for centos 5.7 needs unrar-4.20-2.mga3.nonfree.x86_64.rpm which causes an error

I'm trying to install unrar package for my cpanel. as some people suggested that I need this package `unrar-4.20-2.mga3.nonfree.x86_64.rpm` . So when I run `rpm -ivh unrar-4.20-2.mga3.nonfree.x86_64.rpm` I get this error:                   [root /]# rpm -ivh unrar-4.20-2.mga3.nonfree.x86_64.rpm     warning: unrar-4.20-2.mga3.nonfree.x86_64.rpm: Header V3 RSA/SHA1 signature: NOKEY, key ID 80420f66     error: Failed dependencies:         libc.so.6(GLIBC_2.14)(64bit) is needed by unrar-4.20-2.mga3.nonfree.x86_64         libc.so.6(GLIBC_2.7)(64bit) is needed by unrar-4.20-2.mga3.nonfree.x86_64         rpmlib(PayloadIsXz) <= 5.2-1 is needed by unrar-4.20-2.mga3.nonfree.x86_64     [root /]#      I saw posts suggesting to install `EPEL` and still the problem exists. I didn't see a relevant for installing the `EPEL` but still I tried and nothing worked. Any suggestions will be much appreciated. **Note:** I have `Centos 5.7`


How do I re-encode a mixed encoded text file

I've got a log file that is ASCII, except for a few UTF-8 characters (which I can fix for a future version). For the moment, I need to figure out how to get this file to a viewable/searchable/editable state by gedit/less etc. `enca -L none file` returns `7bit ASCII characters Surrounded by/intermixed with non-text data`. `enconv -L none -X ASCII file` and `enconv -L none -X UTF-8 file` "succeed" but do not actually change anything. How do I go about fixing this file? ## Update (after some answers): Actually, as stated below (upvotes to all :)), ASCII + UTF-8 is UTF-8. What I have is               0003bbc0  28 4c 6f 61 64 65 72 29  20 50 61 74 69 65 6e 74  |(Loader) Patient|     0003bbd0  20 00 5a 00 5a 00 5a 00  38 00 31 00 30 00 34 00  | .Z.Z.Z.8.1.0.4.|     0003bbe0  20 6e 6f 74 20 66 6f 75  6e 64 20 69 6e 20 64 61  | not found in da|     0003bbf0  74 61 62 61 73 65 0d 0a  32 36 20 53 65 70 20 32  |tabase..26 Sep 2|      I believe it will be a will be ~~a cp1252-type encoding~~. _Actually, I don't know what it is the cp1252 will be a 1-byte for ASCII won't it?_ _Incidentally, the fact that linux barfs on this helped me figure out that an input file (where the id's came from) was encoded badly..._


How to achieve the effect of chroot in userspace in Linux (without being root)?

The goal is to install and run programs in a displaced (relocated) distro (whose / must not coincide with the global /) inside a host Linux system. The programs are not adapted for using a different / . fakechroot is not a complete solution because it employs library-substitution instead of acting on the level of system calls (so not good for statically linked binaries).


An obscure autotools error with Epson iscan project

I'm seeing the following error when attempting to build iscan using the master branch on Debian wheezy. This project provides support for Epson scanners, in cases when SANE doesn't. This project appears to be an unofficial fork of the Epson project - I'm not clear about the details. I start with:               faheem@orwell:/usr/local/src/iscan/iscan$ git remote -v     origin  https://github.com/hean01/iscan (fetch)     origin  https://github.com/hean01/iscan (push)     faheem@orwell:/usr/local/src/iscan/iscan$ git branch      * (detached from origin/master)       iscan-2.29.1-5     faheem@orwell:/usr/local/src/iscan/iscan$ git status     # HEAD detached at origin/master     nothing to commit, working directory clean     faheem@orwell:/usr/local/src/iscan/iscan$ debuild -uc -us     This package has a Debian revision number but there does not seem to be     an appropriate original tar file or .orig directory in the parent directory;     (expected one of iscan_2.29.3.orig.tar.gz, iscan_2.29.3.orig.tar.bz2,     iscan_2.29.3.orig.tar.lzma,  iscan_2.29.3.orig.tar.xz or iscan.orig)     continue anyway? (y/n)     The error is          make[1]: Entering directory `/usr/local/src/iscan/iscan'     cd . && /bin/bash /usr/local/src/iscan/iscan/missing --run aclocal-1.10 -I m4     configure.ac:273: error: unknown libltdl build type: _LTDL_TYPE     /usr/share/aclocal/ltdl.m4:226: LTDL_INIT is expanded from...     /usr/share/aclocal/ltdl.m4:352: AC_LIB_LTDL is expanded from...     configure.ac:273: the top level     autom4te: /usr/bin/m4 failed with exit status: 1     aclocal-1.10: autom4te failed with exit status: 1     make[1]: *** [aclocal.m4] Error 1     make[1]: Leaving directory `/usr/local/src/iscan/iscan'      Suggestions for fixing or even a confirmation this can be reproduced would be helpful. I've also opened an issue for the iscan GitHub project. Googling "configure.ac:273: error: unknown libltdl build type: _LTDL_TYPE" brings up http://help.lockergnome.com/linux/Beating-libtool-submission-- ftopict507073.html but the suggested               autoreconf -fiv      does not work. I might try one of the autotools mailing list, but at this point, I don't even know which one to post to. Should it be autoconf, automake, or libtool, or something else? Pointers appreciated.


Centos 'Login incorrect' problem

When I type my username and password into the login field, I receive the following error: > Login incorrect How can I solve this problem? I am using CentOS.