How to delete in vim everything in between the cursor and the end of the line while on insert mode?

While in normal mode I can delete all the characters after the cursor by typing `d$`. I'd like to achieve the same but in **_insert mode_** in the same way that you can delete things to the left of the cursor with `Ctrl` + `W`


Remove spaces and headers from a dumped database table

I have dumped the database table data into a flat file and below is how the data looks like : (Kindly copy from below               ;metier_code              ;     ;-------------------------;          (0 rows affected)     ;CRDS_Ptf_No;          ;                                ;                         ;          ;                                ; ;                         ;                         ;               ;               ;               ;                         ;                         ;     ;Status;     ;-----------;----------;--------------------------------;-------------------------;----------;--------------------------------;-;-------------------------;-------------------------;---------------;---------------;---------------;-------------------------;-------------------------;-----;------;     ;       NULL;ABCD      ;ABHJARS                         ;                         ;ABCD      ;ABCD                            ;Y;                         ;                         ;               ;               ;               ;                         ;                         ;     ;A     ;     ;       1234;XEU-ANKD  ;XEU-AJKD                        ;                         ;ABCD      ;ABCD                            ;Y;                         ;                         ;               ;               ;               ;                         ;                         ;     ;A     ;     .     .     ;      11745;ANJLDMAOKD;AMKDJ AN DJ JAHF AS CPFVH ACCR  ;NONE                     ;AN DJ JAHA;AN DJ JAHA                      ;Y;NO ANKIO GAP             ;YES AMK SCF              ;               ;               ;               ;                         ;                         ;     ;I     ;     ;      11744;AMKDIONSKH;AMKDJ AN DJ JAHF AS CPFVH MTM   ;NONE                     ;AN DJ JAHA;AN DJ JAHA                      ;Y;NO ANKIO GAP             ;YES AMK SCF              ;               ;               ;               ;                         ;                         ;     ;I     ;          (5436 rows affected)     (return status = 0)          Return parameters:          ;           ;     ;-----------;     ;       5436;               (1 row affected)     ;       ;           ;     ;-------;-----------;     ;grepkey;       5436;          (1 row affected)      want to convert the above as below format: Row should contain the seq no (Prefixed) Need to remove columns names and the blank spaces present in the original file at begining and ending. BELOW IS THE FORMAT OF DATA THAT I AM GETTING BY USING THE SUGGESTED CODE:               awk -F ';' '/^;-----------;/ {start=1;next;};  start==0 {next;}; {gsub(" +",""); print NR "" $0;}' temp_file > test      FORMAT after executing above script :               7;NULL;ABCD;ABHJARS;;ABCD;ABCD;Y;;;;;;;;;A;     8;NULL;XEU-ANKD;XEU-AJKD;;ABCD;ABCD;Y;;;;;;;;;A;     .     .     5443;11744;AMKDIONSKH;AMKDJ AN DJ JAHF AS CPFVH MTM;;QWERDF;QWERDF;Y;;;;;;;;;A;     5444     5445(5436rowsaffected)     5446(returnstatus=0)     5447     5448Returnparameters:     5449     5450;;     5452;5436;     5453     5454     5455(1rowaffected)     5456;;;     5457;-------;-----------;     5458;grepkey;5436;     5459     5460(1rowaffected)      Above : the prefix row number is not coming in sequence(Incrementing by using the preceeding lines that is not the actual data). Initial file was containing additional info in flat file like column name @ begining , at the end of file few additional details that i wanted like count of records etc I want the data in below format (Which shall have prefix row number and shall include only rows of table , not the additional preceeding and exceeding data)               1;NULL;ABCD;ABHJARS;;ABCD;ABCD;Y;;;;;;;;;A;     2;NULL;XEU-ANKD;XEU-AJKD;;ABCD;ABCD;Y;;;;;;;;;A;     3;NULL;SWAPOLEIL;SWAPOLEIL;;QWERDF;QWERDF;Y;;;;;;;;;A;     .     .     5436;11744;AMKDIONSKH;AMKDJ AN DJ JAHF AS CPFVH MTM;;QWERDF;QWERDF;Y;;;;;;;;;A;          5436 - is the number of rows present in the table from where i am fetching the data.      Thanks in advance! (Tried the other suggested solutions as well . However, dint got the desired result)


How to send data from serial port over wifi?

I have microcontroller device which reads data from sensors and sends it via Serial to USB converter (ftdi232 cable). This Serial to USB converter is connected to ARMv7 mini-computer - CuBox with Ubuntu 13.04. I have also connected WiFi USB adapter to CuBox. I would like to read data from serial port and send it via WiFi and receive on Windows PC. It is possible without network socket programming, using available tools? Something like pipe/bridge/redirection between serial port and WiFi. I don't need to communicate with this box, so constant and one-way stream of data over WiFi will be sufficient. Thanks you for any resources and ideas how to set up this communication.


VIM commenting out what I paste

I got this when trying to copy this gist on vim: https://gist.github.com/w0ng/3278077 ![enter image description here](http://i.stack.imgur.com/MnvS9.png) I notice the same behaviour everywhere: If I paste something that includes a comment, everything that follows the comment is pasted commented. Maybe it has something to do with the fact that if I write a comment on insert mode and press enter, the following line automatically appends a comment. How can I get rid of this behaviour?


How to make the system automatically kill some processes?

Sometimes my computer starts to behave sluggishly after running too many programs/processes simultaneously, at points almost looking crashed/frozen. Using Debian Linux, is there a way to automatically kill some processes before memory gets too scarce for smooth operation?


Fedora 19 freezes after login

I have been using F19 for a couple of days until I've decided to do an yum update. Everything went well but after reboot I can't get past the login screen anymore. I enter my username/password, then the login screen disappears and Fedora freezes, displaying only the login screen background image. I've tried logging in through terminal (Ctrl+Alt+F3) but after entering my details the terminal just hangs and I can't do anything (I can input commands but there's no reaction). Do you have any idea how to fix this?


where is /var/log/messages

I have several sources saying that `/var/log/messages` has system log message but I don't have that file (Ubuntu 11, Debian). Is the messages file somewhere else now? I tried using `locate` to look for it but didn't see it.


I get this shutdown prompt, then my laptop dies. What is happening?

I get a dialog box that says 'Shut down the system now', the same as if I had clicked 'quit' in the main menu. This happens seemingly randomly. If I choose 'cancel', it sometimes goes away. Other times,it pops back up again. Whether or not I click cancel, my laptop will shutdown immediately, as if all the power has gone. When I run 'last -x', I see this:               korgan   pts/1        :0               Sat Jul 27 07:32   still logged in        korgan   tty8         :0               Sat Jul 27 06:57   still logged in        runlevel (to lvl 2)   3.5.0-17-generic Sat Jul 27 06:57 - 07:42  (00:44)         reboot   system boot  3.5.0-17-generic Sat Jul 27 06:57 - 07:42  (00:44)         korgan   pts/1        :0               Fri Jul 26 20:27 - 21:13  (00:46)         korgan   pts/1        :0               Fri Jul 26 17:05 - 18:07  (01:02)         korgan   tty8         :0               Fri Jul 26 17:02 - crash  (13:54)         runlevel (to lvl 2)   3.5.0-17-generic Fri Jul 26 17:02 - 06:57  (13:54)         reboot   system boot  3.5.0-17-generic Fri Jul 26 17:02 - 07:42  (14:39)         shutdown system down  3.5.0-17-generic Fri Jul 26 17:02 - 17:02  (00:00)         shutdown system down  3.5.0-17-generic Fri Jul 26 17:01 - 17:02  (00:00)         runlevel (to lvl 6)   3.5.0-17-generic Fri Jul 26 17:01 - 17:01  (00:00)         korgan   tty8         :0               Fri Jul 26 16:20 - 17:01  (00:41)         runlevel (to lvl 2)   3.5.0-17-generic Fri Jul 26 16:19 - 17:01  (00:41)         reboot   system boot  3.5.0-17-generic Fri Jul 26 16:19 - 17:01  (00:41)          There is a 'crash' entry at 13:54 on the 26th, although the crash that happened last night was before the reboot the following day, the 27th. I've checked the temperature of the cpu when I get this prompt and it's nothing irregular, usually around 52 °C. I don't know what my next step should be. I'm running Linux Mint 14 on a Gateway NV53A. I looked at `/var/log/syslog` and I found this, at the point of shutdown:               Jul 27 09:29:39 Ono-Sendai kernel: [ 9146.988498] type=1701 audit(1374935379.026:3114): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=5729 comm="chrome" reason="seccomp" sig=0 syscall=2 compat=0 ip=0x7f368d4f96c0 code=0x50000     Jul 27 09:29:39 Ono-Sendai kernel: [ 9146.988507] type=1701 audit(1374935379.026:3115): auid=4294967295 uid=1000 gid=1000 ses=4294967295 pid=5729 comm="chrome" reason="seccomp" sig=0 syscall=2 compat=0 ip=0x7f368d4f96c0 code=0x50000     Jul 27 09:31:13 Ono-Sendai kernel: imklog 5.8.6, log source = /proc/kmsg started.     Jul 27 09:31:13 Ono-Sendai rsyslogd: [origin software="rsyslogd" swVersion="5.8.6" x-pid="619" x-info="http://www.rsyslog.com"] start     Jul 27 09:31:14 Ono-Sendai rsyslogd: rsyslogd's groupid changed to 103     Jul 27 09:31:14 Ono-Sendai rsyslogd: rsyslogd's userid changed to 101     Jul 27 09:31:13 Ono-Sendai rsyslogd-2039: Could not open output pipe '/dev/xconsole' [try http://www.rsyslog.com/e/2039 ]     Jul 27 09:31:14 Ono-Sendai bluetoothd[672]: Bluetooth daemon 4.101     Jul 27 09:31:14 Ono-Sendai bluetoothd[672]: Starting SDP server     Jul 27 09:31:14 Ono-Sendai bluetoothd[672]: DIS cannot start: GATT is disabled     Jul 27 09:31:14 Ono-Sendai bluetoothd[672]: Failed to init deviceinfo plugin     Jul 27 09:31:14 Ono-Sendai bluetoothd[672]: Failed to init proximity plugin     Jul 27 09:31:14 Ono-Sendai bluetoothd[672]: Failed to init time plugin     Jul 27 09:31:14 Ono-Sendai bluetoothd[672]: Failed to init alert plugin     Jul 27 09:31:14 Ono-Sendai bluetoothd[672]: Failed to init thermometer plugin     Jul 27 09:31:14 Ono-Sendai avahi-daemon[699]: Found user 'avahi' (UID 111) and group 'avahi' (GID 120).     Jul 27 09:31:14 Ono-Sendai kernel: [    0.000000] Initializing cgroup subsys cpuset     Jul 27 09:31:14 Ono-Sendai avahi-daemon[699]: Successfully dropped root privileges.     Jul 27 09:31:14 Ono-Sendai avahi-daemon[699]: avahi-daemon 0.6.31 starting up.     Jul 27 09:31:14 Ono-Sendai avahi-daemon[699]: Successfully called chroot().     Jul 27 09:31:14 Ono-Sendai avahi-daemon[699]: Successfully dropped remaining capabilities.     Jul 27 09:31:14 Ono-Sendai kernel: [    0.000000] Initializing cgroup subsys cpu     Jul 27 09:31:14 Ono-Sendai kernel: [    0.000000] Linux version 3.5.0-17-generic (buildd@allspice) (gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1) ) #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 (Ubuntu 3.5.0-17.28-generic 3.5.5)


XUbuntu: Window manager stopped to work

I installed XUbuntu on my netbook and it worked like a charm for about a week. Then, today, the _Software center_ application crashed and since then the window manager stopped to work. Thera are following symptoms:   1. Small buttons for maximizing, restoring and minimizing a window are not visible.   2. I cannot switch between the applications using `Alt-Tab`. I almost always selected the `Save session` checkbox in the logout screen. I tried to deselect this checkbox and restart. It didn't help - the window manager is still not working. When I login with a guest account, everything works (but I cannot access my data from the other account easily). I think that there is some cached data, which was not cleaned up and causes the window manager to crash at every login. How can I fix this problem (make the aforementioned symptoms disappear) ?


Monitoring cisco devices from linux or windows?

how can i know the status of a large no of devices (approx 600,000).If i want to moniter the status of the device whether up or down. Will any scripting language be sutable for such a task because the only way i can think of monitoring these devices from a linux/windows machine is to ping the device status.but again pinging will not be a good idea beacuse it will take a lot of time. If i need to login and check the status of ports then that would take a lot more time. what is the best way possible? How many devices can i ping if i use parralell processing?


How to download several urls into one file

I have URLs like this.               http://203.90.117.109/wds_cdma/wds.aspx?min=404000290205346     http://203.90.117.109/wds_cdma/wds.aspx?min=404000832812637     http://203.90.117.109/wds_cdma/wds.aspx?min=404000853093050         After that it should hit the browser. It will get some output like this                404000290205346|9225534526|2|Prepaid|2      404000832812637|9204506289|2|Prepaid|2      404000853093050|9247868854|2|Prepaid|2      I also tried the following:               wget -t 45 -0 log.txt -i input.txt      It generates the output in single files but I want all three files in one file.


Where are sudo incidents logged?

When someone is not in the sudoers group and try to use sudo, get an error message like this one: `yzT is not in the sudoers file. This incident will be reported.` I'm trying to figure out in which log this information is logged, for check who tried to run a command with sudo for example, but can't find it. The first Google search says `/var/log/syslog` but I don't see any information related to sudo there.


Cat 2 files and avoid duplication of lines

I have the **file1** with the following content               {"name":"clio5", "value":"13"}     {"name":"citroen_c4", "value":"23"}     {"name":"citroen_c3", "value":"12"}     {"name":"golf4", "value":"16"}     {"name":"golf3", "value":"8"}      And I have the **file2** with the following content               {"name":"clio5", "value":"14"}     {"name":"citroen_c4", "value":"25"}     {"name":"golf4", "value":"18"}      I want to execute a shell command in order to display the content of the **file1** and the **file2**. if a `name` exist in both **file1** and **file2** so I want to display only the related line of the **file2**. So the output should look like this:               $command taking account file1 file2     {"name":"clio5", "value":"14"}     {"name":"citroen_c4", "value":"25"}     {"name":"citroen_c3", "value":"12"}     {"name":"golf4", "value":"18"}     {"name":"golf3", "value":"8"}      The command should not edit **file1** neither **file2** The command should be as simple as possible The command could contains `grep`, `sed`, `awk`


How to run a command after apt-get upgrade

Recently I came across the nice `checkrestart` tool, that checks if running processes use an outdated version of a recently updated library and would need a restart to load them with the updated lib. At the moment I have to call `checkrestart` by hand every time I have used `apt-get upgrade` or `aptitude upgrade`. Is there a way to invoke such a command automatically after `apt-get` or `aptitude` have upgraded some packages? Bonus points if the solution also works with `unattended-upgrades`.


Transparently run wine programs

When I want to run a wine program I have to type e.g. `$ wine ~/.wine/drive_c/Program\ Files/TextAloud/TextAloudMP3.exe` Would it be possible to run directly `TextAloudMP3`? I mean not only from command line (I could create alias) but in whole graphical environment. I'm launching programs with `dmenu`.


ZFS on Linux gets corrupted on export

**Edit:** I am not using Sabayon Linux anymore. I suggest to close this question. I just started experimenting with ZFS on Linux. I use Sabayon Linux with kernel 3.8. I used a whole single USB disk to create a pool. I tried to do only the basics               zpool create -f testing /dev/disk/by-id/usb-WD_My_Passport_0748_575837314333323139313238-0:0      Which create the zpool successfully.               zpool export testing      Goes without any errors. However, when trying to import the pool back:               zpool import             pool: testing          id: 18027227446368584194       state: FAULTED      status: One or more devices contains corrupted data.      action: The pool cannot be imported due to damaged devices or data.        see: http://zfsonlinux.org/msg/ZFS-8000-5E      config:              testing     FAULTED  corrupted data           sdb       UNAVAIL  corrupted data      I'm using 64 bit kernel with 2 GB of memory. I'm finding it hard to believe that this is a ZFS on Linux bug, since it's very trivial.


Finding data transfer rates on individual TCP/IP connections

In a application that has multiple TCP/IP connections with other applications on a Linux system how can I find the amount of data transferred between individual connections.


Why are there several keys unbound in vim?

There are several keys that are unbound in vi/vim, such as `g, q, v and #`. Is there a particular reason why these keys are unbound? Can I just use them however I want or will I be breaking certain conventions concerning their use?


what are some uses of .(single period) & ..(double period) in the shell command line

The single period `.` means current working directory The double period `..` means parent of the current working directory I can only think of `.` being used in relative pathname etc `cd ./bin/usr` How are the above `.` & `..` used in the shell command line


Can iptables be used to monitor TCP timeouts/resets system-wide?

I'm trying to determine if an application's connection to a database is internal to the application or due to a networking event. This seems like something netfilter would have system-wide visibility on. To that end, I wanted to use `-j LOG` with `iptables` to log all TCP resets and timeouts that occur on the system. I don't know what to use for the matching criteria, though. I feel like the answer would involve the `conntrack` module at some point but I've been able to locate next to nothing on it. The database server is MS-SQL and the J2EE application is running on a RHEL 5.10 VM. The latter is the machine I'm trying to perform the logging on. **EDIT:** I found this blog post which shows how to log TCP resets (amongst other things) with the `\--tcp-flags` option to `iptables`. So the outstanding issue is figuring out how to log connections with no explicit RST but are closed due to the connection being seen as stale/timing out.


Arch Linux hangs after soft reboot

After installing Arch Linux with Gummiboot I have to hard reboot to avoid a black screen. If I run `sudo reboot` the screen just goes black and nothing more happens after activating an item in the boot menu. Any ideas?


Using TMUX on boot up of Linux CentOS

I'm trying to figure out a way in which I can boot TMUX under a user other than root, but automatically whenever Linux starts. At least that's what I think I need. What I _want_ is to be able to SSH into a remote box using the aforementioned user and type "tmux attach" and see the running program that was launched when TMUX was started. The issue seems to be that I can't get TMUX started under the user of choice via the rc.local file (Linux CentOS 6.3), but instead it seems the TMUX session belongs to root instead. Normally not a problem, but I want to use SSH and don't wish to try to use SSH as root. Is there a way to "switch" to a different user while executing the rc.local script? BTW, I do have TMUX booting and launching my program via script but I need to be logged in as that user in order to see the program using SSH.


Can I delete the MBR from GRUB?

Can I delete the Master Boot Record from GRUB? If so, how?


Multi-user text mode runlevel in Ubuntu

I use Ubuntu as a server, and I want to change its runlevel to be full multi- user text mode (like init 3 in RedHat). Using `runlevel` command, I see that am running `N 2` which is Graphical multi-user with networking based on this  wiki entry. So I'm wondering, is _1- Single-user mode_ in Ubuntu the equivalent for _3- Full multi-user text mode_ in RedHat?


Easy way to parse syslog date format

I'd like to write a script that analyses the last week's syslog. But my syslog logs in a stupid date format, e.g. "May 22". If it logged as 2013-05-22, this task would be trivial. Is there a way using awk / bash / perl / sed that I can easily 'grep' the logs for all lines between two datetimes?


Unpredictable memory explosions

The main server at my company has recently been having a lot of downtime. For reasons that neither I nor the other admins can determine, it has random (VERY sudden) explosions in memory. It becomes unresponsive because it exhausts all the memory, and then we have to reboot it. Very annoying. It's a Debian system, we haven't upgraded to Squeeze or anything, it's been perfectly stable for a long time. The problem is that the logs are totally useless. They don't seem to indicate that anything is going wrong. I'm guessing that some process is buggy and hogging all of the memory, but I have NO way of proving that at the moment. Remote logging is no help, because it's not complaining about anything -- it thinks everything is peachy. So my question is: how would you approach this problem? Any insight is appreciated. Thanks.


How to run find -exec?

I'd like to find the files in the current directory that contain the text "chrome".               $ find . -exec grep chrome     find: missing argument to `-exec'      What am I doing wrong?


Kernel panic - not syncing: No init found. While booting from U-Boot

Kernel mounted the root file system but can not find any init script. I'm sure that script exists in my ramdisk.img! I also checked out this and GE863-PRO3 U-BOOT Software User Guide 1VV0300777 Rev. 6 – 2010-01-25. Any idea or alternative documentation? My environment: GE863-PRO3 128/64 version               U-Boot 1.2.0 (Aug 18 2010 - 12:16:10)- 221 Telit          DRAM:  64 MB          Bank #1     Flash:NAND Numonyx NAND01G-B2B 128MB 1.8V 8-bit     Hardware ECC (ECC data size = 512 bytes)     Nb min erasable unit:   1024     min erasable Size: 131072     Size=134217728 bytes     Logical address: 0x40000000     No bad block detected     Area 0: 40000000 to 403BFFFF (RO)  Primary Bootstrap     Area 1: 403C0000 to 4043FFFF (RO)  U-Boot code     Area 2: 40440000 to 404BFFFF (RO)  U-Boot Environment     Area 3: 404C0000 to 407BFFFF       User Area 1     Area 4: 407C0000 to 47FFFFFF       User Area 2      U-BOOT commands:               setenv bootargs console=ttyS0,115200 mem=64M ver=4384k icofat=257k rootfstype=jffs2 root=/dev/mtdblock1 rw mtdparts=at91_nand:7936k(ARMboot)ro,-@7936k(root) init=/bin/busybox     ethinit 192.168.122.3     erase 404C0000 47FFFFFF     tftp 20200000 ramdisk.img     cp.b 20200000 0x407c0000 14cd78     tftp 20200000 uImage     bootm      boot output:               VFS: Mounted root (jffs2 filesystem).     Freeing init memory: 96K     Setting DMA Console     Failed to execute /bin/busybox.  Attempting defaults...     Kernel panic - not syncing: No init found.  Try passing init= option to kernel.     Function entered at [<c01de28c>] from [<c01de304>]     Function entered at [<c01de2a0>] from [<c0020398>]      r3:c3c1ac40 r2:c3c1ac40 r1:c3c1deb0 r0:c01c3cab     Function entered at [<c00202dc>] from [<c00085e0>]      r4:c020d2c0     Function entered at [<c00083b8>] from [<c003a454>]


X Window opened from screen

Bit of an oddish one, if I've opened an X window over SSH in a screen session will it reopen when screen is reattached? I've been able to detach and the process stays running fine, with the X window continuing to update with me logged onto the server but I'm just curious if I'll be able to detach and logoff, then reattach and bring the window back.


Create and open file with one command?

I want to create a text file and open it in a text editor with a single command. I know `touch file.txt` creates a file and `open file.txt` opens the file, but is there a way to do this with a single command?


Is there an exhaustive list of plugins for Dovecot?

**Background**   I am looking for plugins for Dovecot (specifically authentication plugins) because I would like to look at source code for reference as to how to make an authentication plugin for Dovecot. I have search through the official list on the Dovecot website as well as a Google search for a list of plugins available. Unfortunately I haven't been able to find anything that fits what I am looking for. **Questions**   Are there more plugins available than in the official list?   Where can I find these plugins?   Are there any authentication plugins available for Dovecot? I am looking for a response that answers all of the questions above. Thank you for your assistance.


mdadm : difference in metadata versions

Can anyone tell me the difference between the different metadata versions for mdadm? When I try the command `mdadm --examine /dev/sda1`, I can't seem to find "preferred superblocks" on version 1.2. This field shows up in metadata version 0.9. Is there a way to get such metadata information? Or is the output of `mdadm --examine` just the information I'm going to get for version 1.2?


Unknown btrfs error, partition won't mount

unix friends, a day or so ago my btrfs partition just stopped working, which means i can't mount it anymore which is why my Fedora Linux doesn't boot anymore. I don't really have much information, but Gparted outputs the following when i attempt to check the partition:               checking extents     checking fs root     checking root refs     btrfsck: extent_io.c:602:free_extent_buffer: Assertion `!(eb->refs < 0)` failed.      When I tried to mount the partition with a Fedora 18 Live DVD I got a SIGSEGV from the mount program and additionally an unknown kernel error which was also tainted. Do you have any idea how to restore the data on this partition or it is lost for sure?


Connecting from OpenVPN Server to MySQL Server

I have an OpenVPN server installed on a server. What I'm trying to do connect from the OpenVPN server using the mysql client to the MySQL server than is connected to the OpenVPN server using a client. I can ping back and forth between the servers, no issues. However, if I use the MySQL client on the OpenVPN server to try to connect to the MySQL server I get a               ERROR 2003 (HY000): Can't connect to MySQL server on '10.8.0.6' (111)      with 10.8.0.6 being the connected to the OpenVPN server at 10.8.0.1. I thought it might be IPTables but adding explicit INPUT and OUTPUT one the client and the server didn't change anything. Telnet 10.8.0.6 3306 didn't work either. I have verified that MySQL is running on 3306:               me@db:~# lsof -i4 -P | grep -i mysql     mysqld  6192 mysql   10u  IPv4  40596      0t0  TCP localhost:3306 (LISTEN)      So what am I doing wrong? Google has been less than helpful, as far as what I could find it should just work.


Can't play music using Banshee on Arch Linux

When running Banshee from the terminal, after I click on a song, a little x appears next the song title and I get this output:               GStreamer-CRITICAL **: gst_element_query: assertion `GST_IS_ELEMENT (element)' failed      As Banshee starts, I also get this output (it may not be related, I have no idea):               [Warn  17:57:43.999] Failed to start DAAP client - System.Exception: No Zeroconf providers could be found or initialized. Necessary daemon may not be running. (in `Mono.Zeroconf')      I've tried updating gstreamer, but that didn't help. I'm currently using Gnome3. Anyone know what's going on?


RT3290 Wireless still not working

I've been trying to get my wireless working for two weeks now. I have 1814:3290 wireless card. I am on Linux Mint 14 64-bit. I have tried all the suggestion on here: http://askubuntu.com/questions/240553/how-do-i-install-ra3290-bin-wireless- driver-into-lib-firmware http://ubuntuforums.org/showthread.php?t=2104129 http://askubuntu.com/questions/240553/how-do-i-install-ra3290-bin-wireless- driver-into-lib-firmware I updated my kernel to 3.8.5-030805-generic. The first thing I tried was compiling the drivers (using original kernel 3.5.0-17-generic). When I compiled and installed, my wireless worked, but, I kept getting kernel panics every time I logged in. So I `modprobe -r rt3290sta`. After that I tried updating the kernel to the one I have now and copying the bin file. The kernel saw the wireless card but it was not active or anything. I checked `rfkill` and nothing was blocked. So then I tried compiling the drivers again after `make clean` first. Now when I try to compile the drivers I get this:               /home/dis/Downloads/DPO_RT3290_LinuxSTA_V2600_20120508/os/linux/../../os/linux/pci_main_dev.c:43:23: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rt2860_remove_one’     /home/dis/Downloads/DPO_RT3290_LinuxSTA_V2600_20120508/os/linux/../../os/linux/pci_main_dev.c:44:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rt2860_probe’     /home/dis/Downloads/DPO_RT3290_LinuxSTA_V2600_20120508/os/linux/../../os/linux/pci_main_dev.c:63:46: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__devinitdata’     /home/dis/Downloads/DPO_RT3290_LinuxSTA_V2600_20120508/os/linux/../../os/linux/pci_main_dev.c:85:17: error: ‘rt2860_pci_tbl’ undeclared here (not in a function)     /home/dis/Downloads/DPO_RT3290_LinuxSTA_V2600_20120508/os/linux/../../os/linux/pci_main_dev.c:86:17: error: ‘rt2860_probe’ undeclared here (not in a function)     /home/dis/Downloads/DPO_RT3290_LinuxSTA_V2600_20120508/os/linux/../../os/linux/pci_main_dev.c:88:5: error: implicit declaration of function ‘__devexit_p’ [-Werror=implicit-function-declaration]     /home/dis/Downloads/DPO_RT3290_LinuxSTA_V2600_20120508/os/linux/../../os/linux/pci_main_dev.c:88:29: error: ‘rt2860_remove_one’ undeclared here (not in a function)     /home/dis/Downloads/DPO_RT3290_LinuxSTA_V2600_20120508/os/linux/../../os/linux/pci_main_dev.c:292:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rt2860_probe’     /home/dis/Downloads/DPO_RT3290_LinuxSTA_V2600_20120508/os/linux/../../os/linux/pci_main_dev.c:463:23: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rt2860_remove_one’     /home/dis/Downloads/DPO_RT3290_LinuxSTA_V2600_20120508/os/linux/../../os/linux/pci_main_dev.c:71:1: error: ‘__mod_pci_device_table’ aliased to undefined symbol ‘rt2860_pci_tbl’     cc1: some warnings being treated as errors     make[2]: *** [/home/dis/Downloads/DPO_RT3290_LinuxSTA_V2600_20120508/os/linux/../../os/linux/pci_main_dev.o] Error 1     make[1]: *** [_module_/home/dis/Downloads/DPO_RT3290_LinuxSTA_V2600_20120508/os/linux] Error 2     make[1]: Leaving directory `/usr/src/linux-headers-3.8.5-030805-generic'     make: *** [LINUX] Error 2      Everything is up to date also. I'm not sure where to go from here. Maybe I should downgrade my kernel to 3.6 or 3.7? Edit: So I downgrade my kernel to 3.7.2 and recompiled the drivers. The kernel sees my wireless card but doesn't really seem to work and everything freezes. Going to try kernel 3.6. Edit2: After more testing I found out that 3.7.2 and 3.6.11 both give me kernel panics after installing the wireless driver. Edi3: I installed 3.7.11 and compiled and installed the wireless drivers. Wireless worked for 3 seconds and then had a kernel panic.


Why is `kill -s INT <zsh PID>` behaving differently from `Ctrl-C`?

Starting with:               % donothing () { echo $$; sleep 1000000 }     % donothing     47139      If at this point I hit `Ctrl-C` at the same terminal that is controlling the shell, then the function `donothing` does indeed terminate, and I get the command prompt back. But if instead, from a different shell session, I run               % kill -s INT 47139      ...the `donothing` function does _not_ terminate. (Ditto if I pass `-47139` as the last argument to `kill`.) Do I need to use a different PID from the one I'm using to achieve with `kill -s INT` the same effect that I can achieve interactively with `Ctrl-C` at the controlling terminal? (I'm primarily interested in the answer for `zsh`.) * * * EDIT: in response to Gilles comment: no, I have not set any traps (though I would be interested to learn how to confirm that no traps are set: is there a way to list all the active traps?); and yes, I can reproduce this behavior with `zsh -f`. In fact, I can reproduce it under the most extreme way I know to get an absolutely "bare" `zsh` (please let me know if there's a better way):               % /usr/bin/env -i /usr/bin/zsh -f     % donothing () { echo $$; sleep 1000000 }     12345      ...etc. Since my original post, I have replicated the behavior described above both under Darwin and under NetBSD, but not under Linux (i.e. under Linux `kill -s INT <zsh PID>` does kill the `donothing` function defined above, without killing the parent shell in the process). So maybe this is a BSD-ish thing. More specifically, in every Unix I've tried this with, the `sleep` process is a child of the `zsh` process, but only under Linux is the `SIGINT` signal that was sent to the `zsh` process propagated to the `sleep` process. Therefore, in order to be able to kill the `donothing` function non- interactively under Darwin and NetBSD I need a way to find the PID of the `sleep`-ing child, and send the `SIGINT` to it (which, admittedly, does sound pretty heartless). More generally, to kill a shell function non-interactively under Darwin and NetBSD, I need to recursively/depth-first find the _descendants_ of the `zsh` process and send them the `SIGINT` to them...


Split a physical X display into two virtual displays?

I just purchased a TripleHead2Go and configured it using OSX. What this box does is simply take 1-3 multiple external monitors and combine their signal into one single resolution. I'm using two external 1920x1080 displays with it, bringing my display size to 3940x1080, alongside my laptop's regular display of 1920x1200. My laptop is running FGLRX 8.95 with Catalyst 12.3, the video card is an AMD Radeon HD 6700M. Here's what I'm looking at, presently: ![enter image description here](http://i.stack.imgur.com/g7qwJ.png) ![enter image description here](http://i.stack.imgur.com/XTbs2.png) Here is my xorg.conf file: http://pastebin.com/jgm9AwqN Is there a way for me to "split" this massive display into two, virtual 1920x1080 displays so that windows will maximize properly, one to each monitor?


Symbolic linking to ~/ instead of ~/[path/file]

I moved all of my dot files out of `~/` in to `~/data/dotfiles` I then did `ln -s ~/data/dotfiles/[filename] ~/` My intention was `ln -s ~/data/dotfiles/[filename] ~/[filename]` This included my `.vimrc` , `.bashrc` And others Now when I open a terminal session or open vim I get `too many levels of symbolic links.` I'm unsure if I delete the symbolic link from my home directory or from the directory the files live in. Any help would be appreciated. As per request: `jsw:dotfiles jsw$ ls -l ~/.vimrc ~/data/dotfiles/.vimrc lrwxr-xr-x 1 jsw staff 6 1 Aug 13:54 /Users/jsw/.vimrc -> .vimrc -rw-r--r-- 1 jsw staff 11044 31 Jul 10:51 /Users/jsw/data/dotfiles/.vimrc`


DHCP server: offer different subnet addresses for different interfaces

I'm running Ubuntu 10.04 on my home router which has multiple network interfaces. I have `dhcpd` configured to provide addresses from `192.168.1.0/24` subnet on certain interface. However, I'd like to also provide addresses from `192.168.2.0/24` subnet for another interface. How can I configure `dhcpd` to do so? Or, if I use another DHCP server software, for example, `dnsmasq` - how can that be configured to do the same thing?


How do I tell if a Wine application uses hardware or software rendering?

I'm building an appliance/kiosk-type machine which is going to run a single fullscreen _Wine_ application (Synthesia). I'm using Arch Linux running LXDE on an original 7-inch EeePC (well, souped up to 2Gb of RAM, but the CPU is rather slow, something like 633 Mhz). The game can use either a DirectX or OpenGL renderer and I'm finding it to be quite choppy, especially with the DirectX renderer. However, I remember that the machine was perfectly capable of running Tuxracer and other OpenGL games, and Synthesia definitely should be less demanding to graphics - all it does is drawing a few colored bars. So, the point is - the display is choppy and the CPU utilization is at 100% when the program runs so I suspect it may be using software rendering. The video chip is Intel and I have `xf86-video-intel` installed. How do I check if the application uses hardware or software rendering? If the software rendering is being used, how do I set it to hardware rendering?


Unmet dependencies error on Debian

I'm on Debian wheezy, i want to install chkrootkit               sudo apt-get install  chkrootkit      i get this error :               Reading package lists... Done     Building dependency tree            Reading state information... Done     You might want to run 'apt-get -f install' to correct these:     The following packages have unmet dependencies:      skype : Depends: libqt4-dbus (>= 4:4.5.3) but it is not going to be installed              Depends: libqtwebkit4 (>= 2.1.0~2011week13) but it is not going to be installed     E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).      I'm not sure, but the main problem here is about this message :               E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).      please any suggestion ? I'm a newbie on Debian/Linux OS


Determine the last 7 days backup size

Consider I have a folder `/home/abdul/backup` which contains `.gz` file for the past 1 year...My requirement is to get the size of last 7 days...


Compiling Source Code Error

While I'm compiling a open source project on Cent OS 5.5 I'm getting error "cc1plus warnings being treated as errors". Why and how to solve this problem.


xrdp: Super_L not working

My virtual machine runs `xrdp` and when I connect with `rdesktop`, the "windows" key (i.e. Super_L) is not assigned properly. Using `xev` I see that when the windows key is pressed, instead of showing `Super_L`, it shows `Control_L`. The real `CTRL` key also shows `Control_L`. In other words, both the windows key and `CTRL` have the same effect. How can I fix this, so that the Windows key maps to `Super_L`, same as on my laptop?


bypass firewall with Openvpn + Squid

I have 2 VPS servers, one in China and another in the US. The server (`openvpn` client) in China is connected to the US one via `openvpn`. I also have `squid` running in the China server. I want to redirect all traffic to `squid` through the `openvpn` tunnel to the US server, so users can access blocked sites including youtube.com, facebook, twitter and the likes. I currently have all outgoing `http` and `https` traffic on the China server going through the `openvpn` tunnel. I verify this, because when visiting normal sites, the public IP address has already become the US IP address. Yet I still cannot access blocked sites due to DNS pollution, and all these sites resolve to the unreachable IP address. How can I circumvent the DNS pollution issue in this case? I know there are other ways to bypass the gfw (e.g. SSH tunnel, VPN) but this method is the most convenient one for ordinary users.


grep for strings that were found in a previous statement

I'm trying to find out if an address definition is used inside of fortigate configuration file. I extracted the section out of the configuration file, that contains the addresses. In that section the lines look like this:               edit "address name"         set associated-interface "someinterface"         set subnet 1.1.1.1 0.0.0.0      So now I wanted to use the address name and check if any rule or address group uses this by doing the following:               IFS='     '     for address in $(grep edit addresses.txt | cut -c10- | sed 's/"//'g); do echo $address; grep -n $address fortigate.conf; done      The IFS part I took from here. This returns me a list of names of address definitions, but the grep command doesn't find anything, which is weird, since it should at least find itself, no?


What regular expression engine type does bash use?

I use RegEx Buddy to prototype and debug my regular expressions. RegEx Buddy allows me to choose between a number of different regular expression engine types (.NET, Java, Perl, GNU BRE, GNU ERE, POSIX, BRE, POSIX ERE etc). What regular expression engine does bash use (for example in `if` and `case` statements)? I'm running Centos 5.5 32 bit and bash 3.2.25(1):               [kevin@mon01 scratch]$ bash --version     GNU bash, version 3.2.25(1)-release (i686-redhat-linux-gnu)     Copyright (C) 2005 Free Software Foundation, Inc.      I'm guessing it'll be GNU BRE or GNU ERE?


mdadm metadata: should i take precautions to prevent superblock overwrite?

Situation:   * I'm creating a new RAID1 array using mdadm.   * I won't be using additional layers, such as LVM or dm-crypt.   * I've noticed that metadata version 1.2 is now the default. I understand it's the recommended version, if all other parts of the system (for example grub2) support it. This is the case for me.   * From the manpage and several other sources I understand that metadata 1.2 means the superblock is stored at the beginning of the disk. At 4KiB from the start.   * On previous RAID1 arrays I created, I used metadata version 0.90 which stores the superblock at the end of the disk instead. To prevent it from being overwritten, I left the last part of the disk unpartitioned. It's my intention to partition the new RAID1 array with a GPT partition table, first partition starting at sector 2048. If a sector is 512 bytes, this means the actual partition will start at 1024KiB from the start of the disk. Questions:   * Should I take any precautions to prevent the version 1.2 superblock from being overwritten, or is starting the first partition at sector 2048 enough to be relatively safe?   * I imagine grub will write at the start of the disk, but it will probably only need the first 512 bytes. Do any other programs write right after those bytes on the disk?   * Is the part right after the end of the first sector, up to sector 2048, a 'regulated' part of the disk? Do other programs check if any other data is present before they start writing there? I couldn't find anything specific about this. I understand that using `dd` can destroy a superblock ;-) and so does `mdadm --zero-superblock`. I'm more concerned about any other utilities or filesystem layers such as LVM of which I may not immediately realise they could overwrite that specific part of the disk where the superblock is stored.


cronjob for automatic DB backup to date prefixed file

I am using the latest Linux Mint. I was wondering if it's possible to create a special cronjob for a database backup. In my `/etc/cronjob` file I have the following code:               # Minute   Hour   Day of Month       Month          Day of Week        Command         # (0-59)  (0-23)     (1-31)    (1-12 or Jan-Dec)  (0-6 or Sun-Sat)                     30        4          *            *                1-6            /home/users/backup.sh      In my `/home/users/backup.sh` I have:               mysqldump -uroot -p MyDatabase > /home/users/backup_MyDB/full_myDB.sql      Instead of `full_myDB.sql` I would like to have something like `2014-04-04_full_myDB.sql` where the date is added dynamically depending on the date we have. If the SQL Backup file is **older than one week** I would like the cronjob to _delete_ it automatically. Hope someone can help me.


Connecting to FTP sites via squid

I'm using the squid proxy on _CentOS_ but, I can't connect to FTP sites from WAN. I did open FTP ports in the firewall on CentOS. However, I receive a "Page cannot be displayed" error when I try to connect to FTP sites. What should I do?


What alternative backends does sudo support and how is it configured?

When preparing for the Red Hat Certified Engineer certification examination, I came across this quote in my study notes about the `sudo` command. > By default, the policy is maintained as a flat text file, > /etc/sudoers(although other, possibly remote, backend databases are also > supported). I have never heard of this piece of information until recently and a quick Google search does not turn up anything useful with regards to this. Is this particular quote accurate? If so, how do I make the appropriate changes to configure `sudo` to use an alternative(presumably centralized) database for its policies?


Why doesn't terminal show color schema once logged as root?

I'm currently using Debian 7 Wheezy, and I've noticed that the **colors palette** on terminal (which might be useful to identify among a large set of files and folders) are not enabled once I log as root. Same, I've noticed the **tab completion** doesn't work the same in this situation. How can I configure these issues?


vim: Can I make *only* y perform a copy?

I'm learning to like vim, but one thing that I haven't yet fully embraced is the copy and paste situation. In a muggle text editor I would `Ctrl`-`C` copy a piece of text and then edit/delete and then paste the text somewhere else. However in vim I can't do this because after I copy text with `y`, modifying the text often involves `d` and `x` which obliterates my original text. Is there any way to make `d` and `x` not copy the text? Or otherwise, how should I be using these vim features?


Using grep/sed/awk to classify log file entries

I need to process a very large log file with many lines in different formats. My goal is to extract unique line entries who have the same starting pattern, e.g. '^2011-02-21.*MyKeyword.*Error', effectively obtaining a list of samples for each line pattern, therefore identifying the patterns. I only know a few patterns so far, and browsing through the file manually is definitely not the option. **Please note that besides the known patterns, there is a number of unknown ones too, and I'd like to automate extracting those as well.** What is the best way to do this? I do know regular expressions quite well, but haven't done much work with awk/sed which I imagine would be used at some point in this process.


How can I find out about "rootfs"

Running Debian 7; when I execute a               cat /etc/mtab      I can see all sorts of useful information about the filesystems that are mounted, such as the filesystem and options used to mount then; however for the rootfs I see only:               rootfs / rootfs rw 0 0      How can I know more about the rootfs; which physical device/partition was used, filesystem, mount options etc? On my system /etc/mtab is in fact a symbolic link to /proc/mounts               lrwxrwxrwx 1 root root 12 May  9  2013 /etc/mtab -> /proc/mounts


Lightweight MS Paint/MacPaint equivalent FLOSS in Linux?

What is an equivalent to MS Paint and MacPaint that works on Linux? There is a BSD-licenced one called Paintbrush that's great for Mac OS X, but I have not found one on Linux. I hope it can be lightweight, i.e. few dependencies, don't need GNOME, KDE, etc., but anything is fine.


How to jail a fastcgi server (or a web-proxied server)?

If you have a web-server (e.g. nginx) often you use a fast-cgi server or another application-http-server for dynamic content. That means in both cases you have a nice process separation between the web-server process and the fast-cgi (or application-http-server process - in the following called slave). The web-server is configured such that fast-cgi goes over a socket or http request are proxied. Creating different users for the slave and the web-server you can protect filesystem locations, if there is a security problem in the slave process. But how do I jail the slave process even more under Linux? (Such that it cannot access the net, send mails etc.) I can think of following routes:   * SELinux   * Linux system namespaces ('containers', cgroups) What is the most convenient way on a current distribution like e.g. Debian? How to do it in practice? Any configuration examples?


NVIDIA installer can't find kernel source/build files (compiled from kernel.org)

I just compiled and installed the new 3.0-rc2 kernel from kernel.org on my Fedora 15 system. Everything seems to work fine and I can successfully boot into the system. However, this broke my previously installed NVIDIA driver, so I need to compile a new one. I downloaded the installer from nvidia.com, but I am having trouble with the installation. To compile the kernel I unzipped the kernel archive to my home directory, then simply reused my Fedora config for the new kernel. Everything resides in `~/linux_build/linux-3.0-rc2`. After booting to runlevel 3 I get an error with the NVIDIA installer:               ERROR: If you are using a Linux 2.4 kernel, please make sure        you either have configured kernel sources matching your        kernel or the correct set of kernel headers installed        on your system.             If you are using a Linux 2.6 kernel, please make sure        you have configured kernel sources matching your kernel        installed on your system. If you specified a separate        output directory using either the "KBUILD_OUTPUT" or        the "O" KBUILD parameter, make sure to specify this        directory with the SYSOUT environment variable or with        the equivalent nvidia-installer command line option.             Depending on where and how the kernel sources (or the        kernel headers) were installed, you may need to specify        their location with the SYSSRC environment variable or        the equivalent nvidia-installer command line option.      I ran the installer like this:               bash NVIDIA-Linux-x86_64-270.41.19.run --kernel-source-path=/home/tja/linux_build/linux-3.0-rc2      Usually this was solved by installing the kernel headers from `yum`, but here I am using a new kernel with no RPM available. _How do I manually install the needed headers/source files for the NVIDIA installer?_


find not recursive when file at top

Imagine a source tree. There are xml files everywhere. But since there is a XYZ.xml at the root of this tree it won't find my xml files.               find -iname *.xml      returns               ./XYZ.xml      instead of               ./XYZ.xml     ./a/b/c/bob.xml     ./b/d/top.xml


Find doesn't want to find *.sh in certain level

I have a problem with `find`. It doesn't find *.sh files if I am in certain directory level. It does, however, find *.sql files.               /path$ cd do_not_upload/updates/1.1.1/     /path/do_not_upload/updates/1.1.1$ find . -path *.sh     ./run_pre_update/002.sh     ./run_pre_update/001.sh     ./run_post_update/001.sh     /path/do_not_upload/updates/1.1.1$ find . -path *.sh     ./run_pre_update/002.sh     ./run_pre_update/001.sh     ./run_post_update/001.sh     /path/do_not_upload/updates/1.1.1$ cd ..     /path/do_not_upload/updates$ find . -path *.sh     ./1.1.3/run_pre_update/002.sh     ./1.1.3/run_pre_update/001.sh     ./1.1.3/run_post_update/001.sh     ./1.1.1/run_pre_update/002.sh     ./1.1.1/run_pre_update/001.sh     ./1.1.1/run_post_update/001.sh     /path/do_not_upload/updates$ cd ..     /path/do_not_upload$ find . -path *.sh     ./updates/1.1.3/run_pre_update/002.sh     ./updates/1.1.3/run_pre_update/001.sh     ./updates/1.1.3/run_post_update/001.sh     ./updates/1.1.1/run_pre_update/002.sh     ./updates/1.1.1/run_pre_update/001.sh     ./updates/1.1.1/run_post_update/001.sh     /path/do_not_upload$ cd ..     /path$ find . -path *.sh     /path$ find . -path *.sql     ./do_not_upload/updates/1.1.3/sql_migrations/002.sql     ./do_not_upload/updates/1.1.3/sql_migrations/001.sql     ./do_not_upload/updates/1.1.1/sql_migrations/002.sql     ./do_not_upload/updates/1.1.1/sql_migrations/001.sql          $ find --version     find (GNU findutils) 4.4.2          /path$ stat do_not_upload/       File: ‘do_not_upload/’       Size: 60          Blocks: 0          IO Block: 4096   directory     Device: 14h/20d Inode: 159862      Links: 3     Access: (0775/drwxrwxr-x)  Uid: ( 1000/  jorgee)   Gid: ( 1000/  jorgee)     Access: 2014-09-10 14:02:34.449376973 -0300     Modify: 2014-09-10 13:54:13.805363567 -0300     Change: 2014-09-10 13:54:13.805363567 -0300      Birth: -


Is bluetooth keyboard associated with `stdin`?

I know that keyboard is standard input and is referred by the `stdin` file. I sometimes use a Bluetooth(BT) keyboard when working on my laptop. Both keyboards, my laptop keyboard as well as the BT keyboard work simultaneously. So, are both keyboards associated with `stdin`? If yes, how are they synchronized?


Want to replace the words with space in multiple files using SED commmand I have a word as 'Danny' with single quotes in many of my files in multiple directories which I want to change to 'Danny Samuel' since I have a space in the new word this command wont work               find . -type f -exec sed -e 's/'Danny'/'Danny Samuel'/g' -i.php '{}' +


Searching command history

I search the terminal command history by pressing `Ctrl``r` but what if:               This is an old command          This is an | less -S older command I press `Ctrl``r` and then I type "this is an" and the old command commes up but not the older. How can I search all the "this is an" commands? Is it possible to pipe all similar commands to grep or something? If I `set -o vi`, how do I undo it?


Use X over an intermediate machine

EDIT: I didn't setup my `sshd_config` file correctly on the WORK machine. Even though I uncommented the line `X11Forwarding no`, I didn't realize that it said "no" instead of yes. Since the default is "no", I just assumed, without paying much attention, that it would be `X11Forwarding yes` after I uncomment it. I have a public machine, MIDDLE. I have another machine at work: WORK that I want to be able to access from my home computer: HOME. HOME can access MIDDLE and WORK can access MIDDLE but MIDDLE cannot access either machine directly and HOME and WORK can't access each other directly. I have an SSH server running on WORK with X11Forwarding enabled. If I setup a reverse tunnel from WORK to MIDDLE, and then from HOME do `ssh -X MIDDLE` and then `ssh -X -p <someport> localhost`, I get `X11 forwarding request failed on channel 0`. Commands I am using to setup the tunnels:               # On machine WORK:     user2@WORK:   $ ssh -R 33333:localhost:22 user1@MIDDLE          # On machine HOME:     user@HOME:    $ ssh -Y user1@MIDDLE     # And then on machine MIDDLE:      user1@MIDDLE: $ ssh -Y user2@localhost -p 33333      Note: `user1 != user2`. Is there some way to achieve what I want?


Command for forcing a pointer ungrab (captured mouse release)

Sometimes Firefox doesn't release the mouse after dragging, so I need to kill the application to force it to release its pointer grab. Is there any command to force an application to ungrab the pointer without killing it?


Viewing Debian documentation offline

How do I read various manuals, guides and howtos, which are usually in the form of deb packages with names ending in `-doc` and installed in `/usr/share/doc` directory?


Help understanding modifiable in Vim

During a OS upgrade (Linux), Vim or some part of it has been updated as well. Now it happens that sometimes when I save a file (the file is not saved) I get this error: > E21: Cannot make changes, 'modifiable' is off I did `:help E21` and the manual says:                       {not in Vi}     *E21*     When off the buffer contents cannot be changed.  The 'fileformat' and     'fileencoding' options also can't be changed.     Can be reset with the |-M| command line argument.      It's not clear to me what it means. I use and start the editor the usual way, nothing is changed. The workflow is the same, too. I open different windows with `CTLR-W N`, then load and edit files there and switch between windows, etc. I'd like to know how to disable this behavior and about side effects.


Can't run yum update

I've been banging my head on the keyboard with this! I'm working on CentOS 6.5 x86_64. Firstly I tried to update `php` and `apache` using easy apache. The update failed very quickly so I went on the usual hunt around the internet. It appears I also can't run `yum update`. Here is the bottom of the readout:               Error: Package: glibc-utils-2.12-1.132.el6_5.2.x86_64 (updates)            Requires: libgd.so.2()(64bit)            Removing: gd-2.0.35-11.el6.x86_64 (@base)                libgd.so.2()(64bit)            Updated By: gd-2.1.0-1.el6.x86_64 (CentALT)                Not found     Error: Package: cpanel-webalizer-2.23_05-2.cp1136.x86_64 (installed)            Requires: libgd.so.2()(64bit)            Removing: gd-2.0.35-11.el6.x86_64 (@base)                libgd.so.2()(64bit)            Updated By: gd-2.1.0-1.el6.x86_64 (CentALT)                Not found     You could try using --skip-broken to work around the problem     You could try running: rpm -Va --nofiles --nodigest      I've tried running `rpm -Va --nofiles --nodigest` but to no avail. A lot of what I have read mentions repos. I have the following repos installed:               CentOS-Base.repo     CentOS-Vault.repo     mod-pagespeed.repo     CentOS-Debuginfo.repo     epel.repo     remi.repo     centalt.repo     CentOS-Media.repo     epel-testing.repo      I know there is a problem with `centalt.repo` as when I try to go to the base URL I get a `403:forbidden` message. I've tried using `wget` to install `gd-2.0.35-11.el6.x86_64.rpm` but it says it's already installed. Which, to me, means `libgd.so.2()(64bit)` should also be installed (according to http://www.rpmfind.net//linux/RPM/centos/6.5/x86_64/Packages/gd-2.0.35-11.el6.x86_64.html). I'm really stuck here... I really hope someone can help me get this sorted out. I need to update PHP for a client.


Get the latest directory (not the latest file)

My folder `parent` has the following content:               A.Folder B.Folder C.File      It has both folders and files inside. `B.Folder` is newer. Now I just want to get `B.Folder`, how could I achieve this? I tried this,               ls -ltr ./parent | grep '^d' | tail -1      but it gives me `drwxrwxr-x 2 user user 4096 Jun 13 10:53 B.Folder`, but I just need the name `B.Folder`.


Different access rights for different groups for a folder on Linux

I have a folder on a Linux machine that I would like to be read only for members of one group, read write for members of another group, and read write for the owner. `Other`s would not be able to access this folder at all. Is there a way to do this without using ACLs?


Why does vim color this .bashrc line incorrectly? Fixable?

I have the following line in my .bashrc that allows me to use rlwrap with sqlplus. Why does vim seem to color this wrong?               alias sqlplus='rlwrap -c -f /usr/bin/rlwrap -b '\''\(\){}[],+=\&^%$#@"";|\'\'' sqlplus'      vim coloring suggests unbalanced quotes and incorrect subsequent lines, i.e. ![enter image description here](http://i.stack.imgur.com/IEbil.png) but the line (and subsequent lines) actually work fine. Making changes such as adding an extra end quote "fix" the coloring but mess up the command, i.e. I then get               -bash: /home/mdurrant/.bash_profile: line 18: unexpected EOF while looking for matching `''     -bash: /home/mdurrant/.bash_profile: line 21: syntax error: unexpected end of file      Is there a way to have the command work correctly **and** have the coloring be correct?


script to send e-mail for success or failure

My Oracle backup sends out an e-mail with notification that backup completed and it was successful or failed depending upon it find some pattern. Our backup logs are getting very big - 14mg. Since this file is larger then 10MB, this messages are getting dropped by the Exchange servers. Please help me fix this issue, i.e. i need this process to just send an e-mail with the pattern "ORA-" or "RMAN-" error codes(if failure) or just a e-mail that indicates success or failure. NOTE: this is just a part of the code - Let me know if you have any questions.               #### Check for RMAN/ORA Errors and notify accordingly          RMANERROR=`egrep "ORA-|RMAN-" $RMAN_LOG_TSBKUP`     RMANWARN=`egrep "ORA-|RMAN-" $RMAN_LOG_TSBKUP|egrep -vE "$EGREP_EXCLUDE"`               if [ -z "$RMANERROR" ]     then        echo "No Errors"        cat $RMAN_LOG_TSBKUP |mailx -s "SUCCESS - DW_TS_BACKUP Complete" `cat $EMAIL_SUCCESS_DIST`     elif [ -z "$RMANWARN" ]     then        echo "No Errors, but Warnings"        cat $RMAN_LOG_TSBKUP |mailx -s "SUCCESS (with ignorable WARNINGS) - DW_TS_BACKUP Complete" `cat $EMAIL_SUCCESS_DIST`     else        echo "Errors Found !!!!"        mailx -s "FAILURE - DW_TS_BACKUP Complete" `cat $EMAIL_FAIL_DIST`     fi     }


Can an executable know where it is stored? For my open source project, I wrote a small bash script to automate some operations. The script lies at the root of the project and performs its tasks on all files below. People have the project files on their own computers, at their favorite path, so I can't just hardcode `cd /home/nico/projects/theproject` at the beginning of the script. I don't want to force people to manually `cd` to the project's directory everytime before executing either. I would like people to be able to use a Gnome shortcut to launch the script. To do so, the script needs to know where itself is stored.


How to add another domain to my chrooted named server

Firstly I successfully have a domain working in a chroot named. There are files in `/var/named/chroot/var/named` called `mydomain.com.db` and `named.local` and `named.root`. Also in `/var/named/chroot/etc` there is named.conf. So mydomain.com works as both a hosted website and it has `ns1.mydomain.com` and `ns2.mydomain.com`. Now what I want to do is only to add another domain `mydomain2.com` to this setup, however I'm having trouble to find tutorial articles on adding another domain. They mostly seem to focus on just the adding of the first domain. I guess I have to create a new zone file and reference it in the `named.conf` but I don't know what the zone file should contain. I tried some trial and error guessing but it didn't work.


Limit CPU/RAM usage per user?

I'm running game server applications on dedicated server that I have, but I want to be able to limit the CPU/RAM/etc usage on a per-user basis to make sure one of the servers doesn't eat up more resources than it is supposed to be given. I've seen people recommend ulimit for this, but the way to limit CPU in it is confusing... What I'm aiming to do is limit each user to 1 thread ( out of 16 ) and 1G of RAM.. I'd also prefer not to do this in VMs, as I only have 3 IPs and my previous attempts to setup NAT have been rather unsuccessful.


Failure Writing a Multi-Session Audio/Data CD w/ cdrdao

I'm trying to create a multi-session CD (CD-Extra), but hitting some errors with `cdrdao`. I'm following these steps. The audio session of the CD finished successfully, but writing the data portion results with:               [valid=0] Info fld=0, Current      SCSI command failed: sense key: 0x05: Illegal Request     Raw sense data: 0x70 0x00 0x05 0x00 0x00 0x00 0x00 0x0a 0x00 0x00      0x00 0x00 0x21 0x02 0x00 0x00      ERROR: Write data failed.     ERROR: Writing failed.      I tried with the `generic-mmc-raw` driver, and get another error message:               ERROR: Cannot set write parameters mode page.      Any ideas on what would cause this? Is there another method that can be used to create a mult-session disc?


What do you use the -t "tag" option for in logger?

When using the "logger" command to write messages to the system logs from scripts, I use the `-t` "tag" to store the scripts name along side the message it's written to the log. I do this to make finding entries easier for troubleshooting.   * Are there any ad-hoc standards for using this tag message?   * If you use it, what do you put in there?


Watch file using multitail even if it has not been created

I've a MapServer logfile; it is created in `/tmp/mapserv.log`, but obviously it is flushed at every reboot, and is created only when a loggable event occurs. I'm already using Multitail, but now I need to watch the folder `/tmp` for a file that has not even been created, waiting for it to appear. Any hint?


What type of permissions should a user's home directory and files have?

I'm working with a fresh install of Ubuntu 12.04 and I've just added a new user:               useradd -m testuser      I thought that the `-m` flag to create a home directory for users was pretty standard, but now that I've taken a closer look I'm a little confused: By default the new directory that was just created shows up as:               drwxr-xr-x  4 testuser testuser 4.0K May 20 20:24 testuser      With the `g+r` and `o+r` permissions that means every other user on the system can not only `cd` to that user's home directory, but also see what is stored there. When reading over some documentation for suPHP it recommends setting the permissions as `711` or `drwx--x--x` which is how it would make the most sense to me. I noticed that I can change the permissions on the files inside `/etc/skel` and they are set correctly when creating new users with `useradd -m` but changing the permissions on the `/etc/skel` directory itself does not seem to have any effect on the new directories that are created for users in `/home/`   * So - what type of permissions should a user's home directory and files have - and _why_?   * If I wanted permissions to be different for `useradd -m` - like the `711` / `drwx--x--x` as I saw mentioned, how is one to do that? Must you create the user and then run `chmod` ?


Emacs on Minix 3?

Has anybody managed to install Emacs on Minix 3? Emacs was available on earlier versions of Minix. I am OK with an earlier version of Emacs if necessary. I don't find Zile, mg or Elle adequate and would prefer the full version of Emacs, even if it is an old version. I don't need a GUI version `emacs-nox` is OK, I will be running it from the command line anyway.


Color terminal under USS

I've been using a remote terminal connected to USS under a mainframe for some time. Is there a way to configure this terminal to be colored? I'm using PuTTY and xterm. **Added:** USS stands for UNIX System Services, UNIX implementation for mainframes.


How to remove Oracle Wallet using orapki?

Hi i'm on Centos using oracle 11g And i've created a wallet using :               $ orapki wallet create -wallet /u01/app/oracle/admin/DB11G/wallet -pwd WalletPasswd123 -auto_login      Now i want to remove it to try again and can't find how to do that. all the samples are using the Oracle Wallet Manager which is a GUI i don't have. Any help?


Sendmail/procmail/Exchange truncating mail

The level of enlightenment by a colleague to find a pattern in this has saved me from a new depth of madness. My hope is that the brain trust here can now tell me why... **The Scene:** We have several generic mail IDs with procmail setup to redistribute mail based on the original recipient. For example, mail sent to generic_ID1 goes to staff1,staff2; mail to generic_ID2 goes to staff3,staff4; et cetera...               GENERIC_ID1_RECIPIENTS="staff1@domain,staff2@domain"          :0     * ^TO.*generic_ID1     ! $GENERIC_ID1_RECIPIENTS      **The Problem:** Mail was being truncated, seemingly at random. The pattern finally discovered showed that it occurred when a sentence ended with a period at column 76 and a hard carriage return: not at column 75 or 77; not at column 76 with more text to follow on that same line. Any text following that period was lost. Addendum: we've just seen it reoccur (and reproduced it) with a period at column 226. I am gobsmacked. I am able to confirm that procmail receives the message whole by copying the message before redelivery:               :0c                       # note: 'c'     * ^TO.*generic_ID1     ! $GENERIC_ID1_RECIPIENTS      I believe that sendmail may be truncating it upon redelivery but I'm unsure how to diagnose or prove that (I am not a sendmail admin, just a procmail user). The problem is entirely reproducible. **The Questions:** Why is this happening and how can I fix it? Much thanks. **EDIT: Updated title and tags. The solution is in the comments.**


How to parse a file to extract 3 digits numbers kept in a "group number"

I am a beginner, and trying to write a shell script to parse a text file that is extracted from a standardization pdf file. I would like for each test group (identified by Group 0, Group 1... to get the list of test numbers, such as 101, 102, 412... for group 0. I have tried sed, awk, but I do not have sufficient skills to succeed. Ideally I would like to get the output translated into LaTeX code, ie each output item surrounded by a suitable string, such as               \section{Group0}     \Testdetails{101}     \Testdetails{102}     ...............     \section{Group1}     \Testdetails{305}     ................      This is the source file.                                                               Table 6                                 Tests                     EN 2591-                   Remarks                                                                      All models      Group 0      Visual examination                                101      Examination of dimensions and mass                102      To be performed on one pair per layout, in                                                                 sealed and un-sealed versions      Contact insertion and extraction forces           412      To be performed on one pair per layout, in                                                                 sealed and un-sealed versions      Measurement of insulation resistance              206      Only specimens of group 6      Voltage proof test                                207      Only specimens of group 6      Contact resistance - Low level                    201      Contact resistance at rated current               202      Mating and unmating forces                        408      On specimens of groups 2, 4 and 6      Visual examination                                101      Group 1      Rapid change of temperature                       305      Visual examination                                101      Interfacial sealing                               324      Measurement of insulation resistance              206      Immersed connectors      Voltage proof test                                207      Immersed connectors      Insert retention in housing (axial)               410      Contact retention in insert                       409      Mechanical strength of rear accessories           420      Contact retention system effectiveness            426      (removable contact walkout)      Visual examination                                101      Group 2      Contact retention in insert                       409      Rapid change of temperature                       305


How do I apply software patches?

I have an application `foobar` for which someone has written a patch to add a feature I like. How can I use the patch?


What is the difference between PATH and LD_LIBRARY_PATH?

I am having some difficulties understanding the difference between `PATH` and `LD_LIBRARY_PATH`. I have an installation setup that needs a file pkg.tcl and I am not where to add the path to it: should it be to `PATH` or `LD_LIBRARY_PATH`?


32-bit, 64-bit CPU op-mode on Linux

I'm confused. Running Fedora Linux, `lscpu` yields:               Architecture:            i686     CPU op-mode(s):          32-bit, 64-bit     ...      But when I try to install a 64-bit program (Chrome) I get error like: > Package /....x86_64.rpm has incompatible architecture x86_64. Valid > architectures are ['i686', 'i586', 'i486', i386'] I'm less interested in being able to install Chrome and more interested in why `lscpu` says that my CPU can run in 64-bit mode; clearly this can't mean I can run 64-bit programs. Can anyone clarify?


Linux efficient command to find if 32 bit/64 bit

I am trying to figure out the list of possible ways to find out if a Linux machine is 32 bit or 64 bit. **Method 1:** The command **uname -m** will specify if my machine is 32 bit or 64 bit. **Method 2:** I can run the command **getconf LONG_BIT** to find if it is 32 bit or 64 bit. **Method 3:** I can check for the lm bit in the /proc/cpuinfo file. If that bit is not set, then I can say my machine is a 32 bit machine. Which of the above methods is the more accurate way of telling if my machine is a 32 bit machine or 64 bit machine? Or is there any other efficient way/command to find out the same?


Stuck on installing grub to a usb stick (unknown filesystem/no such partition)

I just spend all day on trying to get my system to boot again, I'm getting a bit desperate...snif. The setup is as follows:   * a debian installed in a luks encrypted usb hard disk with lvm volumes for system and swap   * a usb stick with an ext partion for /boot, with grub installed to the mbr of this stick Ok, so I was stupid enough not to have a backup of the usb stick and now I lost it. So I set off recreating /boot on another stick with great difficulty. This is what I have so far booting from a live cd:               # mount everything so we can chroot     vgchange -a y     mount /dev/lvm/system /mnt          # the stick for /boot     mount /dev/sdf1 /mnt/boot     mount -o bind /dev     /mnt/dev     mount -o bind /dev/pts /mnt/dev/pts     mount -o bind /proc    /mnt/proc     mount -o bind /sys     /mnt/sys          chroot /mnt          # get some kernel files in boot     rm /initrd.img     dpkg -i /var/cache/apt/archives/linux-image3.xxxx.deb          apt-get purge   grub-pc     apt-get install grub-pc          # here is the first problem. The usb stick I formatted with palimpsest      # (mbr) and created an ext2 primary partition on it. Grub complains that      # 'your embedded area is exceptionally small, core.img won't fit in it..'          # start over:     fdisk /dev/sdf     o (reformat with dos partition table)     n (new partition)     1 (partition number 1)     2 (set the starting cylinder to 2 in order to have more space behind mbr)     +100MB (size)     w (write results          mkfs -t ext2 /dev/sdf1          # now grub installation works.      When I reboot, I do get grub, but drops to rescue mode with unknown filesystem               >insmod ext2     >ls     hd0 (have nothing but the usb stick on this machine)     >ls hd0     unknown filesystem     > ls (hd0,0/1/msdos1)     all give: no such partition         I have been faffing around for hours now, trying on other machines, trying to change /boot/grub/device.map mainly with /dev/disk/by-id/xxx:0 and xxx:0-part1. No avail, wherever I boot all disks are "unknown filesystem", and all attempts to check a partition give "no such partition" both on the usb stick and on other drives in the machines I test on. The problem is that I don't find any details about the inner workings of grub. I don't even know if device.map is read on boot at all, or if that plays only by the time grub.cnf is being parsed (and thus /boot/grub has already been found). I have the impression that nothing is being read from my stick except the core.img right after the mbr, however I have no idea how core.img knows which partitions to boot from, is that hardcoded in on install? Is the device.map thus important to get right on running grub-install? I also don't know if the partition should be bootable, I suppose not since grub is installed to the drive, but I find little info about all these more detailed issues. Any ideas to get this working are greatly appreciated.


OpenBSD X, mouse only scrolls down

I just got a new OpenBSD 4.8 instance up and running with Xfce. The only issue I'm having is that the mouse wheel only ever scrolls down. When I physically scroll up, X scrolls down. When I do scroll up X seems to page down, as it scrolls much more area than when I scroll down.


Terminal not displaying correctly after quitting Xorg

I am running a fresh arch-linux install (as of 17/07/12) with the ATI catalyst drivers (as mentioned on the wiki page). When I run `xinit`, everything works fine and looks great but when I exit the xsession it doesn't return me to the standard bash terminal correctly. Instead I get what appears to be the top left quarter of the original terminal which is unresponsive apart from the occasional visual corruption when I press keys. What can I do to fix this? **EDIT:** Using `Ctrl`+`Alt`+`F1` shows the same thing.


equivalent to Ubuntu's apport-bug in Fedora or Mint?

What is the Fedora equivalent to the Ubuntu command apport-bug to submit bug reports? In Ubuntu, one can use:               apport-bug <package-name>      For example:               apport-bug xorg      To submit bug reports that include all the logs and relevant information about the system. What is the equivalent in Fedora? How about Mint?


Bash Script Argument Regex Group Conflict

I have a simple bash script:               input_dir="`dirname $1`/`basename $1`/"     output_dir="`dirname $2`/`basename $2`/"     ext=$3     ...     ...     ...     echo -n `rename "-f" "'s/.*([0-9]{11}_[0-9]{11}).*\.(.*$)/$1.$2/'" "$output_dir"*.$ext`      The problem is that it does not work because the match groups `$N` conflict with command line arguments to the script. How can I solve this?


why would typing Ctrl+c twice stop a running process in Linux?

There are Linux programs, for example vlc, that recommend typing `ctrl`+`c` twice to kill their execution from a terminal if the program didn't stop after the first one. Why would typing `ctrl`+`c` twice work when the first time didn't work?


Can I spoof the MAC address in Android?

Is it possible to spoof the MAC address of the wireless interface using `wpa_supplicant.conf` in Android when I connect as a client to an access point? **Edit** Unfortunately, Android doesn't support               ifconfig eth0 hw ether 00:00:00:00:00:00      I've been using               ip link set eth0 address 00:00:00:00:00:00      but that only works temporarily. After I disconnect and reconnect to the access point, the mac resets itself.


Bash script to find and kill a process with certain arguments?

I want a script which kills the instance(s) of `ssh` which are run with the -D argument (setting up a local proxy). Manually, I do `ps -A | grep -i ssh`, look for the instance(s) with -D, and `kill -9 {id}` each one. But what does that look like in bash script form? (I am on Mac OS X but will install any necessary commands via `port`)


How to view a TTF font file?

Is there an application to simply preview a font from a TTF file without installing it?


How to remove LiveCD after installing OS on VirtualBox?

After going through the process of installation of a Unix OS (in this case Mageia) on VirtualBox 4.08, the next step is to remove the LiveCD. Since the LiveCD is virtual, how should one proceed to remove it? Deleting the ISO does not seem like a clean way to do this. Should the setting be changed in the storage section? ![enter image description here](http://i.stack.imgur.com/pYjGd.png)


More doubts in bzImage

The description of the `bzImage` in Wikipedia is really confusing me. ![alt text](http://i.stack.imgur.com/JXbyA.png) The above picture is from Wikipedia, but the line next to it is: > The bzImage file is in a specific format: It contains concatenated > bootsect.o + setup.o + misc.o + piggy.o. I can't find the others (`misc.o` and `piggy.o`) in the image.   I would also like to get more clarity on these object files. The info on this post about why we can't boot a `vmlinux` file is also really confusing me. Another doubt is regarding the `System.map`. How is it linked to the `bzImage`? I know it contains the symbols of `vmlinux` before creating `bzImage`. But then at the time of booting, how does `bzImage` get attached to the `System.map`?


At the root level (/) directory, why is that .. refers to itself?

> **Possible Duplicate:**   >  Why does '/' have an '..' entry? I understand that in the filesystem hierarchy starting with / as top-level directory, under which all the other sub directories or files are stored. In each subdirectory, we see two special directories referred as `.` and `..` which are special because they are hardlinks pointing to the current directory inode and the parent directory inode respectively. They are common for every sub directory in the filesystem. However, when I look at `/`, those two special directories behaviour changes. They refer to the `/` again. For example:               [root@centos /]# pwd     /     [root@centos /]# ls -ldi . ..     2 drwxr-xr-x 26 root root 4096 Dec  3 16:53 .     2 drwxr-xr-x 26 root root 4096 Dec  3 16:53 ..     [root@centos /]# cd root     [root@centos ~]# ls -ldi . ..     195265 drwxr-x--- 10 root root 4096 Dec  3 20:33 .          2 drwxr-xr-x 26 root root 4096 Dec  3 16:53 ..     [root@centos ~]#       I want to understand what part of the filesystem controls this? But how is this done in detail. Can someone please explain this behaviour? (Let me guess, this is part of the kernel's filesystem management routines). I have my own theory about this but would like to listen more from the experts here. Cheers.


Why iptables does not fetch information from /etc/sysconfig/iptables on centOs?

I'm new in Linux and encountered with problem with iptables. Here is content of /etc/sysconfig/iptables file               # Generated by iptables-save v1.4.7 on Tue Nov 27 21:41:04 2012     *filter     :INPUT ACCEPT [0:0]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [40672:2356787]     -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT      -A INPUT -p icmp -j ACCEPT      -A INPUT -i lo -j ACCEPT      -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT      -A INPUT -j REJECT --reject-with icmp-host-prohibited      -A FORWARD -j REJECT --reject-with icmp-host-prohibited      COMMIT     # Completed on Tue Nov 27 21:41:04 2012      But when I try "sudo iptables -L -n -v -x" I have following output:               Chain INPUT (policy ACCEPT 261172 packets, 1040204290 bytes)         pkts      bytes target     prot opt in     out     source               destination                   Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)         pkts      bytes target     prot opt in     out     source               destination                   Chain OUTPUT (policy ACCEPT 522761 packets, 2080465034 bytes)         pkts      bytes target     prot opt in     out     source               destination        Why doesn't the rules from /etc/sysconfig/iptables displayed in output?


Bash: logical operators precedence &&, ||

I am trying to understand how the logical operator precedence works in bash. For example, I would have expected, that the following command does not echo anything.               true || echo aaa && echo bbb      However, contrary to my expectation, `bbb` gets printed. Can somebody please explain, how can I make sense of compounded `&&` and `||` operators in bash?


grub on floppy to rescue CD boot chain

I am having trouble figuring out how to have grub installed on a floppy in a way that it automatically boots a modified Ubuntu 12.04 CD on startup. I will settle for knowing some commands at the grub prompt if automation is asking for the impossible. The CD is bootable, but the system this is made for doesn't have a BIOS option to boot from CD (or USB), it can only boot from floppy or hard drive. * * * Background: This is a system located remotely, and I would like to have something where I can tell the owner if there are problems: insert floppy and CD and reboot. The modifications to the CDs are such that openssh-server is installed, my public ssh key in /root/.ssh/authorized_keys2, ssh is listening on an additional port number as those < 1024 are blocked by the local provider and the system retrieves a page on my server (so I can find the IP address to connect to for remote maintenance). The CD works fine when testing in a VirtualMachine. There is a keyboard and monitor and I can ask the owner to type in a few commands. I first looked at using grub2 but there are many incorrect how-to about them and the command-line options for grub2 seem to have been changed a lot of times (`\--diet` and `\--overlay`, often mentioned, are no longer there). There is a bug report about grub2 output not fitting on floppy and that was closed recently. So I build grub2 from the repository (version 2.0) including the required new version of xorriso. The result of               grub-mkrescue --compress=xz -o grub-rescue.vfd      is a 4.4Mb Image, which of course does not fit on a floppy at all, so I dropped that as a viable path to explore. I have tried a grub legacy on floppy (0.97), but cannot use `find` from the grub prompt to find anything on the CD, nor use something `chainloader (hd1)`. The grub (0.9x) manual has nothing to say about booting an iso image. I rather not install something on the hard drive and go the boot route FD -> HD -> CD as this whole setup is needed in the first place if the hard drive has problems.


Non-administrative network-related tools

I know there are tools to inspect packets (e.g. wireshark) or to simulate latency/packet loss (e.g. netem), but they all seem to require administrative permissions to inspect/modify packets. I'm looking for something which could intercept packets for a single application and be usable by a standard (non-root) user. I'd like some kind of `valgrind` tool for network, where you use it to wrap your application and it intercepts network requests to inspect/modify them. My main use case is to enable students to use such tools on university computers in a simple way (i.e. without needing virtual machines or support from the administrators). Do such tools exist? Otherwise, what prevents them from actually existing in the first place? Note: tools such as `setcap`, which need to be configured by system administrators and may grant too many powers to the users (e.g. inspecting every packet, and not just the ones generated by their applications) aren't suitable. **Edit** : OK, so after some research, I found out about the LD_PRELOAD trick, which could be used as a poor man's wrapper to intercept specific library functions (e.g. `connect`, `sendto`, etc.) and count/modify packets. Apparently the reason why there are not so many non-root tools based on this is because:   * it's not useful for security purposes (it can be easily circumvented), and   * most people during useful things with network already need root access anyway, so outside very specific applications tailored for learning, there is no real demand. But this is technically feasible, in case any curious students are willing to develop such applications themselves. Another technique would be to code a valgrind plug-in to deal with this and use valgrind to run the program. But it seems way overkill, so no sane people have done it. Could someone more knowledgeable than me just confirm if my previous statements are correct?


How to estimate server's network connection quality with traceroute?

I need to estimate network connectivity of various dedicated server hosting providers, e.g. how fast and uniform will my services perform when hosted there. I use `traceroute` command on my home computer to check the servers that are hosted by the provider; if I don't know any, then I `traceroute` their homepage (I know it might not be on the same network; it's a guess) Intuitively I aim for:   1. minimum number of hops,   2. minimum roundtrip time both for the target and intermediate nodes,   3. and lack of _stars_ : ![*stars*: traceroute soyoustart.com](http://i.stack.imgur.com/B070Q.png) Are all these metrics relevant for general web service hosting? What do _stars_ mean and should I really avoid them?


What could cause my bash history to be cleared unexpectedly?

Today I noticed that my bash history is cleared completely. I have neither executed `history -c` nor deleted the `.bash_history` file. Apart from deleting the `.bash_history` file and `history -c`, how can bash history be cleared?


Do applications usually use dynamic linked libraries?

If I want to compile an application which needs packages that are not provided by distribution's package manager and I want to generate a distribution package from it, do users who use this distribution package need all those extra libraries installed or will these libraries packed into the binary? I know that it could depend from application to application but how can I recognize if a package needs dynamic linked libraries?


AppArmor profiles in Docker/LXC

I have a Docker container (LXC) which runs MySQL. Since the idea behind Docker is generally "one running process per container," if I define AppArmor profiles targeting the MySQL binary, will they be enforced? Is there a way for me to test for this?


What role does krb5.conf actually play when joining a Linux machine to AD via Samba/winbind?

I'm working on a project for a standardized Linux image for our organization. This image will be domain joined, and I've written a script to fire on boot that will guide the IST person doing the Linux machine setup through the join. Pretty much every guide I have seen states that you must edit krb5.conf to reflect your AD domain's structure. However, there's not much information as to _why_ this is necessary, and I've found that I am able to perform domain joins via net ads (instead of net rpc) without altering krb5.conf at all, in both Ubuntu 12.04/14.04 and CentOS 6.5. This has been true in both Samba 3 and Samba 4; our AD backend I believe is now entirely Server 2k8 and has been since before I started this project. Further, I'm able to set pam_winbind with the krb5auth option, and it properly creates the kerberos ticket in /tmp; wbinfo -K also works fine and creates a Kerberos ticket. So, my question really is - what does krb5.conf do that I'm missing? What impact will there be if it's not configured? Is it just going to be that programs using Kerberos to authenticate will not be able to do so, or is there some other subtler point that I'm not aware of (such as winbind falling back to an insecure RPC based auth method if krb5.conf is not correct?)


nmap ipv6 os scan fails

When scanning a ubuntu machine with nmap using ipv6 address, nmap cannot determine the os type and only print the os fingerprint. Although when scanning the same host with ipv4 address it correctly detects it as being linux machine. Does anybody know why?


Cannot locate libncurses.so location when running a file

I'm trying to run a file name remote build which is to build a package on a target server. My target server is HP-UX-itanium 64 bit. When I run the remote build, somehow it cannot find `libncurses.so` or maybe it looks for the `libncurses.so` at some other location. This only happens on HP-UX itanium, while other server like Solaris, HP-UX-mp 32 bit, and other Unix platform can run the file smoothly. This is the error code:               libtool: link: gcc -g -O2 -o test_setpwnam test_setpwnam.o setpwnam.o  -L/usr/local/lib/hpux32 -lncurses -lsec -ldl -lpam -lpthread -Wl,+b -Wl,/usr/local/lib     /usr/bin/make  check-TESTS     /usr/lib/hpux32/dld.so: Unable to find library 'libncurses.so'.      I don't know why it keep looking into `_/usr/lib/hpux32_` when I think I have the code look into `/usr/local/lib/hpux32"_` (the `libncurses.so` is located in that directory). This is part of the remote build code which I think is related.               #!/usr/bin/perl          my $remote_uname = `ssh $USER\@$host uname -a`;     chomp($remote_uname);     my $local_uname = `uname -a`;     chomp($local_uname);     my $homepath = "/home";     my $build = "";     my $configure_param = " --with-ncurses --disable-openssl --disable-thread-support --disable-shared --disable-protoc";     my $gzip = "gzip";     my $configure_env = "PATH=\$PATH:/usr/local/bin:/usr/local/lib/hpux32 CPPFLAGS=-I/usr/local/include libevent_cv_getaddrinfo=no";     my $make_env = "PATH=\$PATH:/usr/local/bin";     my $whoami = "whoami";          } elsif ($remote_uname =~ /^HP-UX/) {         $build = "cd mypackage-$version/package/hpux && sh ./build.sh";         $gzip = "/usr/contrib/bin/gzip";         $configure_param .= " --with-ncurses";         $configure_env .= " LDFLAGS=\"-L/usr/local/lib/hpux32\""; //aint this the part where I'm suppose to specify the search?         die "Unknown remote uname [$remote_uname]";     }          rmake "rm -rf mypackage-${version}*";     make "scp mypackage-$version.tar.gz $USER\@$host:$homepath/$USER";     rmake "$gzip -dc mypackage-$version.tar.gz | tar xvf -";     rmake "cd mypackage-$version && $configure_env ./configure $configure_param && $make_env make && $make_env make check";     rmake $build;      This is my first time doing debug on perl code, so please excuse me if what I conclude is wrong.


Given a kernel ATA exception, how to determine which physical disk is affected?

I woke up this morning to a notification email with some rather disturbing system log entries.               Dec  2 04:27:01 yeono kernel: [459438.816058] ata2.00: exception Emask 0x0 SAct 0xf SErr 0x0 action 0x6 frozen     Dec  2 04:27:01 yeono kernel: [459438.816071] ata2.00: failed command: WRITE FPDMA QUEUED     Dec  2 04:27:01 yeono kernel: [459438.816085] ata2.00: cmd 61/08:00:70:0d:ca/00:00:08:00:00/40 tag 0 ncq 4096 out     Dec  2 04:27:01 yeono kernel: [459438.816088]          res 40/00:00:00:4f:c2/00:00:00:00:00/40 Emask 0x4 (timeout)     Dec  2 04:27:01 yeono kernel: [459438.816095] ata2.00: status: { DRDY }       (the above five lines were repeated a few times at a short interval)     Dec  2 04:27:01 yeono kernel: [459438.816181] ata2: hard resetting link     Dec  2 04:27:02 yeono kernel: [459439.920055] ata2: SATA link down (SStatus 0 SControl 300)     Dec  2 04:27:02 yeono kernel: [459439.932977] ata2: hard resetting link     Dec  2 04:27:09 yeono kernel: [459446.100050] ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)     Dec  2 04:27:09 yeono kernel: [459446.314509] ata2.00: configured for UDMA/133     Dec  2 04:27:09 yeono kernel: [459446.328037] ata2.00: device reported invalid CHS sector 0       ("reported invalid CHS sector 0" repeated a few times at a short interval)      I make full nightly backups of my entire system to an external (USB-connected) drive, and the above happened right in the middle of that backup run. (The backup starts at 04:00 through cron, and tonight's logged completion just before 04:56.) The backup process itself claims to have completed without any errors. There are two internally connected SATA drives and two externally (USB) connected drives on my system; one of the external drives is currently dormant. I don't recall off the top of my head which physical SATA ports are used for which of the internal drives. When googling I found the AskUbuntu question Is this drive failure or something else? which indicates that a very similar error occured after 8-10 GB had been copied to a drive, but the actual failure mode was different as the drive switched to a read-only state. The only real similarity is that I did add on the order of 7-8 GB of data to my main storage last night, which would have been backed up around the time that the error occured. `smartd` is not reporting anything out of the ordinary on either of the internal drives. Unfortunately smartctl doesn't speak the language of the external backup drive's USB bridge, and simply complains about `Unknown USB bridge [0x0bc2:0x3320 (0x100)]`. Googling for that specific error was distinctly unhelpful. My main data storage as well as the backup is on ZFS and `zpool status` reports 0 errors and no known data errors. Nevertheless I have initiated a full scrub on both the internal and external drives. It is currently slated to complete in about six hours for the internal drive (main storage pool) and 13-14 hours for the backup drive. It seems that the next step should be to determine which drive was having trouble, and possibly replace it. The `ata2.00` part _probably_ tells me which drive was having problems, but **how do I map that identifier to a physical drive?**


Kernel 3.12 or 3.10? which one has more features, newer and better?

Based on https://www.kernel.org/ kernel 3.12 is released in 2014-04-23 and kernel 3.10 is released in 2014-04-27. Based on release date, 3.12 is older and based on version number 3.10 is older. Which one is newer? Which one has more features? **Does 3.12 have 3.10 features?**


How to use fslint (in particular findnl) on the command line to actually mimic the behavior of the fslint-gui?

So I am trying the `fslint` tools. However, the help included in those tools as well as the `man` page don't indicate that the cleanup actions offered by the `fslint-gui` are also available through `fslint` (CLI) or the individual tools. I am trying to use `findnl` in particular, and there is no indication of it being able to automatically rename files:               $ /usr/share/fslint/fslint/findnl --help     find Name (directory or file) Lint.     Usage: findnl [-1] [-2] [-3] [-p] [[-r] [-f] paths(s) ...]          These options are mutually exclusive (i.e. only the last one takes effect).     -1 is least checking, -3 is most. The default is 2.          -p is most stringent and applies POSIX.1 filename portability testing.     I.E. characters are limited to [A-Za-z0-9_.-] and max name length = 14 and     max path length = 255.          If no path(s) specified then the currrent directory is assumed.      It seems to exist for `findup` though (the `-d` for example):               $ /usr/share/fslint/fslint/findup --help     find dUPlicate files.     Usage: findup [[[-t [-m|-d]] | [--summary]] [-r] [-f] paths(s) ...]          If no path(s) specified then the currrent directory is assumed.               When -m is specified any found duplicates will be merged (using hardlinks).     When -d is specified any found duplicates will be deleted (leaving just 1).     When -t is specfied, only report what -m or -d would do.          [...]      Does anyone know how to use those tools (emphasis on the plural!) on the command line? I've searched before writing up this question and all I came up with was - depending on the tool - no answer at all (or not better than the vague and brief help) or something tailored to a specific use case that didn't apply and also didn't allow me to generalize the example in any way. I realize that maybe I overlooked it, but then it probably means it's not mentioned prominently enough and this question (and subsequent answers) will help other internauts in the future.