Switch Fn key state

I have this issue with Lenovo Thinkcentre Edge. Its keyboard has `Fn` key, which acts in my Ubuntu (with Fluxbox) as if it is always "active/pressed". I can't use standard `F1`-`F12` keys unless I hold down this stupid key. You see, I'm a programmer so it's really pain to me. So I decided to remap function keys with `xev` and `xmodmap` I remapped `F1`-`F3` and 'till this point everything is fine, but `F4` does some kind of window minimization. When I run `xev` and hit `F4`, I don't get a reply from the program with a keycode and stuff, instead the window is minimized and when I maximize the window again there is no response from the key. Important info: The function of `Fn` key can't switched in bios. So the question is: Do you have ANY idea how to solve my mystery? EDIT:               # content of .fluxbox/keys     # click on the desktop to get menus     OnDesktop Mouse1 :HideMenus     OnDesktop Mouse2 :WorkspaceMenu     OnDesktop Mouse3 :RootMenu          # scroll on the desktop to change workspaces     OnDesktop Mouse4 :PrevWorkspace     OnDesktop Mouse5 :NextWorkspace          # scroll on the toolbar to change current window     OnToolbar Mouse4 :PrevWindow {static groups} (iconhidden=no)     OnToolbar Mouse5 :NextWindow {static groups} (iconhidden=no)          # alt + left/right click to move/resize a window     OnWindow Mod1 Mouse1 :MacroCmd {Raise} {Focus} {StartMoving}     OnWindowBorder Move1 :StartMoving          OnWindow Mod1 Mouse3 :MacroCmd {Raise} {Focus} {StartResizing NearestCorner}     OnLeftGrip Move1 :StartResizing bottomleft     OnRightGrip Move1 :StartResizing bottomright          # alt + middle click to lower the window     OnWindow Mod1 Mouse2 :Lower          # control-click a window's titlebar and drag to attach windows     OnTitlebar Control Mouse1 :StartTabbing          # double click on the titlebar to shade     OnTitlebar Double Mouse1 :Shade          # left click on the titlebar to move the window     OnTitlebar Mouse1 :MacroCmd {Raise} {Focus} {ActivateTab}     OnTitlebar Move1  :StartMoving          # middle click on the titlebar to lower     OnTitlebar Mouse2 :Lower          # right click on the titlebar for a menu of options     OnTitlebar Mouse3 :WindowMenu          # alt-tab     Mod1 Tab :NextWindow {groups} (workspace=[current])     Mod1 Shift Tab :PrevWindow {groups} (workspace=[current])          # cycle through tabs in the current window     Control Tab :NextTab     Control Shift Tab :PrevTab          # go to a specific tab in the current window     Mod4 1 :Tab 1     Mod4 2 :Tab 2     Mod4 3 :Tab 3     Mod4 4 :Tab 4     Mod4 5 :Tab 5     Mod4 6 :Tab 6     Mod4 7 :Tab 7     Mod4 8 :Tab 8     Mod4 9 :Tab 9          # open a terminal     Mod1 F1 :Exec x-terminal-emulator          # open a dialog to run programs     Mod1 F2 :Exec fbrun          # volume settings, using common keycodes     # if these don't work, use xev to find out your real keycodes     176 :Exec amixer sset Master,0 1+     174 :Exec amixer sset Master,0 1-     160 :Exec amixer sset Master,0 toggle          # current window commands     Mod1 F4 :Close     Mod1 F5 :Kill          # open the window menu     Mod1 space :WindowMenu          # exit fluxbox     Control Mod1 Delete :Exit          # change to previous/next workspace     Control Mod1 Left :PrevWorkspace     Control Mod1 Right :NextWorkspace          # change to a specific workspace     Control F1 :Workspace 1     Control F2 :Workspace 2     Control F3 :Workspace 3     Control F4 :Workspace 4          #osobni     Mod4 d :ShowDesktop     Mod4 m :Maximize     Mod4 f :Exec firefox     Mod4 u :Exec unison-gtk     Mod4 e :Exec eclipse     Mod4 t :Exec thunderbird     Mod4 q :Exec qutim     Mod4 s :Exec skype      Ubuntu is 12.04 LTS, kernel               3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux


SSH from osx to osx and then use agent

I have a mac at home and a mac at work. The work mac is setup for ssh to all work related servers. Sometimes I have to connect from my home mac and access the servers which are setup on my work mac. When I connect to VPN and ssh into my work mac, and try to ssh to any other servers which are set in the config of my work mac it's asking for my passphrase for the user of my work mac, which I don't have any, so I just hit enter and then it asks for the password for the server I want to connect to (keyless ssh setup). The ssh-agent is not running by default when I connect to my work mac via ssh. I have to start it manually. I also have a similar setup on my home mac, sshing into a linux virtualbox and then to an amazon ec2 instance using the ssh-agent from the box and it works fine without any problems. Could you tell me how to fix this issue? Or a workaround?


Combine input from multiple files/pipes without clobbering lines or blocking?

Is there a tool that will take input from multiple files or pipes and write it to stdout, without blocking on reads, such that individual input lines come out intact? I basically want to multiplex a bunch of inputs onto one output without clobbering lines.               $ combine file1 <(prog2) ... > nice-output.txt        1. I don't care about the order of the output   2. It should not block as long as some input has data   3. It should be efficient (i.e., I may downvote your Perl one-liner ;)


gvim -p limit of opened tabs?

When I run :               gvim -p *.xyz      I find that not all files are opened in tabs. It feels, like a kind of tab limit? But ! When I try to open unopened with :               :tabnew      it is opened next to previous tabs - it works ! How to make `gvim -p ...` to open all files without need of opening those above limit manually with `:tabnew` ? Btw. Is this limit somewhere written ? Possible to be configured?


Have Samba "proxy" for another server?

This might be a weird question, but can you have Samba "proxy" for another server? IE if mount a share on `\\server1\someshare` the server transparently proxies it to `\\otherserver\randomshare`. Note that redirection will not work since `\\otherserver` is not directly accessible. The servers run Ubuntu Server 12.04. Is there any way to do this?


Need help with understanding output of ps -ef on linux

When I do ps -ef on my Linux box, I get: UID PID PPID C STIME TTY TIME CMD Please help me with meaning of C,TIME. is the TIME , the actual cpu time allocated to the process?


Only one file name allowed error

Sometimes I forget to do `sudo vim` and open files to which I don't have write permission. I saw this post and it was really helpful. When I did `:w !sudo tee %` it asked me for a password and then the options `(O)K` and `(L)OAD`. This worked fine. But when I did `:wq !sudo tee %`, `vim` gave me an error -               E172: Only one file name allowed      Why didn't it let me go to the prompt after `wq`. I don't understand this error.


How do I view executables run by a program?

Is there a way to view or get a list of executables that a program uses? A particular example is file-roller. Is there a way to see which executables it uses, if there is more than one executable it could use for the same task, e.g. unrar and p7zip-rar. The program 'ldd' can be used to view the libraries a programs uses, though not in real-time. Is there an equivalent for executables, preferably in real- time? Or some other method?


How to extract logs between two time stamps

I want to extract all logs between two timestamps. Some lines may not have the timestamp, but I want those lines also. In short, I want every line that falls under two time stamps. My log structure looks like:               [2014-04-07 23:59:58] CheckForCallAction [ERROR] Exception caught in +CheckForCallAction :: null     --Checking user--     Post     [2014-04-08 00:00:03] MobileAppRequestFilter [DEBUG] Action requested checkforcall      Suppose I want to extract everything bewteen '2014-04-07 23:00' and '2014-04-08 02:00'. Please note the start time stamp or end time stamp may not be there in the log, but I want every line between these two time stamps.


How to install Sun/Oracle Java 1.6 onto centOS 6 using only textmode?

So, after a few days of struggle I have yet to be successful in installing Sun/Oracle java 1.6 onto my CentOS. The issues seem to be as follows   * No sun java 1.6 package available in repo due to license issues   * The alternative is to download an rpm from the oracle site      * Problem with that is, I'm using text mode only, so I tried to use lynx.     * Problem with lynx is, Oracle demands you accept the license prior to download, but the facility with which it presents the license prompt(JavaScript) does not function within lynx. So, the question remains, how do I get java 1.6 (sun) onto my CentOS system using only textmode?


Tsocks with mail user agent mailx not working

I use a SOCKS proxy server to send mail using `sendmail` in Linux and `mailx` to send mails from the command line. To make use of the SOCKS server, I am using `tsocks` to send mails using `mailx`, for example like this               tsocks mailx -s "Test mail" valid_mail_address@gmail.com      But the mails I send are not going through the proxy. I don't know what I do wrong. Any help please.


Back up mysql server

I want to backup all databases, users and etc on our mysql sever. I have come across the command `mysqldump` and believe I can use it like this? (Trying to backup a REMOTE server to our LOCAL machine)               mysqldump -h web-server.com -u root -p root --all-databases > "/backups/mysql/`date +%Y%m%d`.sql"      However:   1. I'm scared to run this with little knowledge of whats happening (we have a lot of data on the mysql database and we can't afford to lose it!). So first question is: Will this do what I want? Log into the remote server (located at `web-server.com` for example) and backup all the mysql databases to the path `/backups/mysql` on the LOCAL machine?   2. I'm not convinced that this will also keep all the user information for each database in tact in the event of a mysql server failure. Is user information just stored as another database in the mysql databases? Or is it a function of the server itself? In this case is there a different way I can backup the database to include the user data too?


Openshot-1.3.0 not working on Fedora 14

I am trying to install openshot 1.3 from yesterday. After doing everything I could do and searching the whole web. I am finally asking this. I downloaded the source and installed it from there and then installed the mlt libs too ( but not sure whether I have python binding or not). finally I found this debug script and I dont know what to do with it. So will just give you the output of that debug file. Help will be appreciated.                $ sudo python debug.py     -----------------------------------------------------------     OpenShot Debug File 0.0.2 - 2011-04-17 18:29:42.730477     -----------------------------------------------------------     This file contains a list of installed packages related to OpenShot,     locations of files, and a list of shared libraries used by python-mlt.               -----------------------------------------------------------     Distribution Version Info     -----------------------------------------------------------     LSB Version:    :core-4.0-amd64:core-4.0-noarch     Distributor ID: Fedora     Description:    Fedora release 14 (Laughlin)     Release:    14     Codename:   Laughlin                    Traceback (most recent call last):       File "debug.py", line 45, in <module>         process = subprocess.Popen(["dpkg","-l","openshot", "libmlt1", "libmlt2", "python-mlt", "python-mlt2", "openshot-mlt"], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT)       File "/usr/lib64/python2.7/subprocess.py", line 672, in __init__         errread, errwrite)       File "/usr/lib64/python2.7/subprocess.py", line 1201, in _execute_child         raise child_exception     OSError: [Errno 2] No such file or directory      Also here it seems like it was searching in /use/lib64, but i found the file in /usr/lib/...so i copied the openshot folder from lib to /usr/lib64/python2.7/site-packages but to no avail. Well hope someone can help soon.


Is it possible to show mathematical symbols in the terminal?

I want to do some program that can help me to check scientific formulars via terminal. It is possible or not if i want to show mathematical symbols (e.g. integral, diff Greek's Alphabets) on Linux's terminal. And if not what is the best way to represent the mathematical symbols when you working on terminal?


How to specify special characters in djvused bookmarks

1. In djvused bookmark format, to disable characters that have special meaning in djvused bookmark format: The format of `djvused` bookmark of a djvu file is for example:              (bookmarks      ("1 first chapter" "#10"       ("1.1 first section" "#11"       ("1.1.1 first subsection" "#12" ))      ("1.2 second section" "#13" ))      ("2 second chapter" "#14"       ("2.1 first section" "#16" )      ("2.2 second section" "#13" ))     )      ...where the main points are the paring of left and right parenthesis for tree-like organization of sections and chapters, double quote for each bookmark item and each page number is preceded by a `#`. How can I escape characters like `"`, `(` and `)` to not be interpreted as control characters in the titles of chapters and sections? e.g. The following examples will not be accepted by `djvused`:              ("2.2 "Hello!" " "#13" )     ("2.2 f(g)" "#13" )      The command I use to embed bookmarks into a djvu file is `djvused in.djvu -e 'set-outline bmks' -s`, where `bmks` is the text file for bookmarks.   2. In djvused bookmark format, to enable characters that have special meaning in general text files: The character `\n` means new line. But if using it directly in djvu bookmark format, it will be shown as it is, not be interpreted as new line. For example:              (bookmarks      ("long title part 1 \n long title part 2" "#10"      )      The long title will not be broken into two lines where `\n` is specified.


How to find the device in a RAID1 under Linux?

besides:               head -2 /dev/dm-16 | strings | grep ^id       how can I find that which device belongs to a given MD RAID1 array?


UNIX: how to change group of read-only file system

I am trying to change the group of a file that I (`user123`) am an owner of but I am getting an error. It won't let me change the directory permissions, either. It keeps saying the file system is read-only. I don't understand why it won't let me change permissions of a directory of which I am the owner!               (user123) @ subdomain.example.org [/dev/sudo/app/prog/id]     $ ls -la     total 3     drwxr-sr-x 2 user app 1024 Jun 18 11:12 etc          (user123) @ subdomain.example.org [/dev/sudo/app/prog/id]     $ chgrp mygroup etc/     chgrp: changing group of `etc/': Read-only file system


Using iptables to block for specific services

I am using ipset in conjunction with iptables to create a list of IPs I want to block. I did this:               ipset -N blocking iphash     ipset -A blocking 124.205.11.230     // and repeated this line for all IPs I want to add to "blocking" list      now I have to add this rule to iptables if I do this               iptables -A INPUT -m set --set blocking src -j DROP      the IPs will be blocked for everything SSH, FTP, etc. I want just to block them from using my email system dovecot, exim. how do I do that?


Per executable UDP port redirection possible?

I have a black box program which listens on a particular UDP port. I'd like it to listen to a UDP port of my choosing. Is there a way to trick the executable into listening on a differen port. I might imagine there exists a library which could be injected with LD_PRELOAD that might incercept the system calls and facilitate this. A virtual machine of course is the heavy handed option, but that's not an option for me.


Deluge crashes when deleting a torrent

When I go to delete a torrent, Deluge version 1.3.3 on Linux Mint LMDE 64-bit w/ MATE crashes and fails to delete the torrent. 4GB RAM, Lenovo SL400, 450GB disk space free. Happens reliably, 90% of the time. How may I collect the data to solve this?


shutdown ubuntu server after 2 days at midnight

**without using a cronjob** how would I have a ubuntu server shutdown after 2 days (2880 minutes) at midnight? The essence of what I want to do is this: `bash shutdown -r +2880 00:00 ` which would tell shutdown to shutdown after 2880 minutes, but to make sure that it is midnight before actually shutting down.


Why are new cronjobs ignored unless crond is restarted in SLES?

I added a new cronjob with a user (SUSE LINUX Enterprise Server 9.4):               # su - XXX     $ crontab -e      and this is what I added:               * * * * * echo `date` >> /home/XXX/a.txt      but the a.txt isn't created... it will be ONLY created when root restarts the crond... **Q:** Why? UPDATE:               machine:~ # chage -l XXX     Minimum:    1     Maximum:    99999     Warning:    7     Inactive:   -1     Last Change:        Apr 11, 2011     Password Expires:   Never     Password Inactive:  Never     Account Expires:    Never     machine:~ #       so the user or it's password doesn't expired. UPDATE: cron version:               cron-3.0.1-920.18      and I tried to add a new crontab to the root user.. it's the same :D the new root cronjobs aren't running too.. :D **it looks like "crontab -e" doesn't reloads CROND or something...**


Ip connectivity with two interfcaes

I have two network interfaces in Linux machine , eth0 and eth1. IP is assigned to both interface from two different VLANs and default gateway to eth0. Now if interface eth0 is down I am unable to route traffic outside as default gateway is also unavailable. Is there is any way to address this scenarios?


Exit status of an asynchronous process

Although the following command returns an exit status that depends on the existence of the remote file:               ssh $userAtServer "ls $targetDir/$targetFile" > $sshOutputFile     lsReturnValue=$?      which I can then test to do some stuff, it **sometimes** hangs (1 out of 10 or 20) and blocks further code execution. So I need to run a ssh command like this one and to retrieve the exit value of the ls function:               (ssh $userAtServer "ls $targetDir/$targetFile" > $sshOutputFile ; lsReturnValue=$?) &     timeOutProcess $!      However, lsReturnValue always return an empty string. timeOutProcess is a function that kills my command if it lasts for too much time:               timeOutProcess() {         processId=$1              #from http://www.bashcookbook.com/bashinfo/source/bash-4.0/examples/scripts/timeout3         timeout=45         interval=2         delay=5         (             ((t = timeout))                  while ((t > 0)); do                 sleep $interval                 kill -0 $processId || return 0                 ((t -= interval))             done             # Be nice, post SIGTERM first.             # The 'exit 0' below will be executed if any preceeding command fails.             kill -s SIGTERM $processId && kill -0 $processId || exit 0             sleep $delay             kill -s SIGKILL $processId         ) 2> /dev/null       }      I wonder how could I get the $? value from the ssh command ?


Bridged network on OS X only gets UDP broadcast traffic

I've created a bridged network Mac OS X 10.8.5 using `ifconfig` and TUNTAP for OS X to bridge my wireless connection, `en0`, with a virtual interface, `tap0`, which I can use for guest VMs:                   $ sudo sysctl -w net.inet.ip.forwarding=1         $ sudo sysctl -w net.link.ether.inet.proxyall=1         $ sudo sysctl -w net.inet.ip.fw.enable=1              $ sudo ifconfig bridge0 create         $ sudo ifconfig bridge0 addm en0 addm tap0         $ sudo ifconfig bridge0 up              $ ifconfig         en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500             ether 28:cf:xx:xx:xx:xx             inet6 xxxx::xxxx:xxxx:xxxx:xxxx%en0 prefixlen 64 scopeid 0x4             inet 192.168.100.64 netmask 0xffffff00 broadcast 192.168.100.1             media: autoselect             status: active         bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500             ether ac:de:xx:xx:xx:xx             Configuration:                 priority 0 hellotime 0 fwddelay 0 maxage 0                 ipfilter disabled flags 0x2             member: en0 flags=3<LEARNING,DISCOVER>                      port 4 priority 0 path cost 0             member: tap0 flags=3<LEARNING,DISCOVER>                      port 8 priority 0 path cost 0         tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500             ether ca:3d:xx:xx:xx:xx             open (pid 88244)      However, if I `tcpdump -i tap0`, I only see broadcast traffic. Shouldn't I see a mirror of everything on `en0`? (192.168.100.33, the host doing the broadcasting, is another unrelate, noisy server on my LAN.) ![broadcast packets](http://i.stack.imgur.com/jU64I.png) (I asked a similar question here and will probably close it.)


Are there naming conventions for variables in shell scripts?

Most languages have naming conventions for variables, the most common style I see in shell scripts is `MY_VARIABLE=foo`. Is this the convention or is it only for global variables? What about variables local to the script?


Random mac address at startup

I would like to get a random mac address everytime I turn on my linux machine (debian). Is this possible? If so, how?


selecting rows that have the same value

I have a problem in selecting rows that have the same value. My data is too huge to go row by row to do that. I want you guys to let me know scripts that can perform this. My data looks like as below: file name: `temp`               Start day   hour    end day        hour Value     01/04/2000  22:00   01/05/2000  09:00   -9     01/05/2000  09:00   01/06/2000  09:00   -9     01/06/2000  09:00   01/07/2000  09:00   -9     01/07/2000  09:00   01/08/2000  09:00   -9     01/08/2000  09:00   01/09/2000  09:00   -9     01/09/2000  09:00   01/10/2000  09:00   -9     01/10/2000  09:00   01/11/2000  09:00   -9     01/11/2000  09:00   01/11/2000  21:30   -9     01/11/2000  22:30   01/12/2000  09:00   -9     01/12/2000  09:00   01/13/2000  09:00   -9     01/15/2000  09:00   01/16/2000  09:00   -9     01/16/2000  09:00   01/17/2000  09:00   -9     01/17/2000  09:00   01/18/2000  09:00   -9     01/18/2000  09:00   01/18/2000  22:45   -9     01/18/2000  22:50   01/19/2000  09:00   0.15     01/19/2000  09:00   01/20/2000  09:00   -9     01/20/2000  09:00   01/21/2000  09:00   -9     01/21/2000  09:00   01/22/2000  09:00   -9     01/22/2000  09:00   01/23/2000  09:00   -9     01/23/2000  09:00   01/24/2000  09:00   -9     01/24/2000  09:00   01/25/2000  09:00   -9     01/25/2000  09:00   01/26/2000  00:35   -9     01/26/2000  00:35   01/26/2000  09:00   -9     01/26/2000  09:00   01/27/2000  09:00   -9      Above 01/18/2000 for instance appears twice as the "Start day", and twice as the "end day". Therefore, I want to include the lines that have `01/18/2000` as the "Start day" or "end day". I want my output from the above data be:               Start day   hour    end day        hour Value     01/10/2000  09:00   01/11/2000  09:00   -9     01/11/2000  09:00   01/11/2000  21:30   -9     01/11/2000  22:30   01/12/2000  09:00   -9     01/17/2000  09:00   01/18/2000  09:00   -9     01/18/2000  09:00   01/18/2000  22:45   -9     01/18/2000  22:50   01/19/2000  09:00   0.15     01/25/2000  09:00   01/26/2000  00:35   -9     01/26/2000  00:35   01/26/2000  09:00   -9     01/26/2000  09:00   01/27/2000  09:00   -9


record audio on Linux - capture both sides of a VoIP conversation

I want to use Audacity (or similar) to record audio for podcasting. The podcasts will be interviews conducted via voice-over-IP (SIP) telephone. I came across an excellent tutorial here: http://www.linux.com/learn/tutorials/367395-weekend-project-record-from-skype- calls-and-other-apps-on-linux It gives most of the steps I need. Most importantly, it describes how to capture both sides of the call from apps that don't support recording. "The real solution to capturing both sides of the call is to construct a virtual PulseAudio device that connects to both of them" and "Then record the null sink, capturing the merged audio in a single file." However, I want to do one thing differently. I don't want the audio of the conversation entirely "merged." I want one side of the conversation in one channel and the other side in another channel. There is actually a hardware device that does this and that's where I got the idea. The device is the JK Audio Inline Patch found here: http://www.jkaudio.com/inline-patch_dtails.htm It offers "a mini stereo output jack, caller on left channel, local voice on right channel." That's similar to what I want. I think I can do it like the tutorial describes without having to buy a $250 US hardware device. The original tutorial steps are:               pacmd info     cp /etc/pulse/default.pa ~/.pulse/default.pa      then open default.pa in your favorite editor and add something like this (based on the info from pacmd info):               # set up null sink and loopbacks to record voice calls     load-module module-null-sink sink_name=mywiretap     load-module module-loopback source=alsa_output.pci-0000_00_06.1.analog-surround-40.monitor sink=mywiretap     load-module module-loopback source=alsa_input.pci-0000_00_06.1.analog-stereo sink=mywiretap      From the tutorial: What's extra nice about this setup is that PulseAudio stores the application connection details automatically, so the next time you log in, you will not have to repeat the process of connecting the recording app to the Null Output Monitor — just fire up your audio recorder, phone your [interview subjects], and start talking... My question is, How do I capture my audio in one channel and the interview subject's audio in another channel of a stereo recording? Or how do I capture them entirely separately (if necessary) using Audacity? I fooled around with Audacity and I cannot open two windows and record two separate sources using Audacity (at least not that I could figure out). In case it is of interest my SIP client is Twinkle.


No volume control in Nexuiz fullscreen mode

While playing Nexuiz on my Ubuntu in fullscreen mode the volume control buttons on my laptop don't work at all, externally after minimizing the game increasing/decreasing the sound solves the problem but there is no in-game vol control? Also when on headphones the game music plays on the laptop speakers as well as on the headphones! What could the problem be? Is this a sound driver issue or x-org issue? its also happening with someone i know while playing Warzone2100 on Ubuntu 12.04.


invoking bash with the -t option

Can anyone tell me about the `-t` option when invoking bash? I found the following handy command to use a lightweight terminal window as an application launcher               urxvt -geometry 80x3 -name 'bashrun' -e sh -c "/bin/bash -i -t"      Through a little investigation of its behavior i see that the `-t` essentially makes bash exit after executing one command, but I am curious if there is any more to that specific `-t` option. I cant actually find any documentation about it, and I've looked through the following docs:   * `man bash`   * Invoking Bash   * standard bash options I find it odd that `-t` is not as clearly laid out as the rest of the options


Get correct number of lines in diff output

I want to get the correct number of lines in the output of diff(specifically with `-y` and `--suppress-common-lines` options). Using a simple `wc -l` does _not_ work, because if both files end without a newline and their last line is different `wc -l` wont count the last line. Is there a simple and efficient solution to avoid this? For example, if you have files "a":               a     b     c     d   #no newline here      And "b":               a     b     c     D    #no newline here      The output is:               $ diff -y --suppress-common-lines a b | wc -l     0      Which is obviously incorrect since `diff` _does_ output a line.


Restoring Windows XP from grub

Previously I had a dual boot with Windows XP and Fedora. I have deleted Fedora and extended the C drive using Mini Tool Partition Wizard. Then I restarted the system with the Windows XP bootable CD. The CD is not detected and the following is displayed:               GNU GRUB version 0.97 (637K lower/513920K upper memory)     [Minimal BASH-like line editing is supported.For the first word,     TAB lists possible command completions.Anywhere else      TAB lists the possible completions of a device/filename]          grub>      Please help me to restore Windows XP.


Is there any way to use chown/chgrp without modifying the last modified date?

As the title says, I'm recovering files from an old hard drive and I need to keep the last modified date from the drive. The reason they are updating is because I need to change the ownership of the files to a new user.


Directory special permission problem

When I write: chmod g=rws,u=rwx,o=rx folder_name I get: drwxrwSr-x But S is not the same as s, right?


I'm trying to count and print song file names using awk as following

RANK  NAME                    BAND  YEAR   GENERE  DOMESTIC/INTERNATIONAL        206:Reach Out, I'll Be There:The Four Tops:1978:Pop:3/2              207:Bye Bye Love:The Everly Brothers:1950:Classic:3/2          208:Gloria:Them:1965:Classic:1/1           209:In My Room:The Beach Boys:1985:Classic:5/7       210:96 Tears:? & the Mysterians:1964:Classic:20/15          211:Caroline, No:The Beach Boys:1975:Classic:5/7        212:1999:Prince:1958:Classic:5/7            213:Your Cheatin' Heart:Hank Williams:1988:Soul:7/6       (1) I tried to print a list of Rank, performers and songs with new header so I tried:               nawk  'BEGIN { FS=":"      printf "%-10s %-35s %-55s\n", "RANK", "PERFORMER","SONG"     print "=====================================================================\n"}     {printf "%-10s %-35s %-55s\n", $1, $3, $2}' songs      but the output still have the default header under the line so how i remove the first line under the new header? (2)I need to count the number of songs from each type of Genre and report totals of each genre Desired output is example:               classic 10     R&B 5     Soul 9 etc..      I tried but failed to get the desired output:               awk '{count+$5} END {print $5}' songs


Live Linux distribution with preinstalled NVIDIA CUDA support

Is there any Linux distribution with preinstalled NVIDIA CUDA support that could be launched from a live CD/USB drive?


Imagemagick resize

I am familiar with `convert -resize %` for decreasing a size by percentage but what is the command to increase an image from say 700 pixels to 800 pixels? Horizontal width should resize, too. I need to preserve the overall quality and look of the image as best as possible. EDIT:               mogrify -resize geometry      that appears to be what I need to resize the images. Link to article for the next person trying to figure out how to resize.


Is the crazy partition layout in Fedora 15 really nessesary?

As I'm installing Fedora 15 on another computer I'm really starting to question the crazy partition layout. On this computer there's an existing Windows 7 installation, so I'm cramming Fedora right next to it in a small 15 GB slice of space (don't plan on storing much data there) But the installer generates this crazy partition layout   * Windows 7 stuff   * Extended Partition      * /boot (EXT4, 500 MB)     * LVM(!) Volume Group (14858 MB)     * lv_root (8660 MB)     * lv_swap (5888 MB)     * My home (Whats left: 310(!?!) MB) That doesn't seem like much space. Even on my other system which has a whole 80 GB hard drive to itself the LVM gives the root filesystem and the root folder 50 GB and me a measly 20 GB. I sometimes run out of space when Virtualbox gets a lot of snapshots or bittorrent gets out of control. Is there anything wrong with a simple layout like this?   * Windows 7 stuff   * Extended Partition (15 GB)      * Swap (5 GB)     * Root filesystem (10 GB) _Note: The sizes can increase if absolutely necessary_. Note the lack of LVM and separate partitions for everything. Will anything break with this layout? Are there any large disadvantages with this layout?


Command to trace rsh server to check behaviour of particular system call

I am working with rsh. I want to check the whole process from beginning to end. For that I used strace. Os name is CentOS. I am working on single machine, server and client are on same machine. My command is , `rsh localhost ulimit -n` To take a trace, I used `strace rsh localhost ulimit -n`. I read all the files that is open during executing above command. But I want to trace how the rsh server sets the limit of `ulimit -n`, because all commands in rsh run by rsh daemon. The system call I am looking for is, `setrlimit`, but it didn't show this system call by using `strace rsh localhost ulimit -n`. For that I have to trace rsh server , i.e, rsh daemon. But I don't know, how I perform this task. Please tell me the command and their explanations also. **I know rsh is not used in current scenario, but my project is using that, so please don't tell , rsh is not good. I know all these stuffs.** **Edit No. 1** **[service@jhamb xinetd.d]$ sudo lsof -i :514**               COMMAND  PID USER    FD   TYPE DEVICE SIZE  NODE  NAME     syslogd 2210 root    9u  IPv4   6259       UDP *:syslog     xinetd  2658 root    8u  IPv4   8745       TCP *:shell (LISTEN)      and, /etc/xinetd.d, does not contain rshd, it contains rsh, rexec, rlogin, rsync, etc. **Edit no 2** [related to comment by Chris Down] **rsh localhost strace -o log_new bash -c 'ulimit -n'** It gives different answer that it gives when I run `strace rsh localhost ulimit -n`               execve("/bin/bash", ["bash", "-c", "ulimit", "-n"], [/* 15 vars */]) = 0     brk(0)                                  = 0x13e86000     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2af7bbab2000     uname({sys="Linux", node="jhamb.XXX.XXX", ...}) = 0     access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)     open("/etc/ld.so.cache", O_RDONLY)      = 3     fstat(3, {st_mode=S_IFREG|0644, st_size=57641, ...}) = 0     mmap(NULL, 57641, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2af7bbab3000     close(3)                                = 0     open("/lib64/libtermcap.so.2", O_RDONLY) = 3     read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\17\300T4\0\0\0"..., 832) = 832     fstat(3, {st_mode=S_IFREG|0755, st_size=15584, ...}) = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2af7bbac2000     mmap(0x3454c00000, 2108688, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3454c00000     mprotect(0x3454c03000, 2093056, PROT_NONE) = 0     mmap(0x3454e02000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x3454e02000     close(3)                                = 0     open("/lib64/libdl.so.2", O_RDONLY)     = 3     read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\16@T4\0\0\0"..., 832) = 832     fstat(3, {st_mode=S_IFREG|0755, st_size=23360, ...}) = 0     mmap(0x3454400000, 2109696, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3454400000     mprotect(0x3454402000, 2097152, PROT_NONE) = 0     mmap(0x3454602000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x3454602000     close(3)                                = 0     open("/lib64/libc.so.6", O_RDONLY)      = 3     read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\332\1T4\0\0\0"..., 832) = 832     fstat(3, {st_mode=S_IFREG|0755, st_size=1726320, ...}) = 0     mmap(0x3454000000, 3506520, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3454000000     mprotect(0x345414f000, 2097152, PROT_NONE) = 0     mmap(0x345434f000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14f000) = 0x345434f000     mmap(0x3454354000, 16728, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3454354000     close(3)                                = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2af7bbac3000     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2af7bbac4000     arch_prctl(ARCH_SET_FS, 0x2af7bbac3dd0) = 0     mprotect(0x3454602000, 4096, PROT_READ) = 0     mprotect(0x345434f000, 16384, PROT_READ) = 0     mprotect(0x3453e1c000, 4096, PROT_READ) = 0     munmap(0x2af7bbab3000, 57641)           = 0     rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0     open("/dev/tty", O_RDWR|O_NONBLOCK)     = -1 ENXIO (No such device or address)     ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffb504cb00) = -1 EINVAL (Invalid argument)     brk(0)                                  = 0x13e86000     brk(0x13ea7000)                         = 0x13ea7000     getuid()                                = 500     getgid()                                = 500     geteuid()                               = 500     getegid()                               = 500     rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0     open("/proc/meminfo", O_RDONLY)         = 3     fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2af7bbab3000     read(3, "MemTotal:      3920228 kB\nMemFre"..., 4096) = 777     close(3)                                = 0     munmap(0x2af7bbab3000, 4096)            = 0     rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER, 0x3454030330}, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER, 0x3454030330}, {SIG_DFL, [], SA_RESTORER, 0x3454030330}, 8) = 0     rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x3454030330}, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x3454030330}, {SIG_DFL, [], SA_RESTORER, 0x3454030330}, 8) = 0     rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x3454030330}, {SIG_DFL, [], 0}, 8) = 0     rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x3454030330}, {SIG_DFL, [], SA_RESTORER, 0x3454030330}, 8) = 0     rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0     rt_sigaction(SIGQUIT, {0x1, [], SA_RESTORER, 0x3454030330}, {SIG_DFL, [], SA_RESTORER, 0x3454030330}, 8) = 0     uname({sys="Linux", node="jhamb.XXX.XXX", ...}) = 0     stat("/home/service", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0     stat(".", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0     getpid()                                = 30873     getppid()                               = 30829     stat(".", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0     stat("/home/service/bin/bash", 0x7fffb504cab0) = -1 ENOENT (No such file or directory)     stat("/usr/local/sbin/bash", 0x7fffb504cab0) = -1 ENOENT (No such file or directory)     stat("/usr/local/bin/bash", 0x7fffb504cab0) = -1 ENOENT (No such file or directory)     stat("/usr/sbin/bash", 0x7fffb504cab0)  = -1 ENOENT (No such file or directory)     stat("/sbin/bash", 0x7fffb504cab0)      = -1 ENOENT (No such file or directory)     stat("/usr/kerberos/bin/bash", 0x7fffb504cab0) = -1 ENOENT (No such file or directory)     stat("/usr/bin/bash", 0x7fffb504cab0)   = -1 ENOENT (No such file or directory)     stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=801512, ...}) = 0     access("/bin/bash", X_OK)               = 0     access("/bin/bash", R_OK)               = 0     stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=801512, ...}) = 0     access("/bin/bash", X_OK)               = 0     access("/bin/bash", R_OK)               = 0     getpgrp()                               = 30829     rt_sigaction(SIGCHLD, {0x436080, [], SA_RESTORER, 0x3454030330}, {SIG_DFL, [], SA_RESTORER, 0x3454030330}, 8) = 0     rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0     getpeername(0, {sa_family=AF_INET, sin_port=htons(61000), sin_addr=inet_addr("127.0.0.1")}, [5255137823777882128]) = 0     rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0     rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0     getrlimit(RLIMIT_FSIZE, {rlim_cur=RLIM_INFINITY, rlim_max=RLIM_INFINITY}) = 0     fstat(1, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2af7bbab3000     write(1, "unlimited\n", 10)             = 10     exit_group(0)                           = ?      **Edit No.3** **[root@jhamb rsh_trace]# grep -e ulimit -e setrlimit rsh.strace.***               rsh.strace.31472:14:22:42.966361 setrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=1024}) = 0     rsh.strace.31474:14:22:43.085822 execve("/bin/bash", ["bash", "-c", "ulimit -n"], [/* 4 vars */]) = 0     rsh.strace.31474:14:22:43.546754 setrlimit(RLIMIT_CORE, {rlim_cur=RLIM_INFINITY, rlim_max=RLIM_INFINITY}) = 0      **Edit No. 4: /etc/security/limits.conf with comments removed**               *                soft    core            unlimited     *                hard    core            unlimited     @service          hard    nofile          13000     @service          soft    nofile          13000     *                soft    nofile          12000     *                hard    nofile          12000


MTS MBlaze 3G USB Dongle in Mint 14 Cinnamon

I recently installed Linux Mint 14 Cinnamon 64-bit along with Windows 7. I have a MTS Mblaze 3G USB dongle. This dongle has 2 modes i.e., 1X mode which gives less speed up--to 30 kbp/s and a broadband mode which gives more speed-- up to or greater than 500 kbp/s. In Win 7, this dongle works fine in broadband mode. For using the 3g USB dongle I followed steps from this page: http://telecomtalk.info/step-by-step-guide-configuring-usb-modem- ubuntu/101849/ It's good that Mint has inbuilt support for MTS dongles. But I am facing a problem as I cannot use my dongle in broadband mode in Mint. I have to start Windows, change the dongle mode to 1X mode and then start Mint. Then it connects to internet with 1X mode only giving less speed. How can I connect the dongle in Broadband mode in Mint? I also tried using `wvdial` but it gives an error as `/dev/modem` not found.


How do I compile wxWidgets with the same options as the package as the repository?

I am compiling wxWidgets as a pre-step to compiling the newest version of pgAdmin3 since there isn't a deb version in the repository that supports version postgres 9.2. I am having troubles and eliminating possibilities. The default package has a version of wxWidgets that works with pgAdmin3. I want to install the same options of this package. When I type:               ./configure --help      I get a whole host of options. How do I find out the options used to compile the default package version so I can match its functionality. I have tried to use:               --enable-debug --enable-button --enable-ect.      but after 10 or so options I worry that I will miss something (and according to the output of the other compile I am) or I will add something that is conflicting. Is there a list of options that the repository is using for wxWidgets. Using Mint Nadia 14/Ubuntu 12.10.


How do I limit the number of getty processes started?

I've got a FreeBSD (9.2) box that I'm trying to strip down as lightweight as possible. It's running on a VM server, so other than ttyv0, we don't ever use the console. I'd like (if possible and reasonable) to not start the extra getty processes that run ttyv1 through ttyv7. How do I accomplish that in a FreeBSD supported manner?


Is rpm the only file extension for repositories

I've noticed that repositories in CentOS have the .rpm extension.   * Are there other extensions?    * Is .rpm specific to the operating system? i.e. do other linux operating systems have other extensions?


Figuring out physical cache layout in FreeBSD

I'm trying to figure out they physical cache layout of my CPU in FreeBSD 10. I see the following from               sysctl kern.sched.topology_spec          kern.sched.topology_spec: <groups>      <group level="1" cache-level="0">       <cpu count="4" mask="f">0, 1, 2, 3</cpu>       <children>        <group level="2" cache-level="2">         <cpu count="4" mask="f">0, 1, 2, 3</cpu>        </group>       </children>      </group>     </groups>      However, I know that this doesn't match the datasheet for my CPU and dmidecode shows that it is unified L2 as well. Is there anywhere else that might be worth looking? Or, if the datasheet is incorrect, how could I verify this? This is for an Intel® Xeon® Processor E5320. From third party websites, this processor should have 2MB per core of L2 cache which is not what is being reported.


List installed, top-level packages in Fedora

I used to use yum to list all installed packages:               yum list installed      Now I need to list top level packages only i.e. if a package is a dependency of another, it should not be shown. GNOME's _Add/Remove Software_ can do this but I need the output in a terminal. I checked yum manual but I could not find a switch for that.


bash set env variable is not working in pdsh

I am using PDSH to control multiple servers through one command line. The command below works fine on individual servers, but when I enter the export command within PDSH, echoing it back is empty. Any ideas on why this is, or how to fix it? **Specific example:** This works just fine:               # export CRAWL_DATE=$(date +%Y%m%d);     # echo $CRAWL_DATE     20131206      but in PDSH, it echos blank values:               pdsh> export CRAWL_DATE=$(date +%Y%m%d);     pdsh> echo $CRAWL_DATE;     <IP 1>:      <IP 2>:


Divorced input line in GNU Screen

Is it possible to divorce my input from the overall shell using Screen? What I'm aiming for is akin to a status line that expands if I type more than would fit within a single line and is 'submitted'/'sent' to the shell when I press enter. I'm looking to put together a simple configuration to use as a MUSH/MUD/MUCK/MOO client using screen+telnet. The current issue with using telnet is that data sent from the remote server is inserted at the cursor position, which sucks badly if you're typing a lengthy paragraph.


Is it possible to cancel a job in the printer spooler with cancel -a

I need to cancel a printing job in a printer cause the job I want to send is a "high priority" job. I have CentOS 6.2 installed. I know that with CUPS and `cancel -a` I can cancel all local printer jobs BUT :   1. Does the spooler cancelling is limited to the local spooler (the computer) or can I cancel all jobs even those coming from other computers?   2. Does it do the same if the printer is linked by usb or by the network?


Add 'install selected .deb files' as command in Nautilus actions

Running `sudo dpkg -i *.deb` in a terminal opened in '/folder', installs all debs in the location '/folder'. What command to add in `nautilus-actions` (Nautilus-Actions Configuration Tool) so that **only selected** deb files are installed? * * * For example, I looked for a script to run a command in a terminal and according to this model I have created this script:               #!/usr/bin/expect -f          # Get a Bash shell     spawn -noecho bash          # Wait for a prompt     expect "$ "          # Type something     send "sudo dpkg -i"          # Hand over control to the user     interact          exit      To run that script I have created an action with Nautilus-Actions Configuration Tool and tried to make settings to make it open within a selected location and for the selected deb files. The first part works, based on a command like: `gnome-terminal -e "/path/to/the/script" --working- directory=%f` But the terminal just contains that command to install all debs from that folder, without considering the selection o files (in the context menu of which I can make the command appear: but it will affect all files, not just those selected).


Navigation Motion to Skip Comments

To edit configuration files, I'm using Vim. In order to move the cursor upwards or downwards to other configuration entries, I'm using `Ctrl`+`d` or `Ctrl`+`u`, respectively. Large blocks of commented lines with few configuration lines messes it all up, and I often oversee non-commented lines. Is there a a kind of motion to move the cursor down to the next non-commented line without using hard to type regular expressions?


How to stop monthly cron output email

Server is Debian 6.0. In /etc/aliases I have;               root: me@mydomain.com      This is so that root emails get sent directly to me. Today, a monthly script I have placed into /etc/cron.monthly has emailed me it's output. It a fairly simply script which looks like this;               #!/bin/bash     cd /a/directory     rm -rf ./*     wget http://www.site.com/fresh-copy.zip     unzip fresh-copy.zip     rm fresh-copy.zip      The email I have received is below;               **Subject**: Cron <root@myserver> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )     **From**: root@my.server.com     **Body**:              /etc/cron.monthly/speedtest:     --2013-03-01 06:52:01--  http://www.site.com/fresh-copy.zip     Resolving www.site.com... 11.22.33.44     Connecting to www.site.com|11.22.33.44|:80... connected.     HTTP request sent, awaiting response... 200 OK     Length: 99763924 (95M) [application/zip]     Saving to: `fresh-copy.zip'               0K .......... .......... .......... .......... ..........  0% 11.7M 8s         50K .......... .......... .......... .......... ..........  0% 11.3M 8s        100K .......... .......... .......... .......... ..........  0% 11.4M 8s             *CUT OUT FOR BREVITY*      97350K .......... .......... .......... .......... .......... 99% 16.9M 0s      97400K .......... .......... .....                           100% 11.6M=9.7s          2013-03-01 06:52:11 (9.78 MB/s) - `fresh-copy.zip' saved [99763924/99763924]          Archive:  fresh-copy.zip       inflating: file1.ext       inflating: file2.ext       inflating: file3.ext       inflating: file4.ext       inflating: file5.ext      The only output in this email is from the `wget` and `unzip` command. I can edit the script and place `> /dev/null` on the end on those two lines, but is that really the best way to do this? If I add more commands to the script that produce output, I will always have to add on `> /dev/null` to each line. Is there a way I can disable email notification of output from this cron script?


Split files and rename the files

I need to split a large file into 5 pieces and rename them. For Example, file **Test** needs to be split into _Test1_ , _Test2_ & _Test3_. However, the split command splits as _xaa_ , _xab_ , _xbc_.


grep: Ignoring GREP_OPTIONS to search case-sensitive

I have set `GREP_OPTIONS="--ignore-case --color"` in `~/.bashrc` as I normally want grep to work case-insensitive. However, there are times when I need grep to actually search case-sensitive, but the man page doesn´t suggest a param for this. How can I achieve this?


How to configure GRUB to load Windows 7 Install in UEFI mode

I have a Dual-Boot USB I created with Multisystem for booting into PartedMagic, Ubuntu 11.10 & Windows 7 Install. Problem is Windows 7 says it cant install on a GPT partition. Googled, and found that I need an UEFI system (on ASUS H67M-PRO, supports UEFI BIOS, so this shouln't be the problem). I also need to have the correct efi files. I find efi files in my USB, so I think thats fine. But I think the files might not be loaded or something? So I am thinking, do I need to do something special to boot into the UEFI installer for Windows 7 or something? For that I need to configure the GRUB on the USB? How?


How does SSH connection survive a network restart?

From a Linux SSH shell, type `/etc/init.d/network restart` to restart the network service. I expect my SSH connection to die since the network service goes down. But it doesn't. Very cool. But how does Linux achieve this? How does it keep my SSH connection alive accross the service restart?


Remove all lines in file A which contain the strings in file B

I have a CSV file `users.csv` with a list of userNames, userIDs, and other data:               username, userid, sidebar_side, sidebar_colour     "John Lennon", 90123412, "left", "blue"     "Paul McCartny", 30923833, "left", "black"     "Ringo Starr", 77392318, "right", "blue"     "George Harrison", 72349482, "left", "green"      In another file `toremove.txt` I have a list of userIDs:               30923833     77392318      Is there a clever, efficient way to remove all the rows from the `users.csv` file which contain the IDs in `toremove.txt`? I have written a simple Python app to parse the two files and write to a new file only those lines that are not found in `toremove.txt`, but it is extraordinarily slow. Perhaps some `sed` or `awk` magic can help here? This is the desired result, considering the examples above:               username, userid, sidebar_side, sidebar_colour     "John Lennon", 90123412, "left", "blue"     "George Harrison", 72349482, "left", "green"


Use xdg-open to open a url with a new process

I'm starting to experiment with Crunchbang (which is based on Debian, and uses terminator) as a web development environment, and one of the things I am struggling with is the behaviour of `xdg-open`. I come from an OSX background, so forgive me if this question comes off as dense. I would like to be able to open a url with `xdg-open http://www.google.com` and then continue to use the same terminal window to work (it's how `open` functions in OSX). Right now, using `xdg-open` occupies the current tab/session until I close browser window, or manually end things with `ctrl + c`. I'd much prefer it start a new process, that way I can open up a URL, refer to data on the page, and use it in the same tab/window without needing to open an additional one.


Output the result of DF command to variable then print to an HTML page

I am having a problem executing a script that basically captures the disk space from the server and outputs the result to an HTML page.               STORAGE=$(df -PTh | column -t | sort -n -k6n)      The output in STDOUT is OK, it is well formatted. When I echo the variable to an HTML page, the output becomes one line, just like this one:               /dev/vx/dsk/localdg/wm7x01 vxfs 30G 21G 9.3G 70% /apps/wm7x01 /dev/mapper/vg00-vrts ext3 6.9G 4.7G 2.3G 68% /vrts_install /dev/mapper/vg00-ora11g_cli ext3 7.7G 4.1G 3.3G 57% /usr/oracle11g_cli /dev/mapper/vg00-repackage ext3 1008M 423M 586M 42% /var/spool/repackage /dev/vx/dsk/cfs_dcgnts_dg/shared vxfs 220G 91G 130G 42% /apps/shared      I even tried using:   * quotations: `echo "$STORAGE"`   * an array: `echo "{STORAGE[@]}"` Unfortunately, all yields the same result.


How can I see dumps of wholе HTTP packets?

I need to see whole HTTP packets sent and recieved by an application for debugging purposes. How can this be done in command-line?


Mysql Cluster Data node not started

I am working on Mysql Cluster in Fedora. I have three Fedora virtual machine. One is Management node and other two are Data node. My Management node started but my Data nodes are not started. When execute the command in Data node, I got errors                ndbd --initial          -bash : ndbd command not found      If I start the data node like this means i got some errors,                /usr/local/mysql/bin/ndbd --initial      unable to connect with connect string: nodeid=0,192.168.1.7:1186


After update, Synaptics touchpad gives lethargic pointer

My laptop is running KDE on a Debian a testing/unstable mix. I recently did an upgrade, which pulled in a new xorg version (xserver-xorg-core:amd64 2:1.15.1-1 → 2:1.15.99.904-1), including all the submodules such as xserver- xorg-input-synaptics:amd64 1.7.3-1+b1 → 1.8.0-1. There were a bunch of other things too. After reboot, the trackpad moves the pointer ridiculously slowly. As in move my finger across it quickly over a dozen times to get across the screen. Yet, moving my finger slowly shows it clearly still has acceleration, just nowhere near enough. First, of course, I tried the KDE Touchpad settings. I upped the maximum speed as far as it goes, and the same with the acceleration. That got it down to 5–6 times across quickly to get across the screen—still far too slow. Second, I tried speeding it up with `xset m`, changing the settings from 30/10 threshold 4 to even insane values like 100/2 didn't have any effect. Attempting to use `synclient` let me set the MaxSpeed to 255, but that hasn't done anything. It wouldn't let me push the AccelFactor above 1 (same as the KDE settings pannel). I downgraded the entire X stack to install synaptics 1.7 again (1.8 changed ABI). That works. The difference is immediately apparent: on the kdm login screen, it takes 1–2 swipes across the pad to go across the screen with 1.7; it takes 26 (yes, I counted) with 1.8. I logged into a failsafe session in both 1.7 and 1.8; the output of `xset q` is identical; the output of `xinput list-props` on the trackpad device is almost the same (the property numbers are different, 1.8 adds a new circular pad setting, value 0; 1.7 has grab event device set to 1, instead of 0 in 1.8). The xorg logs similarly don't seem to show much. I've put an tarball of them all on Dropbox if you wish to review them. Is there some config setting I'm missing? Seems like X acceleration is just broken here, leading to unacceptably slow pointers.


How to prevent killing the X server with CTRL+C using bash traps?

On my Debian Wheezy system, I used to start my X session with the startx command. My .xinitrc file is:               exec /usr/bin/awesome --config /home/cscs/.config/awesome/rc.lua >> ~/.cache/awesome/stdout 2 >> ~/.cache/awesome/stderr      Is there an other way to implement this using `trap "" INT` somewhere? I had no success catching the CTRL+C sequence, my X server exited with the message: `unexpected signal 2`. Login managers (slim, gdm, kdm, etc.) are not applicable.


mouse in gnome-terminal

how to set up mouse in terminal window? when i click on midnight commander captions i get raw data from mouse printed as characters in terminal and any running progs don't understand mouses clicks. I didn't have a gpm package, so i'decided               $ps aux |grep -i gpm     user    3607  0.0  0.0 103244   912 pts/0    S+   16:45   0:00 grep -i gpm      and i did yum install gpm then               ps aux| grep gpm     root      3898  0.0  0.0   6732   568 ?        Ss   16:56   0:00      /usr/sbin/gpm -m /dev/input/mice -t exps2     user    3906  0.0  0.0 103244   888 pts/1    S+   16:56   0:00 grep gpm      then i start mc and do try click... all is the same i see responses in command-line as "M P!M#P!M F!M#F! " like sequences note i have other Linux where no gpm installed and all rocks fine..:doh:


Change PulseAudio Input/Output from Shell?

I have a set of nice wireless headphones which I use from time to time, in addition to my speakers and normal microphone. I'd like to write a script to switch between one input and output source and another, essentially a switch between my headphones and my speakers+microphone. I'd like to change between this: ![](http://i.imgur.com/uvLDa2q.png) ![](http://i.imgur.com/aBqR0dk.png) ...and this: ![](http://i.imgur.com/vtQM3Lu.png) ![](http://i.imgur.com/QFdRCT2.png) Is there a way for me script a transfer between the two inputs and outputs? Essentially I'm looking for something like this:               CURRENT_INPUT="$(get-current-input-name)"     CURRENT_OUTPUT="$(get-current-output-name)"          if [ "$CURRENT_INPUT" == "Vengeance 2000" ]; then         set-current-input "HD Pro Webcam C920"     else          set-current-input "Vengeance 2000"     fi          if ["$CURRENT_OUTPUT" == "Vengeance 2000" ]; then         set-current-output "Built-in Audio"     else         set-current-output "Vengeance 2000"     fi      Is there a way to script this?


Merging folders with mv?

If I move a folder with mv called "folder" to a directory that already contains "folder" will they merge or will it be replaced?


Where to find default bindings for special keys

My keyboard has special keys, like for sound muting or launching the web browser. With my stock Xfce 4.10 installation on Debian testing (Jessie) these keys are automatically mapped, so I didn't needed to configure them manually. However, I would like to change some of these bindings to custom commands. I might do so via the keyboard settings in Xfce, but I would rather change it the "official" way. Any ideas how to achieve this?


Customize wingpanel under Elemantry OS

Recently I have installed Elemantry OS luna, which is based on Ubuntu. I want to customize the wingpanel to display the menu toolbar of the selected application. This is my wingpanel: ![what I got](http://i.stack.imgur.com/qkfdw.jpg) But I want it to look like this: ![what I Want](http://i.stack.imgur.com/NZGEd.png) The File, Edit, Selection and other menus, and the Close, maximize and minimize icons are on the wingpanel.


Run program with additional supplementary group

I am looking for something like sudo (or something that can be run from sudo) that allows me to run a program with my uid and primary gid, but with an additional supplementary group.


emacs - paste text from clipboard without formatting

I am using Emacs 24 for MacOSX and having some problem with pasting code from clipboard to Emacs. The code that I selected usually already nicely formatted (with tab, ident, ...). However, when I paste it to Emacs, Emacs re-do the formatting so it is extremely slow for thousands lines of code. Is there any suggestion for pasting from clipboard? Thank you.


Update Sublime Text 2 in Mint 10 Linux

Sublime Text 2 won't let me use it unless I upgrade. Is there an easy way to do this? I'm new to Linux and all they have is the `tar.bz2` file. But I know you can update programs with `apt-get` sometimes. Does anyone know the easiest way to upgrade?


DNS Master vs Slave and Primary vs Secondary

I'm a little confused about the difference between a "secondary name server" and a "slave name server" and a "primary name server" and a "master name server" I understand that a slave name server queries the master and updates itself based on changes to the master. What I'm not sure of is, say I'm setting up 2 name servers:               ns1.example.com     ns2.example.com      Should both of these be setup as "primary and master" and then any secondary name servers be setup as slaves? Or should there only be ONE primary master at any given time, and all other name servers should be slaves? I've read a few guides and lots of man pages, but I haven't come across this issue yet in my reading. Anyone have a pointer to a reference for this type of thing? Or know what the best practice is for setting up multiple DNS servers?


avconv with negative audio quality value

Is it possible to set the `-q:a` parameter to a negative value? For example, the value of `-1` is a valid quality level for the Vorbis codec.


How to disable DNS caching or override TTL for a certain hostname?

I've set up my own dynamic DNS service by using a script to automatically update the A record for a subdomain of one of my domains.   The host with the dynamic IP address runs, among other things, a Munin node which I'm reading remotely at five-minute intervals.   Unfortunately, my domain name registrar doesn't allow TTL values less than 3600, so the IP for the remote Munin node is cached for an hour and the connections fail for up to said hour whenever the node's dynamic IP changes. Is there a way to override the TTL reported by my registrar's DNS server, so the server will re-resolve the IP each time it connects to the Munin node?


processing command output line by line, without mixing standard input

So, I have a problem very similar to Bash: How to read one line at a time from output of a command?, I am doing:               while read path; do mplayer $path; done < <(find-me-random-mp3s)      or               find-me-random-mp3s | while read path; do mplayer $path; done      The command `find-me-random-mp3s` outputs file paths each on a new line. The problem starts when `mplayer` runs, it starts consuming lines from `find-me- random-mp3s` output, i.e. lines that were supposed to be filled inside the `path` variable on each iteration. I went on with this dirty fix:               find-me-random-mp3s | while read path; do cat /dev/null | mplayer $path; done      But I don't really like it, it blocks my terminal interaction with mplayer too. Is there any alternative method that I can use in such case?


How to increase the timer before drive spins-down?

I use Ubuntu 12 beta on a Lenovo Z575. I noticed that the disk spins down a few seconds after the last operation. When I am working, e.g. in the vim and write quite often, it spins-up and -down frequently. This causes vim to freeze for a second. I used `hdparm` but it didn't change anything:               hdparm -S 24 /dev/sda # 2 minutes standby time      and I see (and hear) that the disk is idle or working:               hdparm -C /dev/sda     drive state is: standby     # or...     drive state is: active/idle      I have `laptop-mode-tools` already installed.


kexec from within initramfs

Can `kexec` be used from within `initramfs` to load up a new image and kernel? It seems that `kexec` calls `shutdown` which then looks for `/dev/initctl`, which is missing from a `busybox` `initramfs` image. Any guidance would be appreciated!


How to make titlebars in XFCE bigger?

No matter how big font I set for titlebar, the height of the titlebar is not changed at all. I don't see any editbox where I could enter the desired height of titlebar. So far, I only found workaround, that you should edit window's button (close, maximize, and so on) from current theme. However this is tiresome, because if you decide, that the new height is not OK, and it should be 1 px bigger, you have to rescale the buttons (whole set) again. I am looking for something theme independent, and straightforward.


Installing virtualbox on Debian: dependency problems

I'm currently running Debian Wheezy (Testing). I want to install `virtualbox` but when I run the following:               # aptitude install virtualbox      ...I get the following result:               The following packages have unmet dependencies:      libqt4-qt3support : Depends: libqtcore4 (= 4:4.8.2+dfsg-2) but 4:4.8.2+dfsg-6 is to be installed.                          Depends: libqtgui4 (= 4:4.8.2+dfsg-2) but 4:4.8.2+dfsg-6 is to be installed.      qdbus : Depends: libqtcore4 (= 4:4.8.2+dfsg-2) but 4:4.8.2+dfsg-6 is to be installed.      libqt4-script : Depends: libqtcore4 (= 4:4.8.2+dfsg-2) but 4:4.8.2+dfsg-6 is to be installed.      libqt4-designer : Depends: libqtcore4 (= 4:4.8.2+dfsg-2) but 4:4.8.2+dfsg-6 is to be installed.                        Depends: libqtgui4 (= 4:4.8.2+dfsg-2) but 4:4.8.2+dfsg-6 is to be installed.      libqt4-network : Depends: libqtcore4 (= 4:4.8.2+dfsg-2) but 4:4.8.2+dfsg-6 is to be installed.      libqt4-dbus : Depends: libqtcore4 (= 4:4.8.2+dfsg-2) but 4:4.8.2+dfsg-6 is to be installed.      qt4-qtconfig : Depends: libqtcore4 (= 4:4.8.2+dfsg-2) but 4:4.8.2+dfsg-6 is to be installed.                     Depends: libqtgui4 (= 4:4.8.2+dfsg-2) but 4:4.8.2+dfsg-6 is to be installed.      libqt4-sql : Depends: libqtcore4 (= 4:4.8.2+dfsg-2) but 4:4.8.2+dfsg-6 is to be installed.      libqt4-xml : Depends: libqtcore4 (= 4:4.8.2+dfsg-2) but 4:4.8.2+dfsg-6 is to be installed.      libqt4-sql-mysql : Depends: libqtcore4 (= 4:4.8.2+dfsg-2) but 4:4.8.2+dfsg-6 is to be installed.      Aptitude then gives me a list of solutions, none of which seem very appealing. It seems to want to install packages from unstable rather than testing, but I don't really want to do this. **Why is this a problem if the packages have the correct version numbers?** This is the contents of my `/etc/apt/source.list`:               deb http://debian.man.ac.uk/debian/ wheezy main non-free contrib     deb-src http://debian.man.ac.uk/debian/ wheezy main non-free contrib          deb http://security.debian.org/ wheezy/updates main contrib non-free     deb-src http://security.debian.org/ wheezy/updates main contrib non-free          deb http://debian.man.ac.uk/debian/ wheezy-updates main contrib non-free     deb-src http://debian.man.ac.uk/debian/ wheezy-updates main contrib non-free          # The following line is required for iceweasel in wheezy     deb http://debian.man.ac.uk/debian experimental main          # The following line is required for icedove in wheezy     deb http://debian.man.ac.uk/debian unstable main


Custom directory for cron commands

I'm using `vixie` cron on Debian/Ubuntu. How to set a custom directory to be read by cron? I want to lead crontab to run commands found in a series of files, e.g.               /home/cron/*.cron      or perfectly               /home/*/cron/*.*      In fact, instead of putting cron commands in `/var/spool/cron/crontab/root`, I want to spread commands in these folder. Is it possible and recommended to use `include` for calling other files within `root` file?


Delete all but largest file of specific type

I am trying to organise the album art in my music collection so that only one image is assigned to each folder. My directory structure currently looks like:               /path/to/music/Album Name/     /path/to/music/Album Name/1 - Track one.flac     ...     /path/to/music/Album Name/cover.jpg (either this)     /path/to/music/Album Name/folder.jpg (or this)     /path/to/music/Album Name/Album Name.jpg (or this is the largest file)     /path/to/music/Album Name/AlbumArtSmall.jpg        (plus other low resolution images generated by Windows media player) I would like to scan through each folder and delete all but the largest jpg and rename it to `cover.jpg`. As the tags indicate, I have cygwin installed, but can also boot into Ubuntu where I have access to bash and zsh, if this makes the problem easier.


Is there some kind kind of hosts.additional file for Linux

If you have a list of servers all linking to each other by static addresses, is there some kind of hosts.additional you can use as some kind of file based DNS? ie The hosts file contains static information and the hosts.additional contains the address which change regularly.


Urxvt draws lines slowly

I'm using Arch Linux and Urxvt as terminal emulator. When I scroll up/down, text lines gets rendered so slow I can count by top to bottom ( _heh, 1st line get rendered... ohh, 2nd one! ..._ ). It takes like a full second to get new content rendered in terminal. The worst is reading man pages, looking at Git's log etc.. I have no conf for Urxvt, so it can't me misconfed. The strangest thing is that on both other computers that are also running Arch Linux and Urxvt with almost the same conf everything works. Also, it can't be performance problems — hardware is quite new. Any clue why's that? I even don't know where to start searching for problem!


What is symlinking and how can learn I how to to do this?

From the Django-Documentation: > The django-admin.py script should be on your system path if you installed > Django via its setup.py utility. If it’s not on your path, you can find it > in site-packages/django/bin within your Python installation. Consider > symlinking it from some place on your path, such as /usr/local/bin.' How do I 'symlink' and how do I know when I need to do it? OS Ubuntu 12.10 32 bit OEM2 GB RAM


Puppet. Firewall module syntax

What mean "->" in puppetlabs examples on this page ![enter image description here](http://i.stack.imgur.com/PLvWW.png)


How do I access the Lubuntu menu in Openbox?

Is there a way to include the Lubuntu applications menu in an Openbox menu (`~/.config/openbox/menu.xml`) so I can use it within a pure Openbox session?


Unable to install ia32-libs in Debian Wheezy

I was trying to install ia32-libs in Debian Wheezy. I got the error               The following packages have unmet dependencies:      ia32-libs : Depends: ia32-libs-i386 but it is not installable     E: Unable to correct problems, you have held broken packages.      I am using               # uname -a     Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2 x86_64 GNU/Linux      My sources.lst is               # cat /etc/apt/sources.list     #           # deb cdrom:[Debian GNU/Linux 7.0.0 _Wheezy_ - Official amd64 DVD Binary-1 20130504-14:44]/ wheezy contrib main          # deb cdrom:[Debian GNU/Linux 7.0.0 _Wheezy_ - Official amd64 DVD Binary-1 20130504-14:44]/ wheezy contrib main          deb http://security.debian.org/ wheezy/updates main contrib     deb-src ftp://ftp.iitm.ac.in/debian/ wheezy/updates main contrib          # wheezy-updates, previously known as 'volatile'     # A network mirror was not selected during install.  The following entries     # are provided as examples, but you should amend them as appropriate     # for your mirror of choice.     #     deb http://ftp.debian.org/debian/ wheezy-updates main contrib     deb http://http.us.debian.org/debian/ wheezy contrib non-free main     # deb-src http://ftp.debian.org/debian/ wheezy-updates main contrib     deb http://ftp.us.debian.org/debian stable main contrib non-free     deb http://security.debian.org/ wheezy/updates main contrib non-free


tmux with iterm2 attach a remote session

I'm using the Tmux integrating with ITerm2, which can create a tab in ITerm 2 for each window created by Tmux. But somehow this doesn't make much sense for the usual SSH scenario, where we first SSH to a remote host and work with multiple windows through Tmux. I want to have multiple tabs in ITerm 2, sharing one SSH connection, and in one Tmux sesson. Is it possible?


Recommendation on filesystem for embedded device - RAM or USB

It's been 4 years since I stopped working on my Linux internet radio box. My Linux box was Ubuntu 6.04 with Ext3 fs. At user-space, everything works perfectly except I occasionally bumped into corrupted fs issue if I disconnect the USB forcefully. I'd love to hear recommendations from experts on which fs would suits my case. I also heard about compress the whole system into a file then uncompress them during bootstrap phase, then again I am clueless and really appreciate if someone could point me to right direction. Many thanks.


Can GNOME/KDE be turned off?

I have installed Debian Wheezy on an old laptop I want to use as a server. However, sometimes I want to use that computer to read webpages and write some code on it. So I want to have a GUI where I can install a web browser. I want to have either KDE or GNOME on it. Is it possible to install a GUI that you can start with a command and stop again? The reason why I want this is to save resources when the server is only used as a server. It's an old laptop and doesn't have very much power.


Command line options of rackup are not shown in ps output or procfs

As you know if you wish to get command-line runtime arguments for running command you can parse `ps -e` or `/proc/<pid>/cmdline`. But I have encountered issue when this method returns only command with path but without arguments. For example:               $ rackup private_pub.ru -s thin -E production          Thin web server (v1.5.1 codename Straight Razor)     Maximum connections set to 1024     Listening on 0.0.0.0:9292, CTRL+C to stop          $ ps -e | grep rackup          16226 ttys001    0:02.19 /home/user/.rvm/gems/ruby-1.9.3-p429@gearup/     bin/rackup            $ xargs -0 echo < /proc/16226/cmdline          /home/user/.rvm/gems/ruby-1.9.3-p429@gearup/bin/rackup      There are no `private_pub.ru` and subsequent arguments. Can `rackup` "swallow" options and make them invisible to `ps`? What is reason for this behavior? My main issue is to find certain process with certain argument with `ps` or `procfs`. Output for `strace -rf -e trace=process rackup`               0.000000 execve("/home/user/.rvm/gems/ruby-1.9.3-p385@global/bin/rackup", ["rackup", "private_pub.ru", "-s", "thin", "-E", "production"], [/* 89 vars */]) = 0          0.003323 arch_prctl(ARCH_SET_FS, 0x7f1f1b1b1740) = 0          0.001193 execve("/home/user/.rvm/gems/ruby-1.9.3-p385@gearup/bin/ruby_noexec_wrapper", ["ruby_noexec_wrapper", "/home/user/.rvm/gems/ruby-1.9.3-p"..., "private_pub.ru", "-s", "thin", "-E", "production"], [/* 89 vars */]) = 0          0.002065 arch_prctl(ARCH_SET_FS, 0x7f04829a8740) = 0          0.001028 execve("/home/user/.rvm/gems/ruby-1.9.3-p385@gearup/bin/ruby", ["ruby", "/home/user/.rvm/gems/ruby-1.9.3-p"..., "/home/user/.rvm/gems/ruby-1.9.3-p"..., "private_pub.ru", "-s", "thin", "-E", "production"], [/* 89 vars */]) = -1 ENOENT (No such file or directory)          0.000294 execve("/home/user/.rvm/gems/ruby-1.9.3-p385@global/bin/ruby", ["ruby", "/home/user/.rvm/gems/ruby-1.9.3-p"..., "/home/user/.rvm/gems/ruby-1.9.3-p"..., "private_pub.ru", "-s", "thin", "-E", "production"], [/* 89 vars */]) = -1 ENOENT (No such file or directory)          0.000286 execve("/home/user/.rvm/rubies/ruby-1.9.3-p385/bin/ruby", ["ruby", "/home/user/.rvm/gems/ruby-1.9.3-p"..., "/home/user/.rvm/gems/ruby-1.9.3-p"..., "private_pub.ru", "-s", "thin", "-E", "production"], [/* 89 vars */]) = 0          0.005911 arch_prctl(ARCH_SET_FS, 0x7f4c84595740) = 0          0.013703 clone(Process 9182 attached     child_stack=0x7f4c845c1fb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f4c845c29d0, tls=0x7f4c845c2700, child_tidptr=0x7f4c845c29d0) = 9182          >> Thin web server (v1.5.1 codename Straight Razor)     >> Maximum connections set to 1024     >> Listening on 0.0.0.0:9292, CTRL+C to stop


Script using CURL to add information to site every month

I am very new at bash, so forgive me for the novice question. Here is my curl call:               curl -d 'username=cdaniels&wallclock=391324502' 'https://www-dev.***.***.edu/clusterusage/rest/update.html';      which pulls from a file `~/qacct.monthly` with the format               Total    : OWNER         WALLCLOCK         UTIME         STIME           CPU             MEMORY                 IO                IOW     Total    : ==========================================================================================================================     Total    : cdaniels      391324502         0.195         0.066         0.261              0.000              0.007              0.000     Total    : jlinger               1         0.039         0.056         0.095              0.000              0.000              0.000     Total    : lbsome         18707336  18675574.761     21433.535  18697008.296       10604793.658           5527.986              0.000      The example only pulls one of the users, but I want it to parse through the information and pull all the usernames and wallclock information from all the users on the cluster for that month. I'm wanting to put this into a script so that it executes every month (obviously through a cron job)


How to start tmux with attach if a session exists

If I use               tmux attach      I can attach to a running session but if there is no session running, I only get the error               no sessions      How can I automatically start a new session if there is none running? something like               tmux attach-or-create-new-session


What part of the Linux kernel determines the execution order of userland apps?

Stripping the source, I can't pinpoint which part of the kernel sets and manages the userland apps, and how it does it. For example, in the Linux main source, is the procedure have options to set boot order, and app load order prior to manual determination?


Shrink /home partition to two partitions

I have one hard disk on my server               [root@CentOS dev]# df -h     Filesystem      Size  Used Avail Use% Mounted on     /dev/sda3       4.9G  722M  3.9G  16% /     tmpfs           246M     0  246M   0% /dev/shm     /dev/sda1       194M   28M  157M  15% /boot     /dev/sda2       9.9G  164M  9.2G   2% /home      I want to shrink the home partition to two partitions I found `resize2fs` command               umount /home/     e2fsck -f /dev/sda2     resize2fs /dev/sda2 3G     mount /home/      after executing               /dev/sda3       4.9G  722M  3.9G  16% /     tmpfs           246M     0  246M   0% /dev/shm     /dev/sda1       194M   28M  157M  15% /boot     /dev/sda2       5.0G  160M  4.6G   4% /home      the size of /home reduced 3G but I can't found the name of new partition Any one who can give me an idea to solve this, i'll be grateful.


Sending the output from 'dd' to awk/sed/grep

I'm trying to approximate the computer's write speed using dd:               dd if=/dev/urandom of=/dev/null bs=1K count=10000      which gives the following output               10000+0 records in     10000+0 records out     10240000 bytes (10 MB) copied, 0.746313 s, 13.7 MB/s      How can I get the '13.7 MB/s' into a bash variable? I've tried piping the output from dd to progs like awk, sed and grep to no avail. Ultimately, I'm calling this via `os.system(...)` from within a python script. If anyone knows of a more direct way to get a similar result inside python I'd be interested in that also. I'm trying to predict how long a file copy will take, based on the file size. Any help would be greatly appreciated.


command not found handle doesn't work for url

I'm trying to setup the command_not_found_handle for URL links,               %> command_not_found_handle() { echo "OK"; }     %> aaaaa     OK     %> http://www.google.com     bash: http://www.google.com: No such file or directory      So it works for normal input, but not URL links, any ideas?


Configuring Vim with clientserver and clipboard

On OS X I have vim working just fine from homebrew. The default homebrew install compiles vim with these flags.               ./configure       --prefix=/usr/local       --mandir=/usr/local/Cellar/vim/7.4.161/share/man       --enable-multibyte       --with-tlib=ncurses       --enable-cscope       --with-features=huge       --with-compiledby=Homebrew            --enable-rubyinterp       --enable-pythoninterp       --enable-gui=no       --without-x      This install works perfectly with the system clipboard using this in my vimrc:               if has("clipboard")         set clipboard=unnamed     endif      Homebrew also has flags for installing `--with-client-server` if you use this it compiles vim with:               ./configure       --prefix=/usr/local       --mandir=/usr/local/Cellar/vim/7.4.161/share/man       --enable-multibyte       --with-tlib=ncurses       --enable-cscope       --with-features=huge       --with-compiledby=Homebrew            --enable-rubyinterp       --enable-pythoninterp       --enable-gui=gtk2      This compiles vim with `+clientserver` and `+clipboard`. Running `set clipboard?` returns `unnamed` yet now the integration with the system clipboard does not work at all, even when prefixing commands with `"+` or `"*`. Is there a way I can have both of these features work with a single vim install? **EDIT:** After some more searching I believe this is an issue on OS X with the system pasteboard not being correctly synced with the X11 server. I found a similar question here which gives you the settings you need to setup clipboard sync with X11. There is also a gui for that in the newer versions. ![X11 Prefs](http://i.stack.imgur.com/0Z4eT.png) Unfortunately this didn't work. I believe it's covered here in an open bug report on the xquartz tracker. It also looks like this may have been an issue for a while.


Changing the PS1 on an interactive bash subshell easily

I have a situation where I need to provide a subshell to a user mid-way through a longish process. I would like to change the prompt to remind the user that they are in a special subshell and haven't gone through the rest of the process yet. I thought that this would do what I want...               echo "PS1='foo:'" | bash -i      But when I enter that line, this is the output I get               me@mercury:~$ PS1='foo:'     foo:exit     me@mercury:~$       Is there a simple way around this? I could writeup my own custom bashrc... but I'd prefer to preserve the user's usual bash-shell setup.


Why do I get different outputs when running my shellscript manually from when I run it with cron?

I have a fairly simple shell script (`foo.sh`) that looks like this:               #!/bin/bash     echo -n "$USER,$(date)," `binary -flags | sed -e '1,30d'`;     exit 0;      This script is supposed to prepare some output which will then be appended to a text file, like so:               foo.sh >> data.csv      When I run the above on a root prompt, it works fine. However, when I type the exact same command into my (root) crontab which looks like this:               05 * * * * /root/foo.sh >> /path/to/data.csv      The crontab output differs! I wasn't expecting this and I can't understand why. See examples below:               Expected, normal output from running my .sh (example):     Fri Jun 14 16:32:34 CEST 2013,20130614163304,268828672,71682561          The output written to the file by cron:     Fri Jun 14 16:32:34 CEST 2013,      The rights on the binary run in the .sh looks like this:               -rwxr-xr-x  1 root root      Why does the output differ? How can I get the correct output into my CSV file?


Does cron impose some limitations to types of commands and privilege of execution?

I've experienced an issue where some of my scripts run perfectly fine when I call them manually, but these same scripts when called as cron jobs via `cron` don't seem to work at all. **So my question:** I'd like to know if there are restrictions that apply with the use of commands and/or scripts (and the privilege of execution) in a script scheduled to run with `cron`?


connecting to a wifi using wpa_supplicant

I have some problems connecting to my WiFi (WPA2, standard settings) using wpa_supplicant. My `/etc/wpa_supplicant.conf` is as follows:               network={         ssid="MYWIFI"         psk=********     }      then my /etc/network/interfaces               auto lo     iface lo inet loopback      After putting `wpa_supplicant -D -i wlan0 -c /etc/wpa_supplicant.conf` into the console I get a connection, it says: > Successfully initialized wpa_supplicant. But there is no connection. How can I ge this to work?


Linux From Scratch: libgmp.la, libmpfr.la, and libmpc.la not found during version-check

I'm trying to build a Linux From Scratch system on my host Linux Mint machine. However, when I run the version-check.sh file, it returns that my system is missing `libgmp.la`, `libmpfr.la`, and `libmpc.la`, even though I have `libgmp10`, `lipmpc3`, and `libmpfr4` . Here is the output of version check:               bash, version 4.2.45(1)-release     /bin/sh -> /bin/dash     Binutils: (GNU Binutils for Ubuntu) 2.23.52.20130913     bison (GNU Bison) 2.7.12-4996     /usr/bin/yacc -> /usr/bin/bison.yacc     bzip2,  Version 1.0.6, 6-Sept-2010.     Coreutils:  8.20     diff (GNU diffutils) 3.2     find (GNU findutils) 4.4.2     GNU Awk 4.0.1     /usr/bin/awk -> /usr/bin/gawk     gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1     g++ (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1     (Ubuntu EGLIBC 2.17-93ubuntu4) 2.17     grep (GNU grep) 2.14     gzip 1.6     Linux version 3.11.0-12-generic (buildd@komainu) (gcc version 4.8.1           (Ubuntu/Linaro 4.8.1-10ubuntu7) ) #19-Ubuntu SMP Wed Oct 9 16:12:00 UTC 2013     m4 (GNU M4) 1.4.16     GNU Make 3.81     GNU patch 2.7.1     Perl version='5.14.2';     sed (GNU sed) 4.2.2     tar (GNU tar) 1.26     xz (XZ Utils) 5.1.0alpha     g++ compilation OK     libgmp.la: not found     libmpfr.la: not found     libmpc.la: not found      **NOTE:** I'm following version 7.5 of the book and I'm using a 32-bit Linux Mint host (kernel 3.11.0-12).


What happened to Primary Administrator profile in Solaris 11?

What happened to the "Primary Administrator" profile in Solaris 11? Why was it cut? Are there any alternatives? How does it differ from the root-role (which is `profiles=All;auths=solaris.*`) Is the less powerful "System Administrator" better? Why? Reason to use/not use either/both? On my system, I "re-created" it by adding entries in `/etc/security/prof_attr.d` and `/etc/security/exec_attr.d...` However Solaris 11 lacks the solaris.grant (`auths=solaris.all,solaris.grant;exec=uid=0,gid=0`)... Is grant no longer needed? Are there alternatives?


Compiling Awesome from source on CentOS: cannot find libraries

I am trying to install `awesome` (v3.5.5) on `CentOS7`. Since I could not find a repository that carries it, I am compiling it from source. However, I am getting this error on running make:               -- checking for modules 'glib-2.0;gdk-pixbuf-2.0;cairo;x11;xcb-cursor;xcb-randr;xcb-xtest;xcb-xinerama;xcb-shape;xcb-util>=0.3.8;xcb-keysyms>=0.3.4;xcb-icccm>=0.3.8;cairo-xcb;libstartup-notification-1.0>=0.10;xproto>=7.0.15;libxdg-basedir>=1.0.0'     --   package 'xcb-cursor' not found     --   package 'libxdg-basedir>=1.0.0' not found     CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:279 (message):       A required package was not found     Call Stack (most recent call first):       /usr/share/cmake/Modules/FindPkgConfig.cmake:333 (_pkg_check_modules_internal)       awesomeConfig.cmake:134 (pkg_check_modules)       CMakeLists.txt:15 (include)               CMake Error at awesomeConfig.cmake:153 (message):     Call Stack (most recent call first):       CMakeLists.txt:15 (include)               -- Configuring incomplete, errors occurred!     make: *** [cmake] Error 1      However, I have install (again from source) those two libraries:               [awesome-3.5.5]$ ls /usr/local/lib/*cursor*     /usr/local/lib/libxcb-cursor.a   /usr/local/lib/libxcb-cursor.so.0     /usr/local/lib/libxcb-cursor.la  /usr/local/lib/libxcb-cursor.so.0.0.0     /usr/local/lib/libxcb-cursor.so     [awesome-3.5.5]$ ls /usr/lcoal/lib/*libxdg-basedir*     /usr/local/lib/libxdg-basedir.a   /usr/local/lib/libxdg-basedir.so.1     /usr/local/lib/libxdg-basedir.la  /usr/local/lib/libxdg-basedir.so.1.2.0     /usr/local/lib/libxdg-basedir.so      and I configured ldconfig to include /usr/local/lib, updated the cache...               ldconfig -p | grep xcb-cursor         libxcb-cursor.so.0 (libc6,x86-64) => /usr/local/lib/libxcb-cursor.so.0         libxcb-cursor.so (libc6,x86-64) => /usr/local/lib/libxcb-cursor.so          ldconfig -p | grep xdg-basedir         libxdg-basedir.so.1 (libc6,x86-64) => /usr/local/lib/libxdg-basedir.so.1         libxdg-basedir.so (libc6,x86-64) => /usr/local/lib/libxdg-basedir.so      I am afraid that I am stumped... Could it be SELinux?


How to sniff download information of different pc's on a network(router)

Actually I am making an Log Analyzer for downloads on a network by different users.So i want to know who downloaded what in a same network.I know SSL packets cannot be sniffed but I want only downloads that is not secured by SSL.


check if interface eth0 is up (configured)

I need to check with a script, whether `eth0` is configured. If so, the script will do nothing. Otherwise it will start `wlan0`. (I don't want both `eth0` and `wlan0` to be up at the same time). What would be the easiest way to check, whether `eth0` is already up? I am using Debian Wheezy # CLARIFICATION: I would like to check not only that the cable in `eth0` is plugged in, but rather that the interface is configured (i.e. it has either static IP set, or it has received a DHCP IP). If cable is plugged in, but `eth0` is not configured correctly, I want to start `wlan0`


What is this 1K logical partition?

I noticed that I have a strange partition under `sda3`, with a size of 1K. I am about to reformat my hard drive and re-install my OS with Ubuntu 14.04 while creating separate partitions for `/` and `/home`. What is this almost-empty partition, and should I do anything with it? Why is it in `lsblk` but not in `blkid`?               [lucas@lucas-ThinkPad-W520]~$ sudo blkid     /dev/sda1: LABEL="SYSTEM_DRV" UUID="30CA6C06CA6BC6A6" TYPE="ntfs"      /dev/sda2: LABEL="Windows7_OS" UUID="9426707E26706362" TYPE="ntfs"      /dev/sda4: LABEL="Lenovo_Recovery" UUID="E2CA772DCA76FD5B" TYPE="ntfs"      /dev/sda5: UUID="7d513625-85de-41b7-9c81-0d3fbc4e6a0f" TYPE="ext4"      /dev/sda6: UUID="602d2625-8ab9-44e5-b73a-d1f0181f5549" TYPE="swap"           [lucas@lucas-ThinkPad-W520]~$ lsblk     NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT     sda      8:0    0 465.8G  0 disk     ├─sda1   8:1    0   1.5G  0 part /media/lucas/SYSTEM_DRV     ├─sda2   8:2    0 262.1G  0 part /media/lucas/Windows7_OS     ├─sda3   8:3    0     1K  0 part     ├─sda4   8:4    0  15.6G  0 part /media/lucas/Lenovo_Recovery     ├─sda5   8:5    0 178.7G  0 part /     └─sda6   8:6    0   7.9G  0 part [SWAP]     sr0     11:0    1  1024M  0 rom


Configure iptables on remote server without locking me up

I have a little remote server that I can access only with SSH, and what I want to do, is block all the traffic except port 22 for SSH. The first time, what I did was :               iptables -P INPUT DROP      And of course, it locked me up because I didn't let any input traffic, so I couldn't add the following rules to accept SSH traffic. How can I block all the traffic (except SSH) and in the same time letting me have access to the server through SSH?


Auto ecryptfs mounting only works after cloning

Weird problem, I have an auto ecryptfs setup on a machine. I have an init.d script which is setup to automount the ecryptfs. It was working at one point, and even now if I run the script directly it mounts. However, it no longer works automatically now. The weird part is, if I clone the system using Clonezilla, the cloned machine works OK and gets automounted. Any thoughts on how to troubleshoot this?


Configure sender address for all users in mutt

I have CentOS running mutt. When mails are sent from mutt (via a shell script), it takes the current user name as sender address causing it to go into the spam. I receive mail as               From: tech      What I need is:               From:    tech@myserver.com      All I need is a single place change that reflects everwhere. i.e. if I send from the root user, the from address should be `root@myserver.com`. Please help.


Can't save session in Macpup linux

I installed Macpup linux 550 on a flash disk. After shutting down the Macpup, it asks for saving session (in text mode) but keyboard doesn't work and I can't select yes. The yes button has focus but I can't hit it because keyboard doesn't work. What can I do?


How to copy directories with preserving hardlinks?

How to move directories that have files in common from one to another partition ? Let's assume we have partition mounted on `/mnt/X` with directories sharing files with hardlinks. How to move such directories to another partition , let it be `/mnt/Y` with preserving those hardlinks. For better illustration what do I mean by "directories sharing files in common with hardlinks", here is an example:               # let's create three of directories and files     mkdir -p a/{b,c,d}/{x,y,z}     touch a/{b,c,d}/{x,y,z}/f{1,2,3,4,5}     # and copy it with hardlinks     cp -r -l a hardlinks_of_a      To be more specific, let's assume that total size of files is 10G and each file has 10 hardlinks. The question is how to move it to destination with using 10G (someone might say about copying it with 100G and then running deduplication - it is not what I am asking about)


How to run VLC player in root

I have installed a vlc in centos 6.5. I want to run it as root. But I get the following error, > "VLC is not supposed to be run as root. Sorry. If you need to use real-time > priorities and/or privileged TCP ports you can use vlc-wrapper (make sure it > is Set-UID root and cannot be run by non-trusted users first)."


What does /usr/bin/install do besides copying?

1. Does `make install` with a Makefile most of the time call `/usr/bin/install`?   2. What necessary work does `/usr/bin/install` do besides copying the just compiled files to `/usr/bin/local`?   3. The man page says `/usr/bin/install` copy files and set attributes. What attributes are so important to set?   4. Does it just set permission modes and owner/group, which are not necessary?


Debian: GPG cannot fetch Linux Kernel key

I am in the process of recompiling the kernel on Debian. Following the instructions on kernel.org, the first step is to verify the signature. But GPG complains that it cannot find the public key:               # gpg --verify linux-3.12.22.tar.sign      gpg: Signature made Wed 11 Jun 2014 17:22:35 CEST using RSA key ID 6092693E     gpg: Can't check signature: public key not found      I have tried to fetch the key:               # gpg --recv-keys 6092693E     gpg: no keyserver known (use option --keyserver)     gpg: keyserver receive failed: bad URI      I have tried to set the keyserver:               # gpg --keyserver subkeys.pgp.net --recv-keys 6092693E     gpg: requesting key 6092693E from hkp server subkeys.pgp.net     gpg: keyserver timed out     gpg: keyserver receive failed: keyserver error      What is the problem? Thanks. Software:   * Debian GNU/Linux 6   * GPG 1.4.10 **EDIT:** I do have a firewall, but its rules don't block outbound traffic. However, connecting to the keyserver on a different port:               $ gpg --keyserver subkeys.pgp.net:80 --recv-keys 6092693E     gpg: requesting key 6092693E from subkeys.pgp.net:80     gpgkeys: no keyserver host provided     gpg: keyserver internal error     gpg: keyserver receive failed: keyserver error


How to format write protected SD card

I am newbie in Linux, I want to format my SD card using Ubuntu, for this I follow this tutorial After typing `df` command , I got list of storage devices.From here I can see my SD card name is `/dev/sdb5` so I replace `/dev/sdb1` with `/dev/sdb5` in all next commands.Now `umount` command works fine but after this when I type `mkdosfs -F 32 -v /dev/sdb5` I am getting these lines:               mkdosfs 3.0.12 (29 Oct 2011)     mkdosfs: unable to open /dev/sdb5: Read-only file system      so, please tell me how to fix this.


Execution of possibly harmful program on Linux

I'm writing a program that will test programs written by students. I'm afraid that I can't trust them and I need to make sure that it won't end up badly for the computer running it. I was thinking about making some crash test user with limited access to system resources and run programs as that user, but from what I have found on the net so far, making a virtual system would be the safest option... Can someone help me with choosing the right approach? Security is a big concern for me. On the other hand, I don't want a solution that is overkill and waste much time trying to learn something I don't really need.