Add arguments from previous command to zsh completion

In zsh (as well as bash) you can use some history word expansions to denote arguments from previous commands. This example shows getting the 2nd parameter from the previous command in history with `!:#` expansion:               % echo foo bar baz     foo bar baz     % echo !:2     echo bar     bar      I often forget exactly what # parameter a particular argument is and typing `!:#` isn't always that quick when I do remember which arg it is. I know about `meta-.` to replace the last argument, but sometimes it isn't the last arg that I want. I'd like to add the arguments from the previous command as suggestions to complete any command that I'm typing in zsh. I was able to figure out how to create a shell function that can create an array of arguments (0..N) from the last command and bind it to a particular command.               _last_command_args() {         last_command=$history[$[HISTCMD-1]]         last_command_array=("${(s/ /)last_command}")          _sep_parts last_command_array     }          # trying to get last_command_args to be suggested for any command, this just works for foo     compdef _last_command_args foo      This is what it looks like for completing just foo where I hit the tab key at `<TAB>`:               % echo bar baz qux     bar baz qux     % foo <TAB>     bar   baz   echo  qux       This works great for completing the command "foo", but I'd like these to be options on any zsh expansion that I do. I think it's got something to do with the zstyle completer stuff, but after a few hours of hacking around I realized I'm out of my depth. How can I get the arguments from my previous command as suggested completions for any command in zsh? I've got my full zshrc compinstall file shared out on bitbucket if that helps. Lots of it is cribbed from a variety of sources and some of it I've hacked together myself. UPDATE: @Julien Nicoulaud's answer got me close, I'm marking it as accepted as it got me where I needed to get. With my particular config, using the suggested:               zstyle ':completion:*' completer _last_command_args _complete      Didn't quite work for me as it was causing tab completion to only display the list of arguments from the last command (though it'd actually complete with filenames as well, just not display them). Changing the order to `_complete _last_command_args` did the reverse. It'd display the normal filenames, but not last_command_args I'm guessing this has something to do with the way completer works. I think it only displays the output from the first method that returns successfully, but I'm having trouble parsing the zsh source to understand fully what's going on. I was able to tweak my method to include a call to `_complete` so that it showed both last argument commands as well as the regular autocomplete stuff. Not quite as separated, but works well enough for me. Here's the full function I used along with the other zstyle stuff I have:               # adds the arguments from the last commadn to the autocomplete list     # I wasn't able to get this to work standalone and still print out both regular     # completion plus the last args, but this works well enough.     _complete_plus_last_command_args() {         last_command=$history[$[HISTCMD-1]]         last_command_array=("${(s/ /)last_command}")          _sep_parts last_command_array         _complete      }               _force_rehash() {       (( CURRENT == 1 )) && rehash       return 1  # Because we didn't really complete anything     }          zstyle ':completion:::::' completer _force_rehash _complete_plus_last_command_args _approximate       Other zstyle lines I have, not necessary for this to work, but could affect why this works for me:               zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX + $#SUFFIX) / 3 )) )'     zstyle ':completion:*:descriptions' format "- %d -"     zstyle ':completion:*:corrections' format "- %d - (errors %e})"     zstyle ':completion:*:default' list-prompt '%S%M matches%s'     zstyle ':completion:*' group-name ''     zstyle ':completion:*:manuals' separate-sections true     zstyle ':completion:*' menu select     zstyle ':completion:*' verbose yes      Now, if I'm in a directory with `file1.txt` and `file2.txt`, and my last command was `echo foo bar baz`, I get this for autocomplete which is just what I wanted:               % ls     bar   baz   echo  foo      - files -     file1.txt   file2.txt


nc both fails and succeeds

Platform: RHEL 5.10 netcat Version: 1.84-10.fc6 I was trying to figure out if my inability to ssh was TCP-level and usually I use `nc` for this. This time, however, I got something unexpected.               [jadavis6@ditirlns01 ~]$ nc -vz dixxxldv02.xxx.xxx 22 -w 15     nc: connect to dixxxldv02.xxx.xxx port 22 (tcp) timed out: Operation now in progress     Connection to dixxxldv02.ncat.edu 22 port [tcp/ssh] succeeded!      Normally if it can't connect within the specified timeout it just prints the first line. Thinking it was just some weird race condition (like the TCP connection kept completing just as I was approaching timeout) I lengthened the timeout period to 30 seconds but got the same exact results. Telnet also fails so I think there is an IDS/Network Firewall blocking the traffic. I was just curious if anyone has seen this before or what it mean.


What are ConsoleKit and PolicyKit? How do they work?

I've seen that recent GNU/Linux are using ConsoleKit and PolicyKit. What are they for? How do they work? The best answer should explain what kind of problem each one tries to solve, and how they manage to solve it. I'm a long-time GNU/Linux user, from a time when such things didn't exist. I've been using Slackware and recently Gentoo. I'm an advanced user/admin/developer, so the answer can (and should!) be as detailed and as accurate as possible. I want to understand how these things work, so I can use them (as an user or as a developer) the best possible way.


saving data from a failing drive

An external 3½" HDD seems to be in danger of failing — it's making ticking sounds when idle. I've acquired a replacement drive, and want to know the best strategy to get the data off of the dubious drive with the best chance of saving as much as possible. There are some directories that are more important than others. However, I'm guessing that picking and choosing directories is going to reduce my chances of saving the whole thing. I would also have to mount it, dump a file listing, and then unmount it in order to be able to effectively prioritize directories. Adding in the fact that it's time-consuming to do this, I'm leaning away from this approach. I've considered just using `dd`, but I'm not sure how it would handle read errors or other problems that might prevent only certain parts of the data from being rescued, or which could be overcome with some retries, but not so many that they endanger other parts of the drive from being saved. I guess ideally it would do a single pass to get as much as possible and then go back to retry anything that was missed due to errors. Is it possible that copying more slowly — e.g. pausing every x MB/GB — would be better than just running the operation full tilt, for example to avoid any overheating issues? For the "where is your backup" crowd: this actually is my backup drive, but it also contains some non-critical and bulky stuff, like music, that aren't backups, i.e. aren't backed up. The drive has not exhibited any clear signs of failure other than this somewhat ominous sound. I did have to fsck a few errors recently — orphaned inodes, incorrect free blocks/inodes counts, inode bitmap differences, zero dtime on deleted inodes; about 20 errors in all. The filesystem of the partition is ext3.


Lynx is trying to unzip my downloads

I am having a problem with the Lynx text browser. When I try to download a some tar.gz files, Lynx is not downloading it. It is putting it in a tmp directory and then trying to unpack it with the command:               /bin/tar tvf -      It does not always do this. Often it does just download the file, but if it is a link on a sourceforge site (one of those redirect "your download will start shortly" links), then it does the unwanted tvf behavior. Obviously this is wrong because it is GZIPPED file, so Lynx then hangs. The apparent reason it is doing this is that there is a line in /etc/mailcap that reads like this:               application/x-tar; /bin/tar tfv -; print=/bin/tar tvf - [etc, more gobblediguck]      This is doubly wrong because I don't want Lynx to put it in a tmp directory and unpack the file. I want it to download it to the current directory. Ideally, I do not want to monkey with my mailcap settings, having no experience with such things. How can I get Lynx to just download tar.gz files when they are coming from sourceforge/auto download sites?


Fedora 20. Authentication requires a different password from su

In Fedora 20 (using Mate desktop) I have tried to change the default keyboard layout from US English to UK English, but am asked for "Authentication". The password I have for `su` is not accepted, and I do not recall having set a different one anywhere. Please, why does this happen, and how to I get round it? This may be two questions: How to authenticate? and How to set the default keyboard layout? I hope this is acceptable.


Split large file into chunks without splitting entry

I have a rather large .msg file formatted in the UIEE format.               $ wc -l big_db.msg     8726593 big_db.msg      Essentially, the file is made up of entries of various length that look something like this:               UR|1     AA|Condon, Richard     TI|Prizzi's Family     CN|Collectable- Good/Good     MT|FICTION     PU|G.P. Putnam & Sons     DP|1986     ED|First Printing.     BD|Hard Cover     NT|0399132104     KE|MAFIA     KE|FICTION     PR|44.9     XA|4     XB|1     XC|BO     XD|S          UR|10     AA|Gariepy, Henry     TI|Portraits of Perseverance     CN|Good/No Jacket     MT|SOLD     PU|Victor Books     DP|1989     BD|Mass Market Paperback     NT|1989 tpb g 100 meditations from the Book of Job "This book...help you     NT| persevere through the struggles of your life..."     KE|Bible     KE|religion     KE|Job     KE|meditations     PR|28.4     XA|4     XB|5     XC|BO     XD|S      This is an examples of two entries, separated by a blank line. I wish to split this big file into smaller files without breaking an entry into two files. Each individual entry is separated by a newline (a completely blank line) in the file. I wish to break this 8.7 million line file into 15 files. I understand that tools like `split` exist but I'm not quite sure how to split the file but only have it split on a newline so a single entry doesn't get broken into multiple files.


How to read/write to tty* device?

I have a device that sends information over USB to my computer. Arch Linux sets up this device by creating a file named `ttyUSB0` in `/dev/`. I have been using `GTKterm` to receive this incoming information and display it in an emulated terminal window. My question is, how exactly does `GTKterm` read/write to this `ttyUSB0` file, and where might I start learning how to implement similar functionality? That is, in the most basic form, how might I write a character to `ttyUSB0`, or, in contrast, receive a byte and write it to a file?


Using sudo in openSUSE without actually changing to root user (i.e., like in Ubuntu)

I recently started trying openSUSE 12.3 after having used Ubuntu for a few years. I'm still getting used to openSUSE's treatment of `su` (and `sudo`) vs. Ubuntu's use of `sudo`. I've been reading the openSUSE manual, but can't figure out answers to two related questions: 1) In a previous question at http://askubuntu.com/questions/236859/are-there- adverse-effects-from-or-a-better-way-than-writing-to-run-or-dev-sh, I asked about writing a decrypted `gpg` file temporarily to `/run` using the `gpg --output` flag so that the decrypted file would never touch the hard disk. In order to write to `/run`, however, I needed to use `sudo` in Ubuntu (i.e., `sudo gpg --output '/run/temporary_file_name' etc.`). When I try to do the same thing in openSUSE (using either `sudo` or `su`), I get an error message from `gpg`, presumably because the root user cannot see my user account's gpg keys. Can this use of ``sudo` from Ubuntu, in which `sudo` seems to use the same preferences / gpg keys as the regular user, be replicated in openSUSE? I could use `gpg etc. | tee etc.`, I suppose, but that seems unwieldy compared to Ubuntu's way of doing things. 2) I have several bash scripts from Ubuntu that require root privileges for some, but not all, lines (e.g., copying files that I don't want to get owned by root, but then installing new software, which requires root privileges). In Ubuntu, I could just have some lines start with `sudo`. `sudo some_command` doesn't always seem to work in openSUSE, though. Is the best way to adapt these scripts for openSUSE to use `su -c 'command'` on those lines of the script? If I use `su` by itself in the script, the script stops working after I enter the root password. Please note that, while I'm asking about openSUSE specifically, this question presumably applied to many non-Ubuntu distros.


"/sbin/yast: fork: Cannot allocate memory" on openSUSE 10.1

I guess I'll come across as a total newbie for asking this, but I get the above message right after starting an ssh session. The reason I opened the ssh session was that I came across a 500 internal server error on the plesk panel. I tried to look around for similar problems, but all answers I find seem very specific toward variations on this problem. I guess it is a very generic message, if I should provide more info, please let me know what to run.               free -m                  total       used       free     shared    buffers     cached     Mem:          5020        202       4817          0          0          0     -/+ buffers/cache:        202       4817     Swap:            0          0          0               ulimit -a     core file size          (blocks, -c) 0     data seg size           (kbytes, -d) unlimited     file size               (blocks, -f) unlimited     pending signals                 (-i) 16375     max locked memory       (kbytes, -l) 32     max memory size         (kbytes, -m) unlimited     open files                      (-n) 1024     pipe size            (512 bytes, -p) 8     POSIX message queues     (bytes, -q) 819200     stack size              (kbytes, -s) 10240     cpu time               (seconds, -t) unlimited     max user processes              (-u) 16375     virtual memory          (kbytes, -v) unlimited     file locks                      (-x) unlimited          cat /proc/user_beancounters     Version: 2.5            uid  resource           held    maxheld    barrier      limit    failcnt       1231234:  kmemsize        6061008    6064704   17024866   19647330          0                 lockedpages           0          0       3800       4096          0                 privvmpages      138119     138227     138256     202568     755228                 shmpages          60296      60296     131072     131072          0                 dummy                 0          0 2147483647 2147483647          0                 numproc              64         64        232        232          0                 physpages         30682      30671          0 2147483647          0                 vmguarpages           0          0      66400 2147483647          0                 oomguarpages      50128      50117 2147483647 2147483647          0                 numtcpsock           28         28        500        500          0                 numflock             14         14        200        232          0                 numpty                1          1         64         64          0                 numsiginfo            0          0        512        512          0                 tcpsndbuf        275520     275520    4683256    6102456          0                 tcprcvbuf        458752     458752    4683256    6102456          0                 othersockbuf      48576      49280    1503232    4063232          0                 dgramrcvbuf           0          0     240000     262144          0                 numothersock         38         38        382        382          1                 dcachesize       773048     774892    2194304    2317184          0                 numfile            2874       2874       5432       5432       6308                 dummy                 0          0          0          0          0                 dummy                 0          0          0          0          0                 dummy                 0          0          0          0          0                 numiptent            64         64        128        128          0


What does "XOFF ignored, mumble mumble" error mean?

While trying to save a file out of Nano the other day, I got an error message saying "XOFF ignored, mumble mumble". I have no idea what that's supposed to mean. Any insights?


Prevent Java to escalate CPU usage on Slackware64?

I use Slackware64-current on my work laptop and though I love running Slackware, sometimes it hangs on me near to the point of starting considering falling back to Windows. I develop on Java and use Eclipse IDE. I know Java IDE's are not supposed to be lightweight, but, on occasions, it really gets stuck and as I normally have a console open, I run top only to find out Java is taking 90%+ of CPU load. How can I make sure it does not gets (much!) in my way? I know this is a rather open question, but I'll be more than happy to provide more details as needed. EDIT: Hardware specs               CPU: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz     RAM: 4GiB (probably DDR3, not sure though!)


What are the other congestion control algorithms specially designed for lossy Wireless Networks like LTE and WiMax?

I am trying different congestion control algorithms for getting maximum throughput and minimum delay across my setup for TCP flow.Please suggest other available algorithms apart from > Veno, Westwood ,Reno and Cubic whose implementation (or Kernel Modules) are freely available on Internet ?? And also suggest if there is some other way of obtaining higher throughput in tcp runs between linux (Fedora) and Windows 7's tcp protocol stack at different ends.


Solid State drive vs. traditional hard disk in a virtual server environment

I am currently considering upgrading my virtual-hosting plan because of very bad write performance (mostly writing to a MySQL database, but I notice it also when compiling a program or copying files - or any other write operation). At some times (probably when many other customers on other vhosts are using the hard-drive) a write can take up to several dozens(!) of seconds, even when it's a small write operation, which is unacceptable. Read performance is much better, probably because of good caching (in fact when we start using the database at the morning each day, we notice how slow it is at first which would suggest that the cache is being filled - but that is OK with us). I don't know the specifics of how the hard-drive is used and prioritized in a Linux/vhost environment, but I can imagine that a lot of time is lost by jumping between vhost-partitions. On the other hand, it may also be possible that an SSD pretty much behaves like an HDD (only a bit faster, which would not be enough for me - 20 instead of 30 seconds is still unacceptable) from the user's point of view. Does anybody have experience with both HDDs and SSDs in an vhost-environment? Is there a different "character" (regarding relative speeds of reads and writes and especially latency) noticeable as a user? How is the hard-drive prioritized and in which ways does an SSD make a difference, especially on a overloaded vhost-system? Do you think that changing to an SSD can prevent this extremely bad write- performance spikes?


System sending SIGTERM and SIGKILL during normal work

I have a program (C++) that works with TCP sockets in multithreaded manner. The multithreading is intensive, about 100 threads (POSIX threads). Sometimes, not quite sure when, the program gets terminated by `SIGTERM`. After some googling I found out that it is not normal for system to send `SIGTERM`. I've decided to look what happens if I ignore the signal. Now the system sends `SIGKILL`. I assume it tries with `SIGTERM` and when the application does not terminate, the system kills it. I have tried running it in gdb, and got no signals. I've run it in valgrind, no signals. No valgrind errors either. Memory consumption was normal, it seems I have no memory leaks. Upon exit it had 7Mb heap in use. Nothing suspicious in `/var/log/messages, /var/log/syslogd`. The system is Debian 2.6.32-5. Basically, the question is why may the system send `SIGTERM` followed by `SIGKILL` to an arbitrary process? And how can I stop at that point to see what happens (gdb alters the behavior).


Problems setting up TigerVNC and firewall

I have a box running a fresh install of Fedora 15. I've installed TigerVNC server on it and client on my Windows machine. I've added `-A INPUT -m state --state NET -m tcp -p tcp --dport 5900 -j ACCEPT` to `/etc/sysconfig/iptables` then, added to `/etc/sysconfig/vncservers`: VNCSERVER="1:UNAME" VNCSERVERARGS[1]="-geometry 1024x768" then I try to start the server, but I get `job failed. See bla bla for details` ((mentions some files i have no idea to find)) What am I doing wrong? -thanks! **iptables -nvL:**               Chain INPUT (policy ACCEPT 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination       173 12044 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED         0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0         0     0 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0         0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22      1518 85858 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited         0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:5900          Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination         0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited          Chain OUTPUT (policy ACCEPT 1613 packets, 146K bytes)      pkts bytes target     prot opt in     out     source               destination``      **systemctl:**               vncserver.service         loaded failed failed        LSB: start|stop|restart|try-restart|status|force-reload vncserver


rm command returns a message [1] 12345 What does this mean?

I'm trying to remove a file and I keep getting a message similar to: > [1] 12345 and nothing happens, I run a directory search (dir) and the file remains and I get a stopped message


How can I configure fair bandwidth sharing between cgroups?

It's fairly easy to use `tc` with Stochastic Fairness Queueing (SFQ) to configure fair bandwidth sharing between _flows_ , but an application can open multiple flows and get an unfair share of bandwidth. Is it possible to configure fair bandwidth sharing between _applications_ instead? Grouping each application into a cgroup seems like a clear first step. If SFQ supported hashing on the class ID, it would be easy to use `tc filter` to assign each cgroup a class ID. Unfortunately, SFQ doesn't seem to support this. Another promising approach is to use CBQ, which does Weighted Round Robin across classes. Unfortunately, making the weights all equal doesn't seem to work. Is there another way to fairly share bandwidth between cgroups?


What is the difference between egrep, fgrep, find and grep commands?

i am new to linux console, however i know i can use grep to find files however i am wondering what the particular difference between these common commands ? They all seems to be equal in meaning to me.               egrep      fgrep     grep      find     locate      as windows search and find command.


Handbrake for wheezy?

Has anyone figured out how to install/backport a Debian Handbrake package on Debian wheezy? The only version of Handbrake currently in Debian is in experimental, and the dependencies are not available on wheezy, so I can't easily rebuild it. In particular the version of `libav` used is the version in experimental. The unofficial deb-multimedia repository is a possibility, but I have had problems in the past with its packages being incompatible with Debian. Using a Ubuntu PPA might also be a possibility. But Linux multimedia is a complicated mess, and I would prefer not to have to mess with it.


Package php5-json breaks firephp

### Background Recently I upgraded php to version 5.5. Within this upgrade module for json was moved out from php5 package into a new package php5-json. So I installed it. **Now the connection with firephp (and firebug).**   Before sending, firephp::log encodes the variable with json_encode.   There might occur an issue with json_encode. The json_encode may fail to encode the input variable. This might happen in a string with unencoded unicode or a string with some ill encoded characters. ### Behaviour in previous version of php   * In firebug instead of the value with the wrong coding white space appears.   * After the wrong value firebug continues to display next values which arrived from firephp. ### Behaviour with separate php5-json   * When the ill encoded value arrives to firebug, following error message appears: > SyntaxError: JSON.parse: unexpected character   >  chrome://firephp/content/lib/renderer.js   >  Line 159 >   * After this listing logs from firephp stops. > > > ### Question I understand that there was an 'unexpected character'. But I'd just like to move on and see the following messages. Not stop on the first unexpected character.   What shall I do to solve the issue? Or at least get back to the previous bevior? ### Software versions:   * Debian testing jessie    * Linux host 3.10-2-amd64 #1 SMP Debian 3.10.5-1 (2013-08-07) x86_64 GNU/Linux    * php5 5.5.1+dfsg-2    * php5-json 1.3.1+dfsg-1    * iceweasel 22.0    * FirePHPCore-0.3.2    * Firebug 1.11.4    * Firephp 0.7.2  ### Edit: I also can see in Firebug header X-Wf-1-1-1-2: > > [{"Type":"LOG","Label":"$someVar","File":"/home/GIT/www/some/path/someFile.php","Line":"156"},] Which **does** miss the value part and thus is **not valid JSON** , which is why the rendering fails. The header with the correct message, which gets printed: > [{"Type":"LOG","Label":"POST > data","File":"/home/GIT/www/some/path/someFile.php","Line":"22"},{"data":{"myarray":["117"]},"getA":"true","getB":"true"}] ### Edit2: I submitted this as a bug in Debian 719942. But it doesn't seem that someone is willing to have a look at it :-(


`tail -f` until text is seen

I've got a CI server with a command-line interface that allows me to remotely kick-off a job (`jenkins` CI server and the `jenkins-cli.jar` tool). After I kick the job off I `tail -f` the log (sorry for the messy command):               ssh -t my-jenkins-host.com "tail -f \"/var/lib/jenkins/jobs/$job_name/builds/\`ls -ltr /var/lib/jenkins/jobs/$job_name/builds/ | grep '^l' | tail -n 1|awk '{print \$9}'\`/log\""      After the job successfully completes, usually after at least 5 minutes, I get the following line on the output:               Finished: SUCCESS      Is there a good way to stop tailing the log at this point? i.e. is there like a `tail_until 'some line' my-file.log` command? _**BONUS:_** extra credit if you can supply an answer that returns 0 when SUCCESS is matched, 1 when FAILURE is matched, and your solution works on mac! (which i believe is bsd based)


Setting up boot scripts for BeagleBone/Angstrom

I'm working on setting up the pinmux on a BeagleBone so that I can access multiple UARTS. The OS is Angstrom Linux (the demo image, if that helps). I have a shell script:               #!/bin/sh          echo "Configuring Pinmux"          echo 0 > /sys/kernel/debug/omap_mux/uart1_txd     echo 20> /sys/kernel/debug/omap_mux/uart1_rxd          echo "UART 1 (TX):"     cat /sys/kernel/debug/omap_mux/uart1_txd     echo          echo "UART 1 (RX):"     cat /sys/kernel/debug/omap_mux/uart1_rxd     echo          echo 1 > /sys/kernel/debug/omap_mux/spi0_d0     echo 21> /sys/kernel/debug/omap_mux/spi0_sclk          echo "UART 2 (TX):"     cat /sys/kernel/debug/omap_mux/spi0_d0     echo          echo "UART 2 (RX):"     cat /sys/kernel/debug/omap_mux/spi0_sclk     echo      Which sets up the UARTS for use. Now, I want this script to run on boot, so that I don't have to mess with it every time. Where should I put this/ make a link in order to do that?


How to display the name of the current Virtualenv?

I'm using `virtualenv`, `virtualenvwrapper`, `zsh`, `oh-my-zsh`, terminator, on Crunchbang. I'm trying to display the name of the current `virtualenv` like so               workon example     (example)...       I've tried many solutions none seems to work, here's my .zshrc file, I know it's no big deal to fix it but I can't find the right solution. It has been a long time since the last time I used Linux for Django development, I forgot what I used to do. Right now, I see `username@crunchbang`, I can't tell which virtualenv I'm using.


How can I sort a list of file names by some substring of the name?

I have a number of files with names like:               beginning_num1_734_num2_1.363e+12_num3_800.pdf     beginning_num1_735_num2_7.453e+13_num3_800.pdf     beginning_num1_1007_num2_9.453e+12_num3_1200.pdf      I'd like to be able to sort a list of these filenames by the various `num`s, and pass the sorted list to various command line utilities. For example, if I were sorting by `num2`, I'd want the order:               beginning_num1_734_num2_1.363e+12_num3_800.pdf     beginning_num1_1007_num2_9.453e+12_num3_1200.pdf     beginning_num1_735_num2_7.453e+13_num3_800.pdf      I have a python script to do this, but it seems like it _should_ be possible with nothing but filters like `sed` and `sort`. Is there any easy way to sort by parts of a file name, using only common command line filters?


Delete specific line number(s) from a text file using sed?

I want to delete one or more specific line numbers from a file. How would I do this using sed?


Why does echo >file use more real time than echo | sed >file?

The example, below, surprised me. It seems to be counter intuitive... aside from the fact that there is a whisker more _user time_ for the `echo | sed` combo. Why is `echo` using so much _sys time_ when it runs alone, or should the question be, How does `sed` change the state of play? It seems that `echo` would needs to do the same _echo-ing_ in both cases...               time echo -n a\ {1..1000000}\ c$'\n' >file          # real    0m9.481s     # user    0m5.304s     # sys     0m4.172s          time echo -n a\ {1..1000000}\ c$'\n' |sed s/^\ // >file          # real    0m5.955s     # user    0m5.488s     # sys     0m1.580s


Vimrc autosourcing not working

My vim configuration lives in `$HOME/.vim/vimrc`, which is symlinked to `~/.vimrc`. Inside my vimrc I have:               if has("autocmd")       autocmd bufwritepost vimrc source $HOME/.vim/vimrc     endif      But is not working. I also tried sourcing `$MYVIMRC`. Am I missing something?


How can I tell what version of OpenGL my machine supports on Arch Linux?

How can I tell what OpenGL versions are supported on my (Arch Linux) machine?


Looking for an advanced Linux podcast

I am looking for some more advanced linux podcasts then I have been able to find so far. I commute 3+ hours each way. This is a great time to catch up on tech, learn some things I may have missed.   * Looking for some enterprise level discussions line RHEL or CentOS.   * Looking for something more CLI based as I never use the gui.   * Looking for anything above entry level/new to linux casts. Here's to hoping there is a linux podcasts for practicing professionals, not just entry level hobbyists trying to convert people to the OS. Ideally I would love a more advanced format with some in depth discussions on regex/cli/bash scripting/services/etc. I have tried _linux for the rest of us_ , _everyday linux_ , _podnutz pro_ , _linux reality_ , etc. The majority seem to follow the "morning radio" style format, but I would love to find any podcasts that keep my mind engaged during my 3 hour commute. I am willing to try any podcasts you want to suggest I will take a look at. Thanks This is not bashing, trolling, polling etc. The basic podcasts help lots of new users come to our side. However, I've been using linux since the first edition of "Running Linux" came out. I need something with some bite! Just an honest engineer looking for some new podcasts to broaden my mind. Thanks all!


How to upgrade from Ipython Notebook .12 to .13 (Linux)?

I installed using `sudo apt-get install ipython-notebook`. But when I check `ipython notebook --version` it is 0.12.1. I am new to Linux, so forgive me if this is obvious, but I tried `sudo apt-get --only-upgrade install ipython notebook`, and it did not work. I could not find other advice.


ubuntu + how to install the patch command

Please advice how to install the patch command on Ubuntu Linux I download the following file , patch_2.6-2ubuntu1_amd64.deb ( from site - http://packages.ubuntu.com/lucid/patch ) But not clearly how to install it? I tried by ./patch_2.6-2ubuntu1_amd64.deb , ( but I get errors ) Please advice how to install the pkg patch_2.6-2ubuntu1_amd64.deb In order to use thepatch command on my unbuntu linux


Only print rows that have 2 or more fields?

I've got a text file and I'm trying to figure out how to filter out any lines with data in only 1 field, leaving lines with 2 fields. I came across the following code: `awk '$NF > 1'` but I can't get it to work as I want it to. Any ideas what I might be doing wrong? Here is a sample of my data:               simpledaddy11,EastOfBrussels     simpledaddy11,thomaswatkins     simpledaddy11,     simpledaddy11,     simpledaddy11,     simpledaddy11,     simpledaddy11,     simpledaddy11,     simpledaddy11     Moral_Animal,EastOfBrussels     Moral_Animal,     Moral_Animal,     Moral_Animal,     Moral_Animal,     Moral_Animal,     Moral_Animal,     Moral_Animal,     Moral_Animal     skilur_ua,EastOfBrussels     skilur_ua,thomaswatkins     skilur_ua,     skilur_ua,     skilur_ua,     skilur_ua,      Here is what I want to end up with:               simpledaddy11,EastOfBrussels     simpledaddy11,thomaswatkins     Moral_Animal,EastOfBrussels     skilur_ua,EastOfBrussels     skilur_ua,thomaswatkins      Thanks for the help!


Backup of svn repository and mysql database on daily basis

How do I instruct Ubuntu 13.10 server to:   1. zip svn repository   2. dump mysql database into .sql script   3. tar both files   4. copy backup tar onto sdb disk Are there any premade tools for such kind of operations?


How to execute a script on gdm login automatically for all users?

What file should I modify to execute some instructions when any user logs in through gdm? I tried `/etc/bashrc` but that is executed ony when starting bash (and each time an xterm is open). I'd like to execute something only once when the user logs in. What I want to do is to "reset" some user preferences each time the user logs on (including the window manager), so the script should run before the WM is initialized.


SSH Login Alert Using pam_exec

Hi I have been trying to follow the information about pam_exec from here: Ssh login hook? When a user log's in they get:               /etc/pam.d/email-alert.sh failed: exit code 8      My sshd file has this at the end:               session optional pam_exec.so debug seteuid /etc/pam.d/email-alert.sh      My email-alert.sh script has this,               echo 'ALERT - Remote SSH Shell Access (SERVERNAME) on:' `date` `who` |      mail -s "Alert: Remote SSH Access from `who |      cut -d'(' -f2 | cut -d')' -f1`" MYEMAIL@MYEMAIL.com      I have tested the script on its own and it emails me no problem. If anyone could point me in the right direction it would be much appreciated as I've been scratching me brain's out trying to figure it out.


mod_rewrite: undefined symbol: lstat error

I compiled the mod rewrite for apache (version 1.3.0) however, when I try to run the server I have this error about mod_rewrite:               Syntax error on line 27 of /home/myuser/apache/etc/httpd.conf:     Cannot load /home/myuser/apache/libexec/mod_rewrite.so into server:      /home/myuser/apache/libexec/mod_rewrite.so: undefined symbol: lstat     ./sbin/apachectl start: httpd could not be started      A similar problem is here https://bugzilla.redhat.com/show_bug.cgi?id=101837 but the solution provided does not help me...I get an error after __THROW, the classic "missing , ; before {" and, removing the THROW clause leads me to an "lstat already defined here" (pointing at sys/stat.h header). Can you help me?


Splitting and renaming a file

I need to split a file with a particular format and rename it later... The Split works fine but I'm unable to refer the $file-$each inside my awk command? Any tips?               for file in *.csv     do       split -n 3 -d -a 2 "$file" "$file--"       for each in $(seq -w 2 10)       do             echo $file--$each            awk '{filename = $file--$each ".txt"  ; print >> filename}' $file--$each       done     done


Why is umask setting a different permission for a directory and file I have created?

Consider:               [user@server1 ~]$ umask     0770     [user@server1 ~]$ mkdir TEST2; touch TEST2.txt;     [user@server1 ~]$ ls -l     d------rwx 2 user group_name 4096 Mar  5 05:16 TEST2     -------rw- 1 user group_name    0 Mar  5 05:16 TEST2.txt      Now shouldn't the file TEST2.txt have the permission `007` as `umask` is set to `0770` ? Thanks.


Virtualbox export appliance

I have an Ubuntu OS installed using virtualbox. Inside the Ubuntu OS, I have installed QEMU, GCC for ARM and GDB for communicating between ARM and QEMU. My question is, if I export this image using the "Export Appliance" option from VirtualBox and use it another machine, will that contain the QEMU, GCC for ARM and GDB installation in that image?


Scroll inside Screen, or Pause Output

I use screen for my command-line tasks while managing the servers where I work. I usually run small commands (mostly file-system tasks) but sometimes I run more extensive tasks (like DBA). The _output_ of those tasks is important to me. Since I use Ubuntu and OS X (both Terminal Windows) for my tasks, yet I need to use screen, the scrolling is not available, so any long output (think a 500-row table from a select) is invisible for me. Mouse-wheel is out of the question. When I say "scroll is invisible for me, I mean this: ![top while using screen, in Mac OS X, while scrolling](http://i.stack.imgur.com/kAIBx.png) I was thinking about two options:   1. Pause (think _paginate_ ) the output of a certain command. When the output begins, it would let me read what's happening, then I press "Enter", then the output continues... until there's nothing more to show.   2. Scroll inside screen. But I don't know if this is possible. Of course, I don't know if those options are actually _possible_. If they are, how can acheive them? Other alternatives will be well received. Thanks!


Cannot connect to any localhost connections

I'am using Centos 6.5 with latest updates. My problem is that whenever i try to connect to some local service it just hangs for example: # wget               wget 127.0.0.1     --2014-03-11 12:43:42--  http://127.0.0.1/     Connecting to 127.0.0.1:80...     After a while timeout...      # ssh               # ssh 127.0.0.1 -p 6060 -v     OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013     debug1: Reading configuration data /etc/ssh/ssh_config     debug1: Applying options for *     debug1: Connecting to 127.0.0.1 [127.0.0.1] port 6060.     debug1: connect to address 127.0.0.1 port 6060: Connection timed out     ssh: connect to host 127.0.0.1 port 6060: Connection timed out      and it hangs out to timeout. Same with telnet, and same with connecting to irc server. External connections are running fine... # netstat -tpln               # netstat -tpln     Active Internet connections (only servers)     Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name        tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      589/sendmail             tcp        0      0 127.0.0.1:6060              0.0.0.0:*                   LISTEN      520/sshd                 tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      619/nginx                tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      478/sshd                 tcp        0      0 ::1:6060                    :::*                        LISTEN      520/sshd                 tcp        0      0 :::22                       :::*                        LISTEN      478/sshd                  # netstat -rn               # netstat -rn     Kernel IP routing table     Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface     169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 venet0     0.0.0.0         0.0.0.0         0.0.0.0         U         0 0          0 venet0      # iptables I arleady flush out iptables, without luck. Output form iptables:               # iptables -nvL     Chain INPUT (policy ACCEPT 634 packets, 49819 bytes)      pkts bytes target     prot opt in     out     source               destination                   Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)      pkts bytes target     prot opt in     out     source               destination                   Chain OUTPUT (policy ACCEPT 517 packets, 47027 bytes)      pkts bytes target     prot opt in     out     source               destination               # Loopback config               # ip a     1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN          link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00         inet 127.0.0.1/8 scope host lo         inet6 ::1/128 scope host             valid_lft forever preferred_lft forever     2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN          link/void          inet 127.0.0.1/32 scope host venet0         inet 176.122.224.115/32 brd 176.122.224.115 scope global venet0:0      Turning of SELinux didn't improve it with anything. # ip route show table local               # ip route show table local     local 176.122.224.115 dev venet0  proto kernel  scope host  src 176.122.224.115      broadcast 176.122.224.115 dev venet0  proto kernel  scope link  src 176.122.224.115      broadcast 127.255.255.255 dev lo  proto kernel  scope link  src 127.0.0.1      broadcast 127.0.0.0 dev lo  proto kernel  scope link  src 127.0.0.1      local 127.0.0.1 dev lo  proto kernel  scope host  src 127.0.0.1      local 127.0.0.0/8 dev lo  proto kernel  scope host  src 127.0.0.1       # traceroute               # traceroute 127.0.0.1     traceroute to 127.0.0.1 (127.0.0.1), 30 hops max, 60 byte packets      1  localhost.localdomain (127.0.0.1)  0.029 ms  0.014 ms  0.012 ms      # ping 127.0.0.1 works ok               # ping 127.0.0.1     PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.     64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.024 ms     64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.036 ms      The weirdest thing about it is that, i can connect to ssh, nginx server from **external** address (for ex. computer from which i ssh'ing) without problems. This happens after ISP has rebooted my server. Thing that maybe useful is that, server was frequently updated without reboots.


How to change height and width of each page of a pdf

I was wondering how to change width and height of each page of a pdf? In my scanned pdf, each page has paper size too big, 31.98 × 49.20 inch. I would like to shrink the width and height to smaller ones which are normally seen in pdf files. Are there some applications or programming tools to accomplish this?


Adding public is_rsa.pub to known_hosts automatically - how to?

How to automatically add server to known_hosts ? (and not use md5 fingerprint, as I mean secure way, please not send "auto yes/accept" solutions. I want to bring required credentials from server to machine) I'd like to update automatically my ssh `known_hosts` file to accept new server. I assume, that I need to add server's public key (`id_rsa.pub` obtained through secure channel), but what I see is that format is different (I've tried adding like this `awk '{print "server "$1" "$2}' id_rsa.pub > .ssh/known_hosts` with verification failed. Please note that I don't want to use md5 fingerprint due to flaws in md5). If something else than `id_rsa.pub` would be useful I can run commands on server and obtain results though trusted channel. (Please note that it is not network channel (think of physically bringing pendrive from place to another), so `ssh-keyscan` does not solve the problem, what's more id_rsa.pub is key of dropbear server that is not running at server, so only files with keys are available, not server)


Is `Tru64 UNIX` open source?

Is `Tru64 UNIX` an open source/free or commercial system? Does it work on 32-bit platform? and what are its features in compare with `*BSD` & `Linux` system?


killing processes automatically

I need to kill all processs in a certain shell excluding certain processes. Like sh which is my shell. And the comand. This is what currently in my shell right now.               rcihp146 :/home/msingh2> ps        PID TTY       TIME COMMAND       8880 pts/258   0:00 ps       5908 pts/258   0:00 sh      But if there are some extra processes I would like to kill all of them excluding the above two. I tried a one liner for this purpose and it didn't work:               rcihp146 :/home/msingh2> ps | awk '{system("kill -9 $1")}'     sh: kill: The number of parameters specified is not correct.     sh: kill: The number of parameters specified is not correct.     sh: kill: The number of parameters specified is not correct.     sh: kill: The number of parameters specified is not correct.      But it works if I only give a specific pid like below:                rcihp146 :/home/msingh2> ps | awk '{system("kill -9 23456")}'      I need to exclude two or three process (like `ps`, `sh`) from being killed. Is there any way to do this?


sed inline editing fails for multiple sed statements

I want to append `#SB#` at the beginning of every line where it matches a given string ### incron.sh               sed -i -e'/test1/s/^/#SB#/g' file1     sed -i -e'/test2/s/^/#SB#/g' file1     sed -i -e'/test4/s/^/#SB#/g' file1      ### file1               /apps/pmserver $ cat file1     00 45 /ser/bat/ab.sh test1     00 45 /ser/bat/ab.sh test2     00 45 /ser/bat/ab.sh test3     00 45 /ser/bat/ab.sh test4     /apps/pmserver $      I am using Korn Shell. I can output to a new file but it doesn't work if I have more than one `sed` statement in a script as shown above. I am getting error               sed: Not a recognized flag: i      What I am trying to do is comment out a few `crontab` entries belonging to particular team. test1 test2... are their file names and these need to be turned off.


Inconsistent behaviour of "wmctrl -i -a <WIN>"

I'm trying to use `dmenu` and `wmctrl` to write a script that would present to me a list of all currently open windows and then switch to the one I select. It looks something like this: ![switch_to script](http://i.stack.imgur.com/DuGPi.png) Now, I'm using the window id I get from `wmctrl -l` (for instance, the "0x00c0005c" visible in the screenshot on the 2nd line) to determine exactly which window has been selected (I'm not using the window class because 2 windows belonging to the same application will have the same class, but different ids). The only problem is: `wmctrl -i -a` works sometimes, but doesn't work other times - and some times, it switches, but to the wrong window! It's quite random. After searching online, the only web page I found that even _mentions_ the issue is this one. It says: > WIN as a numerical window ID doesn't seem to work consistently. Perhaps not > all options support it or something crazy is going on. It used to work very > well for me. Re-test. Can anyone tell me how I can resolve or work around this issue? I'm using version 1.07-3 of `wmctrl` from the official repositories on an up- to-date Arch Linux machine, and Awesome Window Manager, if it helps. Thanks


Fast way to determine if a file is a SQLite database

I am looking for a way to determine file types in a folder with thousands of files. File names do not reveal much and have no extension but are different types. Specifically I am trying to determine if a file is a sqlite database. When using 'file' command, it determines type of 2-3 files in a second. This seems like a good way to adress the problem, except it is too slow. Then I tried opening each file with sqlite3 and check if I get an error. That way I can check 4-5 files per second. Much better, but I think that there might be a better way to do this.


Emptying a directory owned by another user weekly

I have a temp directory set up where users can place whatever files they need to send to other users via HTTP. The owner of this directory is an SFTP user, and cannot run cron jobs. I have one shell user that can run cron jobs, but does not have permission to edit files in the SFTP user's directory. I have an admin user that can access the SFTP user's directory when using sudo, but can't (read: I'd really rather not) run cron jobs. So, here's the conundrum. How do I get a nightly cron job to run as a shell user to delete files older than 1 week within the SFTP user's directory, with the admin user's privileges?


How to return the exit code? Error: return: Reading: numeric argument required

Here's a simplified version of my script. My question is, How do I return the exit code from `apt-get` in this case?               #!/bin/bash     install_auto() {     apt-get -h > /dev/null 2>&1     if [ $? -eq 0 ] ; then         return $(sudo apt-get install --assume-yes $@)     fi     return 1     }     echo "installing $@"     install_auto "$@"     echo $?     echo "finished"     exit 0      The output is:               ./install_test.sh: line 5: return: Reading: numeric argument required      Update: I came up with something that works:               return $(sudo apt-get install --assume-yes "$@" >/dev/null 2>&1; echo $?)      Is that a good approach?


Debian package to install closed-source

I'm writing an application that relies on a closed-source (but free-as-in-beer available) library. I'm currently making a Debian repository to host it, and need a way to depend on that library, so I want to make a package that downloads the archive from a third party and installs it. I'm not sure how to do the install such that it will uninstall nicely. Any ideas for how to do this such that it integrates nicely into apt?


Optimal SSD configuration

I am thinking about buying an SSD for my Debian system. However, because I don't know what is the optimal arrangement (i.e. what goes on the SSD), I am not sure what is the optimal size. Obviously I would like to find the sweet spot between performance and cost. Currently I have one partition for the root of the system, one for /home and one for the swap. What should I move to the SSD? I was thinking to move the root filesystem, and leave the rest as it is. But on the other hand there is lots on configuration files in home, and these may slow the system as well. Obviously I don't want to have photos and multimedia files on SSD, but what about the rest of the /home? And the swap partition?


How do I tunnel SSH over SSH?

I have successfully setup a tunnel over SSH on linux mint, and can browse the web. However, when I try to ssh using the same port, I get: > Couldn't establish connection to proxy: Network is unreachable > ssh_exchange_identification: Connection closed by remote host In my `mate-network-properties` I have selected manual proxy configuration, and socks host is `127.0.0.1` So why doesn't ssh use that proxy information, and can I make it use said proxy?


Lost access to grub after installation of Peppermint 4

I am hoping someone would be able to help me. I have installed peppermint 4 but after restarting it, the grub menu didn't show up and now it boots straight into Windows. I went back into peppermint by using "Try out Peppermint" option from the boot USB. I've also run               sudo fdisk -l      and this is the output.               Disk /dev/sda: 500.1 GB, 500107862016 bytes     255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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: 0xd9aacbf3          Device Boot Start End Blocks Id System     /dev/sda1 * 2048 821247 409600 27 Hidden NTFS WinRE     /dev/sda2 821248 489330687 244254720 7 HPFS/NTFS/exFAT     /dev/sda3 489330688 976773119 243721216 7 HPFS/NTFS/exFAT          Disk /dev/sdb: 500.1 GB, 500107862016 bytes     255 heads, 63 sectors/track, 60801 cylinders, total 976773168 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: 0x99954f66          Device Boot Start End Blocks Id System     /dev/sdb1 2048 557340671 278669312 7 HPFS/NTFS/exFAT     /dev/sdb2 * 557340672 557828095 243712 83 Linux     /dev/sdb3 557830142 691828735 66999297 5 Extended     /dev/sdb5 557830144 567828479 4999168 83 Linux     /dev/sdb6 567830528 667828223 49998848 83 Linux     /dev/sdb7 667830272 691828735 11999232 82 Linux swap / Solaris          Disk /dev/sdc: 16.2 GB, 16231956480 bytes     140 heads, 32 sectors/track, 7076 cylinders, total 31703040 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: 0xc3072e18          Device Boot Start End Blocks Id System     /dev/sdc1 * 32 31703039 15851504 c W95 FAT32 (LBA) The `/boot` partition for peppermint was set at `/dev/sdb`. I have also tried to use type this code:               sudo mount /dev/sdb2 /mnt     chroot /mnt      It has managed to mount it but after trying `chroot /mnt` it says: > Operation not allowed. What can I do to enable grub now?


Why do I get 3048 MB from a 64 MB flash memory?

I have a Linux based STB (set-top-box) and it features a 64 MB flash memory and 256 MB of RAM. I wanted to take a backup of some of my settings before I flash it with another image, but I wasn't sure where exactly they were located. I figured I would look into that later on. So I decided to connect to the box over FTP and download all the files and folders. Within the FTP client, I right-clicked on the root of the box and chose do download it to a dedicated folder on my desktop in Windows. The download just kept on going, it seemed like it would never stop... but then the FTP connection got terminated by the FTP server (I think it said in the log). I ended up with 2.97 GB of data. How is this possible? Where is all this data coming from?... it can't even hold more than 256 MB at most?!... Why can't you just copy the root of a Linux machine right off, and expect all the other files and folders to follow? Is it not the same as copying the C:\ on Windows? Is it because it's a live system?... maybe I have to shut it down first or log off and stop processes? It was in standby at the time... I am a complete noob when it comes to Linux. I thought I was gonna kill my STB there for a moment!


Distro recommendation for "Out The Box Multi Touch Tablet Support"

I have a Dell Inspiron Duo - The tablet netbook, the 1090. It's beautiful, and I want to get the most out of it. I don't mind digging deep into a distro and installing patches and such to get multitouch working, but that's me. I have to think of others that also would like this goodness. So my question, which distro has the best multi touch / tablet support out the box. > Imagine I have to recommend something to someone about to go on an Arctic > expedition, who has a touch screen laptop, and needs FOSS installed because > of cutbacks :)


Text pre-processing How to run many scripts at once

I have many scripts for text cleaning, is there a way to execute all of them at once instead of doing that one by one, for example I have :               sed -i -r "s/[’'–]/ /g" *.txt          sed -i 's/Aβ/ ABeta /g' ./*.txt      I have about 10 of them, how can I run all of them at once?


How do I elevate privileges in the middle of pipeline?

My guess was as follows:               echo "Generating some text" | su - -c cat >/output/file      But `su` says:               su: must be run from a terminal      What would you do?


ls --color: how to color executable hard links?

I created some hardlinks on an NTFS drive, but because of that, they are all executable and colored as executable instead of as hardlinks (regular file with more than one link). I did a test on my ext4 drive and it's the same problem: Any file with more than one link gets nicely highlighted when using ls --color, but as soon as it has one executable bit, it gets the "executable" coloring (bold by default, no highlighting). I tried various LS_COLOR settings, but no change. My current ~/.dir_colors file is simplified to this:               RESET 0     HARDLINK 44;37     #EXEC 01;32;41      And I test it with this:               eval "$(dircolors ~/.dir_colors)"; ls -l --color      The file seems to work for changing the colors, highlighting, etc, but I can't get executable hardlinks to be colored according to the HARDLINK setting. Update: After some research, it seems that "exe coloring takes precedence". Looks like it is hardcoded into ls itself:   * tests/ls/multihardlink.sh 54   * src/ls.c 4335-4338 So the only solution would be a customized "ls", is that correct?


How to validate X.509 certificate?

I have a following expired X.509 certificate:               $ openssl x509 -in openvpn.net -text -noout     Certificate:         Data:             Version: 3 (0x2)             Serial Number:                 03:fa:55:a7:80:b5:b5             Signature Algorithm: sha256WithRSAEncryption             Issuer: C=US, ST=Arizona, L=Scottsdale, O=GoDaddy.com, Inc., OU=http://certs.godaddy.com/repository/, CN=Go Daddy Secure Certificate Authority - G2             Validity                 Not Before: Dec 10 20:42:04 2013 GMT                 Not After : Mar  5 17:46:58 2014 GMT             Subject: OU=Domain Control Validated, CN=*.openvpn.net             Subject Public Key Info:                 Public Key Algorithm: rsaEncryption                 RSA Public Key: (2048 bit)                     Modulus (2048 bit):                         00:d8:1c:cd:03:64:34:52:e3:6a:fd:96:10:4d:76:                         c6:33:f8:70:fb:6c:0d:93:ac:3c:49:1b:bf:c4:9a:                         c3:b5:08:87:c8:1c:fc:81:64:91:41:45:81:e0:70:                         63:69:e0:86:ec:e1:48:84:26:2f:3f:4b:7d:6d:6c:                         88:bc:44:11:ff:72:b1:32:d9:30:24:e4:78:78:0c:                         fb:73:5d:43:05:4e:5c:5a:05:f7:85:e0:69:c9:b8:                         ca:7d:0a:33:b9:12:ee:ff:ed:20:7b:8d:04:89:05:                         74:80:7a:5c:4a:39:07:70:14:56:31:59:ae:4f:6f:                         3d:5d:c6:36:00:b6:aa:7e:45:6b:bc:cb:4a:8f:cc:                         20:69:f6:39:ec:29:e9:6a:14:6e:42:ca:99:d1:d7:                         08:23:31:5c:5b:b3:48:13:01:fe:bc:44:34:62:c7:                         81:2e:4e:74:1e:73:42:b3:5f:ee:23:55:9f:62:d0:                         46:5e:c2:00:14:7b:b5:e5:26:40:12:a6:32:50:22:                         b3:a6:df:b6:a3:90:d4:39:ae:ea:3e:53:f5:58:89:                         7a:b7:6a:d8:6f:d3:ae:1b:e0:7c:90:86:04:39:c3:                         a3:c8:8a:52:5a:d5:83:e7:07:80:5b:b2:e2:7a:5a:                         24:b2:d8:53:34:ad:2a:e2:d4:3a:57:5c:6e:3c:46:                         58:b5                     Exponent: 65537 (0x10001)             X509v3 extensions:                 X509v3 Basic Constraints: critical                     CA:FALSE                 X509v3 Extended Key Usage:                      TLS Web Server Authentication, TLS Web Client Authentication                 X509v3 Key Usage: critical                     Digital Signature, Key Encipherment                 X509v3 CRL Distribution Points:                      URI:http://crl.godaddy.com/gdig2s1-6.crl                      X509v3 Certificate Policies:                      Policy: 2.16.840.1.114413.1.7.23.1                       CPS: http://certificates.godaddy.com/repository/                      Authority Information Access:                      OCSP - URI:http://ocsp.godaddy.com/                     CA Issuers - URI:http://certificates.godaddy.com/repository/gdig2.crt                      X509v3 Authority Key Identifier:                      keyid:40:C2:BD:27:8E:CC:34:83:30:A2:33:D7:FB:6C:B3:F0:B4:2C:80:CE                      X509v3 Subject Alternative Name:                      DNS:*.openvpn.net, DNS:openvpn.net                 X509v3 Subject Key Identifier:                      DA:4D:97:2B:F8:A2:C5:E9:9D:A2:E4:CB:56:01:0B:9B:74:24:01:01         Signature Algorithm: sha256WithRSAEncryption             9b:b7:07:59:02:0c:67:f3:c1:49:45:fe:30:9a:1a:39:19:cb:             42:33:fc:62:02:29:fc:f5:ef:5d:61:36:4a:e2:c5:f6:52:04:             57:81:28:18:77:60:c0:99:1a:4a:45:e5:f7:eb:03:36:d2:bf:             9d:b6:93:38:98:06:b4:81:fb:5c:ff:e6:ef:7c:8d:ff:cd:5f:             53:b1:10:23:03:38:12:12:a8:99:c8:35:a1:6a:60:ba:4a:f4:             61:7f:96:cb:81:70:f3:c6:d8:2a:b5:69:b8:d9:56:0a:46:73:             9b:d0:d7:c1:2f:9a:d8:94:ac:37:0b:57:80:f9:a1:ec:e1:bf:             43:76:c6:ea:01:c6:97:c8:55:29:a8:b6:b9:19:bd:81:92:9a:             a9:ec:be:b0:4c:3e:11:f5:8b:8c:8f:af:fa:f5:d4:4d:d7:77:             c0:1f:aa:cd:f7:01:80:ad:62:d4:db:1d:e3:a0:23:77:2f:4b:             ea:65:5c:9e:9c:46:bc:be:ce:f3:71:79:cd:19:c3:44:f5:49:             de:4b:24:a5:8b:48:3e:60:4d:9d:dd:1d:50:35:66:6a:d6:96:             77:7c:19:9b:66:e1:46:de:4e:c2:ce:c5:96:88:2c:d7:7d:cc:             94:ac:1f:23:d4:a8:e9:6d:c0:f3:9f:a8:21:a7:fd:dc:25:95:             6f:eb:e3:a0     $       As I understand, this certificate is issued from `Go Daddy Secure Certificate Authority` to `*.openvpn.net`. I think that in order to verify, that this certificate is indeed issued by GoDaddy, I should download one of the GoDaddy root certificated from here. However, which one? And how can I verify that the certificate above is indeed issued by GoDaddy using `openssl` utility?


My /var/www directory is full

I am using Debian 7 on VirutalBox as my virtual web server. Now, my `/var/www` directory is almost full. I added 27 GB of space to my VM as a new partition, formatted the partition with `ext4` but my `/var/www` directory still doesn't have enough space. How can I resize `/var/www`? The output of df -h:   ![enter image description here](http://i.stack.imgur.com/Krjhs.png)


How to print a Bind10 cache dump?

How can you print the current state of the bind10 cache? I searched the bind10 manual and tried to figure it out using `bindctl`.


Environment variable for command called via nice

I need to set an environment variable for a command that is being called via nice. [Bash and dash, Slackware and FreeBSD.]                $ JIM=20 nice -n 10 echo $JIM           $      Nope, `echo` can't see JIM                $ nice -n 10 JIM=20 echo $JIM      nice: JIM=20: No such file or directory      $      `nice` don't like it. I can export JIM and then echo can see it, but now I'm polluting the environment. Unclean! I tried the "--" option to signify end of command line variables for `nice`, but it makes no difference, `nice` complains. I can't believe no one has wanted to do this before, so I'm probably making a very basic error. Any ideas?


How would I detect a non-login shell? (In Zsh)

I want to create a script that runs when a Zsh instance starts, but only if the instance is:   * Non-login.   * Interactive I think I'm right to say `.zshrc` runs for all interactive shell instances, `.zprofile` and `.zlogin` run for all login shells, and `.zshenv` runs in all cases. The reason I want to do this is to check if there is an existing ssh-agent running, and make use of it in the newly opened shell if there is. I imagine any tests carried out would be best placed in `.zshrc` (as this guarantees an interactive shell) and the designated "non-login event" script called from there. I probably first want to check if the new shell is already running as part of an existing remote SSH session before testing for the ssh-agent, but I have found this SE recipe for this purpose. I pick Zsh as it is the shell I favor, but I imagine any correct technique to do this would apply similarly to other shells.


Parsing an xml RSS feed file

What I would like to achieve is to receive an email with the failures of my VPS. I tried to do that by downloading an rss feed XML file from my VPS provider which contains all the failures, down states etc. of their servers. Once I downloaded it, I would like to parse it in order to see if my Virtual Host number is included in any of the entries of the XML file. If yes, I should receive an email containing the entire entry that contains my Virtual Host number (well, this is not a problem at all using `sendmail`). I have been unsuccessfully trying to use a simple and dirty `wget` and `grep`. This is the file I would like to parse: http://www.hetzner-status.de/en.atom


What does /etc/cron.daily/apt do?

Could someone explain what the `apt` script is doing in `cron.daily` please? I can't find any documentation on it. **NOTE:** I'm trying to investigate a server-server communications issue which frequently occurs around midnight - and I want to rule out the cron dailies.


How to compute Linux slab memory leak in GNU/Linux ( proc/slabinfo ) of running process ? I'm want to free usage is not working properly . I want to way how to check Memory Usage & Memory Leak for my running process               ~ # cat /proc/slabinfo     cat /proc/slabinfo     slabinfo - version: 2.1     # name            <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> : tunables <limit> <batchcount> <sharedfactor> : slabdata <active_slabs> <num_slabs> <sharedavail>     bridge_fdb_cache      12     59     64   59    1 : tunables  120   60    0 : slabdata      1      1      0     rpc_buffers            8      8   2048    2    1 : tunables   24   12    0 : slabdata      4      4      0     rpc_tasks              8     24    160   24    1 : tunables  120   60    0 : slabdata      1      1      0     rpc_inode_cache        0      0    416    9    1 : tunables   54   27    0 : slabdata      0      0      0     fib6_nodes            21    113     32  113    1 : tunables  120   60    0 : slabdata      1      1      0     ip6_dst_cache         33     34    224   17    1 : tunables  120   60    0 : slabdata      2      2      0     ndisc_cache            2     24    160   24    1 : tunables  120   60    0 : slabdata      1      1      0     RAWv6                  4      6    608    6    1 : tunables   54   27    0 : slabdata      1      1      0     UDPLITEv6              0      0    608    6    1 : tunables   54   27    0 : slabdata      0      0      0     UDPv6                  0      0    608    6    1 : tunables   54   27    0 : slabdata      0      0      0     tw_sock_TCPv6          0      0    160   24    1 : tunables  120   60    0 : slabdata      0      0      0     request_sock_TCPv6      0      0    128   30    1 : tunables  120   60    0 : slabdata      0      0      0     TCPv6                  0      0   1184    6    2 : tunables   24   12    0 : slabdata      0      0      0     UNIX                   3     10    384   10    1 : tunables   54   27    0 : slabdata      1      1      0     nf_conntrack_expect      0      0    140   28    1 : tunables  120   60    0 : slabdata      0      0      0     nf_conntrack           0      0    196   20    1 : tunables  120   60    0 : slabdata      0      0      0     flow_cache             0      0     80   48    1 : tunables  120   60    0 : slabdata      0      0      0     cfq_io_context         0      0     96   40    1 : tunables  120   60    0 : slabdata      0      0      0     cfq_queue              0      0     84   46    1 : tunables  120   60    0 : slabdata      0      0      0     mqueue_inode_cache      1      8    480    8    1 : tunables   54   27    0 : slabdata      1      1      0     jffs2_inode_cache      0      0     24  145    1 : tunables  120   60    0 : slabdata      0      0      0     jffs2_node_frag        0      0     24  145    1 : tunables  120   60    0 : slabdata      0      0      0     jffs2_refblock         0      0    252   15    1 : tunables  120   60    0 : slabdata      0      0      0     jffs2_tmp_dnode        0      0     32  113    1 : tunables  120   60    0 : slabdata      0      0      0     jffs2_raw_inode        0      0     68   56    1 : tunables  120   60    0 : slabdata      0      0      0     jffs2_raw_dirent       0      0     40   92    1 : tunables  120   60    0 : slabdata      0      0      0     jffs2_full_dnode       0      0     16  203    1 : tunables  120   60    0 : slabdata      0      0      0     jffs2_i                0      0    336   11    1 : tunables   54   27    0 : slabdata      0      0      0     nfs_write_data        36     40    480    8    1 : tunables   54   27    0 : slabdata      5      5      0     nfs_read_data         32     36    448    9    1 : tunables   54   27    0 : slabdata      4      4      0     nfs_inode_cache        0      0    576    7    1 : tunables   54   27    0 : slabdata      0      0      0     nfs_page               0      0     64   59    1 : tunables  120   60    0 : slabdata      0      0      0     fat_inode_cache        0      0    352   11    1 : tunables   54   27    0 : slabdata      0      0      0     fat_cache              0      0     20  169    1 : tunables  120   60    0 : slabdata      0      0      0     ext2_inode_cache       3      9    416    9    1 : tunables   54   27    0 : slabdata      1      1      0     journal_handle         0      0     20  169    1 : tunables  120   60    0 : slabdata      0      0      0     journal_head           0      0     52   72    1 : tunables  120   60    0 : slabdata      0      0      0     revoke_table           0      0     12  254    1 : tunables  120   60    0 : slabdata      0      0      0     revoke_record          0      0     16  203    1 : tunables  120   60    0 : slabdata      0      0      0     ext3_inode_cache       0      0    432    9    1 : tunables   54   27    0 : slabdata      0      0      0     ext3_xattr             0      0     44   84    1 : tunables  120   60    0 : slabdata      0      0      0     dnotify_cache          0      0     20  169    1 : tunables  120   60    0 : slabdata      0      0      0     inotify_event_cache      0      0     28  127    1 : tunables  120   60    0 : slabdata      0      0      0     inotify_watch_cache      0      0     40   92    1 : tunables  120   60    0 : slabdata      0      0      0     kioctx                 0      0    160   24    1 : tunables  120   60    0 : slabdata      0      0      0     kiocb                  0      0    160   24    1 : tunables  120   60    0 : slabdata      0      0      0     fasync_cache           0      0     16  203    1 : tunables  120   60    0 : slabdata      0      0      0     shmem_inode_cache    601    610    392   10    1 : tunables   54   27    0 : slabdata     61     61      0     nsproxy                0      0     28  127    1 : tunables  120   60    0 : slabdata      0      0      0     posix_timers_cache      7     37    104   37    1 : tunables  120   60    0 : slabdata      1      1      0     uid_cache              0      0    128   30    1 : tunables  120   60    0 : slabdata      0      0      0     UDP-Lite               0      0    480    8    1 : tunables   54   27    0 : slabdata      0      0      0     tcp_bind_bucket        2    113     32  113    1 : tunables  120   60    0 : slabdata      1      1      0     inet_peer_cache        1     59     64   59    1 : tunables  120   60    0 : slabdata      1      1      0     secpath_cache          0      0     32  113    1 : tunables  120   60    0 : slabdata      0      0      0     xfrm_dst_cache         0      0    288   13    1 : tunables   54   27    0 : slabdata      0      0      0     ip_fib_alias           0      0     16  203    1 : tunables  120   60    0 : slabdata      0      0      0     ip_fib_hash           10    101     36  101    1 : tunables  120   60    0 : slabdata      1      1      0     ip_dst_cache           4     15    256   15    1 : tunables  120   60    0 : slabdata      1      1      0     arp_cache              2     30    128   30    1 : tunables  120   60    0 : slabdata      1      1      0     RAW                    8      8    480    8    1 : tunables   54   27    0 : slabdata      1      1      0     UDP                   16     16    480    8    1 : tunables   54   27    0 : slabdata      2      2      0     tw_sock_TCP            0      0    128   30    1 : tunables  120   60    0 : slabdata      0      0      0     request_sock_TCP       0      0     96   40    1 : tunables  120   60    0 : slabdata      0      0      0     TCP                    4      7   1088    7    2 : tunables   24   12    0 : slabdata      1      1      0     sgpool-128             2      3   2560    3    2 : tunables   24   12    0 : slabdata      1      1      0     sgpool-64              2      3   1280    3    1 : tunables   24   12    0 : slabdata      1      1      0     sgpool-32              2      6    640    6    1 : tunables   54   27    0 : slabdata      1      1      0     sgpool-16              2     12    320   12    1 : tunables   54   27    0 : slabdata      1      1      0     sgpool-8               2     24    160   24    1 : tunables  120   60    0 : slabdata      1      1      0     scsi_bidi_sdb          0      0     20  169    1 : tunables  120   60    0 : slabdata      0      0      0     scsi_io_context        0      0    104   37    1 : tunables  120   60    0 : slabdata      0      0      0     blkdev_queue          25     28    952    4    1 : tunables   54   27    0 : slabdata      7      7      0     blkdev_requests        4     21    184   21    1 : tunables  120   60    0 : slabdata      1      1      0     blkdev_ioc             1     84     44   84    1 : tunables  120   60    0 : slabdata      1      1      0     biovec-256             2      2   3072    2    2 : tunables   24   12    0 : slabdata      1      1      0     biovec-128             2      5   1536    5    2 : tunables   24   12    0 : slabdata      1      1      0     biovec-64              2      5    768    5    1 : tunables   54   27    0 : slabdata      1      1      0     biovec-16              2     20    192   20    1 : tunables  120   60    0 : slabdata      1      1      0     biovec-4               2     59     64   59    1 : tunables  120   60    0 : slabdata      1      1      0     biovec-1               2    203     16  203    1 : tunables  120   60    0 : slabdata      1      1      0     bio                    2     59     64   59    1 : tunables  120   60    0 : slabdata      1      1      0     sock_inode_cache      66     66    352   11    1 : tunables   54   27    0 : slabdata      6      6      0     skbuff_fclone_cache      7      7   1056    7    2 : tunables   24   12    0 : slabdata      1      1      0     skbuff_head_cache    757    784    544    7    1 : tunables   54   27    0 : slabdata    112    112      0     file_lock_cache        0      0     96   40    1 : tunables  120   60    0 : slabdata      0      0      0     proc_inode_cache      16     24    312   12    1 : tunables   54   27    0 : slabdata      2      2      0     sigqueue               8     27    144   27    1 : tunables  120   60    0 : slabdata      1      1      0     radix_tree_node      216    221    288   13    1 : tunables   54   27    0 : slabdata     17     17      0     bdev_cache             3      9    416    9    1 : tunables   54   27    0 : slabdata      1      1      0     sysfs_dir_cache     4793   4872     44   84    1 : tunables  120   60    0 : slabdata     58     58      0     mnt_cache             18     30    128   30    1 : tunables  120   60    0 : slabdata      1      1      0     inode_cache         3568   3575    296   13    1 : tunables   54   27    0 : slabdata    275    275      0     dentry              4249   4309    124   31    1 : tunables  120   60    0 : slabdata    139    139      0     filp                 210    480    128   30    1 : tunables  120   60    0 : slabdata     16     16      0     names_cache            2      2   4096    1    1 : tunables   24   12    0 : slabdata      2      2      0     idr_layer_cache       91    116    136   29    1 : tunables  120   60    0 : slabdata      4      4      0     buffer_head           28     72     52   72    1 : tunables  120   60    0 : slabdata      1      1      0     mm_struct             18     18    416    9    1 : tunables   54   27    0 : slabdata      2      2      0     vm_area_struct       228    276     84   46    1 : tunables  120   60    0 : slabdata      6      6      0     fs_cache              24    113     32  113    1 : tunables  120   60    0 : slabdata      1      1      0     files_cache           25     40    192   20    1 : tunables  120   60    0 : slabdata      2      2      0     signal_cache          63     63    416    9    1 : tunables   54   27    0 : slabdata      7      7      0     sighand_cache         27     27   1312    3    1 : tunables   24   12    0 : slabdata      9      9      0     task_struct           64     64   1024    4    1 : tunables   54   27    0 : slabdata     16     16      0     anon_vma             123    339      8  339    1 : tunables  120   60    0 : slabdata      1      1      0     pid                   76    118     64   59    1 : tunables  120   60    0 : slabdata      2      2      0     size-4194304(DMA)      0      0 4194304    1 1024 : tunables    1    1    0 : slabdata      0      0      0     size-4194304           0      0 4194304    1 1024 : tunables    1    1    0 : slabdata      0      0      0     size-2097152(DMA)      0      0 2097152    1  512 : tunables    1    1    0 : slabdata      0      0      0     size-2097152           0      0 2097152    1  512 : tunables    1    1    0 : slabdata      0      0      0     size-1048576(DMA)      0      0 1048576    1  256 : tunables    1    1    0 : slabdata      0      0      0     size-1048576           1      1 1048576    1  256 : tunables    1    1    0 : slabdata      1      1      0     size-524288(DMA)       0      0 524288    1  128 : tunables    1    1    0 : slabdata      0      0      0     size-524288            0      0 524288    1  128 : tunables    1    1    0 : slabdata      0      0      0     size-262144(DMA)       0      0 262144    1   64 : tunables    1    1    0 : slabdata      0      0      0     size-262144            0      0 262144    1   64 : tunables    1    1    0 : slabdata      0      0      0     size-131072(DMA)       0      0 131072    1   32 : tunables    8    4    0 : slabdata      0      0      0     size-131072            0      0 131072    1   32 : tunables    8    4    0 : slabdata      0      0      0     size-65536(DMA)        0      0  65536    1   16 : tunables    8    4    0 : slabdata      0      0      0     size-65536             2      2  65536    1   16 : tunables    8    4    0 : slabdata      2      2      0     size-32768(DMA)        0      0  32768    1    8 : tunables    8    4    0 : slabdata      0      0      0     size-32768             2      2  32768    1    8 : tunables    8    4    0 : slabdata      2      2      0     size-16384(DMA)        0      0  16384    1    4 : tunables    8    4    0 : slabdata      0      0      0     size-16384             2      2  16384    1    4 : tunables    8    4    0 : slabdata      2      2      0     size-8192(DMA)         0      0   8192    1    2 : tunables    8    4    0 : slabdata      0      0      0     size-8192              9      9   8192    1    2 : tunables    8    4    0 : slabdata      9      9      0     size-4096(DMA)         0      0   4096    1    1 : tunables   24   12    0 : slabdata      0      0      0     size-4096            625    625   4096    1    1 : tunables   24   12    0 : slabdata    625    625      0     size-2048(DMA)         0      0   2048    2    1 : tunables   24   12    0 : slabdata      0      0      0     size-2048            588    588   2048    2    1 : tunables   24   12    0 : slabdata    294    294      0     size-1024(DMA)         0      0   1024    4    1 : tunables   54   27    0 : slabdata      0      0      0     size-1024            136    136   1024    4    1 : tunables   54   27    0 : slabdata     34     34      0     size-512(DMA)          0      0    512    8    1 : tunables   54   27    0 : slabdata      0      0      0     size-512            1000   1000    512    8    1 : tunables   54   27    0 : slabdata    125    125      0     size-256(DMA)          0      0    256   15    1 : tunables  120   60    0 : slabdata      0      0      0     size-256             120    120    256   15    1 : tunables  120   60    0 : slabdata      8      8      0     size-192(DMA)          0      0    192   20    1 : tunables  120   60    0 : slabdata      0      0      0     size-192             120    120    192   20    1 : tunables  120   60    0 : slabdata      6      6      0     size-128(DMA)          0      0    128   30    1 : tunables  120   60    0 : slabdata      0      0      0     size-128             617    630    128   30    1 : tunables  120   60    0 : slabdata     21     21      0     size-96(DMA)           0      0     96   40    1 : tunables  120   60    0 : slabdata      0      0      0     size-96              151    160     96   40    1 : tunables  120   60    0 : slabdata      4      4      0     size-64(DMA)           0      0     64   59    1 : tunables  120   60    0 : slabdata      0      0      0     size-32(DMA)           0      0     32  113    1 : tunables  120   60    0 : slabdata      0      0      0     size-64             1298   1298     64   59    1 : tunables  120   60    0 : slabdata     22     22      0     size-32             4632   4859     32  113    1 : tunables  120   60    0 : slabdata     43     43      0     kmem_cache           147    160     96   40    1 : tunables  120   60    0 : slabdata      4      4      0


Directx application using wine over ssh -x

I'm trying to run a Windows app (Artemis video game - server mode) on my archlinux server. As it is an windows application I have to run it using Wine. As I'd like to be able to launch the server from anywhere, I'd like to do it using ssh -X (unfortunatelly this app can only be configured and launched on GUI mode) I manage to launch wine Artemis.exe on both my laptop (local install) and my server, however launching it using ssh -X gives me an error : ![enter image description here](http://i.stack.imgur.com/0K2kq.png) I'd like to poitn out that ssh -X works fine between those two. I managed to launch "wine notepad" using ssh -X ! It seams to come down to directX, which I don't really know about. I tried installing directX9 through winetricks on both the laptop and the server. Did anyone face this before ? Have you got any solution for me to try ?


Prerouting issue

I have three hosts: A, B and C. Let's say host A is continuously communicating with host C (e.g. poll - response). Now, I spoof both ARP tables of host and A and C with host B and want to block communication with host C, in order to make host A communicate with host B only. To perform redirection of traffic I used `iptables -t nat -A PREROUTING -i eth0 -p tcp --dport <port> -j DNAT --to <host B>` but it requires the connection on host A to be shut down and then up again for the traffic to be redirected. Is there anything missing so I dont have to stop and run the communication in host A everytime I try to spoof and redirect the traffic?


Use /etc/init.d/fetchmail with the personnal ~/.fetchmailrc

Now, I have two users in my system using `fetchmail` with a personal `~/.fetchmailrc` and syncing there mails with the command `fetchmail -kv --uidl -m '\''/usr/bin/procmail -d %T'\` (In a cron but this isn’t important). Then, I would like to use the `/etc/init.d/fetchmail` service but always with the personal `fetchmailrc` of this tow users. I wouldn't like to use the `/etc/fetchmailrc` global conf. Is this possible? I know the possibility to make a global cron but before I would know if what I said is possible or not.


How to completely close linux from outside world?

This is theoretical question that seems to be interesting (at least for me). What would you do to completely close the whole system from outside world? By close I mean that any human shouldn't be able to login and it should only do some tasks with the simplest interface with outside world that is needed for them. It should be IMPOSSIBLE (ok - to possible extent ;) ) to access internal structure by anyone. However - after cutting power off, and restarting it that way - it should continue its work. I imagine that HDD should be encrypted, so after cutting power off - it shouldn't be possible to get anything from it. Is it possible or how close can we get? PS. I don't even know what tags to use :( .


External hard drive permissions - ext4

I have an external USB 3 disk drive (2TB capacity) that is most likely going to be moved from machine to machine. The disk has a GUID partition table and an ext4 partition. I am unable to write to the disk unless I elevate the process (`sudo`). As of now I am thinking of trying one or both of the following and would like to know the cons of each -   1. `chmod 777 /mnt/externalDrive`   2. `chown nobody:nogroup /mnt/externalDrive` If I give 777 permission and user1 (UID:1005) writes to it and I later move the disk to another computer where user7 is UID:1005, what happens? Does user7 become the owner of the file on that computer? It seems to me that I will periodically have to run `chown -R nobody:nogroup /mnt/externalDrive` on the disk. Is any of what I am considering an obvious bad practice? The disk will most likely contain videos, music and pictures none of it need to be protected like some financial data.


Is there a very small version of Linux which could be filled to own wish?

Is there a mini-Linux, which would be just practically terminal prompt and you could install environment on your own? Including programs, plugins, drivers, DE (desktop environment)? I'm currently using Ubuntu which seems like a good decision. But I'd like to have more control over the OS on ground level (by this I mean terminal level). Sometimes there are programs which I uncovered when installing new ones, that I don't think I'll use any time soon or ever... definitely never. I made my mini-research and it comes down to **Linux Arch** , which technically is what I'm asking for. But frankly, the OS is about 800MB big, so I expect it to have a lot of stuff I won't really need, again. Because as I remember, Ubuntu was about same size and it was pre-installed with everything. So. Do you maybe know empty Linux's OS? Just terminal? I can get driver for screen, sound, wireless and all other.


Why is =sys-libs/glibc-2.16's --enable-kernel is ignored on Gentoo Linux?

I'm trying to build eglibc support for old kernels, 2.6.9 in this case. So I set `NPTL_KERNEL_VER` in make.conf, and during configuration phrase I can see the `\--enable-kernel=2.6.9` parameter But this seems to be reverted:               checking installed Linux kernel header files... 2.6.19 or later     configure: WARNING: minimum kernel version reset to 2.6.16      Any ideas? (I'm building `=sys-libs/glibc-2.16` for `i686-pc-linux-gnu`.)


Debian package of Tomee plus

I'm looking for Debian package of Tomee plus but I have not found anything. Also, I would like to know if it is possible to download the package( on windows) then be installed on Debian or I have to download and install directly on Debian?


Decrypt second encrypted LVM during headless server boot?

I've followed this question https://unix.stackexchange.com/questions/5017/ssh- to-decrypt-encrypted-lvm-during-headless-server-boot and successfully remotely decrypted my root drive. However, I have a second drive that I also have encrpted, and unfortunately dropbear is killed by the boot process before second passphrase prompt for the second drive is shown and the main open-ssh server has not yet started so once again the headless system sits waiting for input indefinitely. Is there any way round this? The second drive will be used for private cloud data storage so needs to be encrypted to protect the data, and needs to be decrypted before the cloud service starts (which I haven't chosen or installed yet). Ubuntu 13.10 x64 server running headless, though I'm not totally tied to Ubuntu it is kinda convenient.


Fail to use "locate"

I have a file named `Fubini's_theorem.html` under some directory. But both               locate "Fubini's_theorem"      or               locate Fubini      do not return anything. The file has been there for months, and I am sure it is already in the database used by `locate`. So I wonder why the search is not successful? Thanks! My OS is Ubuntu 10.10.


Is there a way to limit overall CPU consumption?

My laptop (an HP with an i3 chip) overheats like crazy every time I run a resource heavy process (like a large compilation, extracting large tarballs or ... playing Flash). I am currently looking into some cooling solutions but got the idea of limiting global CPU consumption. I figured that if the CPU is capped, chances are the temperature will stop increasing frantically, and I'm willing to sacrifice a little performance in order to get the job done.   1. Am I wrong in my reasoning?    2. How can I proceed to cap the CPU usage overall? If it helps, I'm running Debian.


How do I get DVDs to play in Debian?

I just installed Debian Live and movie or video DVDs do not play. Totem gives me this error: > Could not read from resource. Opening the disk in VLC has no response. How can I play DVDs?


LyricWiki Audacious plugin

Just now I have discovered the LyricWiki plugin. The problem: it is not finding some lyrics, as you can see on the image. ![enter image description here](http://i.stack.imgur.com/4TRaT.png) But that lyric is available here: Я Так Тебя Жду Is it possible to add other lyrics source? How could I solve the problem?


What is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?

I have my 1TB disk partitioned in three main parts:   * /dev/sda1 NTFS SYSTEM 100 Mb    * /dev/sda2 NTFS Win7 469.12 Gb (too large!!)   * /dev/sda3 extended 373.36 Gb      * /dev/sda5/ ext4 358.21 Gb     * /dev/sda6 swap 15.15 Gb I want to resize my /dev/sda5 adding the unallocated space...but it is located left to sda5/. How can I organize it? I am working with GParted, but when I use Resize/Move option on sda5/ the unallocated space don’t appear on left. Thanks for getting back to me.    ![Image from GParted](http://i.stack.imgur.com/lm17R.png)                          ![Details about sda5/](http://i.stack.imgur.com/79R8Q.png)


How can I install Mint using Wubi on Windows 8?

I'm trying to install mint 15 on my laptop (with pre-installed windows 8.1) using mint4win. Every time I try to boot up with mint, it ends up on an error screen saying "windows failed to start. a recent hardware or software change might have caused this. The file is missing - file \linuxmint\winboot\wubildr.mbr - status 0xc000007b". Can anyone tell me how to proceed with mint installation?


Firefox discards URL when server connection times out or fails

I have two problems with Firefox:   1. When I type a non-existent server into the address bar, such as              http://xyz.example.com      I get "server not found", but when I try to fix the address, Firefox forgets the URL and I need to start all over.   2. When the server is taking a long time to respond, and I click on the `X` icon to stop loading the page, the URL disappears as well In both cases I want the URL to stay there in the address bar, so that I don't have to type it all over again. Is there a setting to make it do that? I am using `Firefox (Iceweasel) 24.7` on `Debian Wheezy`


How to set the prompt and tab-title on Gnome-Shell (Gnome 3, centos 7)

This is embarrassing, but I don't seem to be able to set the command-prompt or the shell title. I'm using Gnome3 on centos 7. **PROMPT** I've added the following to ~/.bashrc:               export PS1="\w \$ "      The prompt stays the same:               echo $PS1     [\u@\h \W]\$      I've also tried updating the ~/.bashrc without the export:               PS1="\w \$ "      Same result. It is almost like something is overriding it. **TITLE** As for the title I've tried the following:               echo -ne "\033]0;hi\007"      It doesn't take effect.


load module via /etc/modules

I want to load my kernel module `hello.ko` on boot in Ubuntu 12.04. I placed it in `/lib/modules/3.8.0-31-generic/kernel/ubuntu/hello.ko`, ran `depmod -a`, and added "hello" to `/etc/modules`. However, when I restart, there is no "hello" module in `lsmod`. In `/var/log/upstart/module-init-tools.log` there is a string "FATAL: Module hello not found." If I run `modprobe hello` everything is fine. What's wrong with `/etc/modules`? Where is it trying to find modules?


Xorg with Kernel Mode Settings won't work with other tty

Using intel video drivers with kms and i915 on arch linux I haven't been able to start Xorg in a different tty than from the calling one logged as root. By example: Logged as root on tty1               X vt7 :0      Freezes the PC and within the Xorg.0.log I see               intel(0): failed to set mode: Permission denied [13]      In the other hand Logged as root on tty1               X vt1 :0      Everything works as usual I know is not really a serious problem since I still can use Xorg but I'm really intrigued about this behavior for two main reasons   1. permissions for all tty1 ... tty49 are cwr-w----- root tty   2. even if a I'm logged in both tty1 and tty2 with root and try to start X server on tty2 from tty1 it doesn't work as if it only had permission for the calling tty Does anyone have and idea on what's going on?


Removable USB stick listed as non-removable in /sys/block?

In my question Bash script to output path to USB flash memory stick I got stuck on a problem nobody else seems to be having. (The issue also impedes my desire to use this answer: http://unix.stackexchange.com/a/60335/15010.) So I made that specific problem into this new question. Apparently removable devices listed in /sys/block end with 1. It is stated here: http://unix.stackexchange.com/a/80880/15010 and several other places in this http://unix.stackexchange.com and this principle is used in the answers I referenced above. My removable device, a Sandisk 64GB flash memory stick, is listed as:               /sys/block/sdl/removable:0      Apparently, removable devices should end in 1 (and my others do). Why does my USB memory stick not follow the rule? It was automounted by Dolphin. I'm running Kubuntu 12.04. Dolphin shows it as "59.6GiB Removable Media". And it is mounted (automatically) at /media/me/70E8-1567 `sudo blkid` shows it as:               /dev/sdl1: UUID="70E8-1567" TYPE="vfat".      'lsblk -do name,rm` shows:               sdl   0      And `lsusb -vv` shows:               Bus 001 Device 008: ID 0781:5530 SanDisk Corp. Cruzer     Device Descriptor:       bLength                18       bDescriptorType         1       bcdUSB               2.00       bDeviceClass            0 (Defined at Interface level)       bDeviceSubClass         0        bDeviceProtocol         0        bMaxPacketSize0        64       idVendor           0x0781 SanDisk Corp.       idProduct          0x5530 Cruzer       bcdDevice            2.01       iManufacturer           1        iProduct                2        iSerial                 3        bNumConfigurations      1       Configuration Descriptor:         bLength                 9         bDescriptorType         2         wTotalLength           32         bNumInterfaces          1         bConfigurationValue     1         iConfiguration          0          bmAttributes         0x80           (Bus Powered)         MaxPower              200mA         Interface Descriptor:           bLength                 9           bDescriptorType         4           bInterfaceNumber        0           bAlternateSetting       0           bNumEndpoints           2           bInterfaceClass         8 Mass Storage           bInterfaceSubClass      6 SCSI           bInterfaceProtocol     80 Bulk-Only           iInterface              0            Endpoint Descriptor:             bLength                 7             bDescriptorType         5             bEndpointAddress     0x81  EP 1 IN             bmAttributes            2               Transfer Type            Bulk               Synch Type               None               Usage Type               Data             wMaxPacketSize     0x0200  1x 512 bytes             bInterval               0           Endpoint Descriptor:             bLength                 7             bDescriptorType         5             bEndpointAddress     0x02  EP 2 OUT             bmAttributes            2               Transfer Type            Bulk               Synch Type               None               Usage Type               Data             wMaxPacketSize     0x0200  1x 512 bytes             bInterval               1


How to reset all iptables settings?

Are there any simpler commands to these? (e.g.: a oneliner? can one command reset iptables/netfilter settings to this?)               IPTABLES="$(which iptables)"          # RESET DEFAULT POLICIES     $IPTABLES -P INPUT ACCEPT     $IPTABLES -P FORWARD ACCEPT     $IPTABLES -P OUTPUT ACCEPT     $IPTABLES -t nat -P PREROUTING ACCEPT     $IPTABLES -t nat -P POSTROUTING ACCEPT     $IPTABLES -t nat -P OUTPUT ACCEPT     $IPTABLES -t mangle -P PREROUTING ACCEPT     $IPTABLES -t mangle -P OUTPUT ACCEPT          # FLUSH ALL RULES, ERASE NON-DEFAULT CHAINS     $IPTABLES -F     $IPTABLES -X     $IPTABLES -t nat -F     $IPTABLES -t nat -X     $IPTABLES -t mangle -F     $IPTABLES -t mangle -X