read only root filesystem

Somehow my Debian went to read only in root file system. I have no idea how this could have happened.   For example when I am in `/root` folder and type command `nano` and after that press `Tab` to list possible file in that folder I get the message:               root@debian:~# nano -bash: cannot create temp file for here-document: Read-only file system      The same for the `cd` command when I type `cd /home` and press `Tab` to list paths I have this:               root@debian:~# cd /home -bash: cannot create temp file for here-document: Read-only file system      I also have problems with software like `apt` and others. Can't even apt-get update. I have a lot of errors like this:               Err http ://ftp.de.debian.org wheezy-updates/main Sources     406  Not Acceptable     W: Not using locking for read only lock file /var/lib/apt/lists/lock     W: Failed to fetch http ://ftp.de.debian.org/debian/dists/wheezy/Release  rename failed, Read-only file system (/var/lib/apt/lists/ftp.de.debian.org_debian_dists_wheezy_Release -> /var/lib/apt/lists/ftp.de.debian.org_debian_dists_wheezy_Release).     W: Failed to fetch http ://security.debian.org/dists/wheezy/updates/main/source/Sources  404  Not Found     W: Failed to fetch http ://security.debian.org/dists/wheezy/updates/main/binary-amd64/Packages  404  Not Found     W: Failed to fetch http ://ftp.de.debian.org/debian/dists/wheezy-updates/main/source/Sources  406  Not Acceptable     E: Some index files failed to download. They have been ignored, or old ones used instead.     W: Not using locking for read only lock file /var/lib/dpkg/lock      I have a lot of problems in the system. Is it possible to fix that? How can I check what happened? What should I look for in the logs? I know it could be because of the line in `/etc/fstab` file:               /dev/mapper/debian-root /               ext4    errors=remount-ro 0       1      but what is the problem? I can't find nothing or maybe I don't know where to look. Edit: I did search messages logs and found only this:               kernel: [    5.709326] EXT4-fs (dm-0): re-mounted. Opts: (null)     kernel: [    5.977131] EXT4-fs (dm-0): re-mounted. Opts: errors=remount-ro     kernel: [    7.174856] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: (null)      I guess it's correct, because I have the same entries on other debian machines. I found something in dmesg (I cut that output a bit because was a lot standard ext4 things)               root@gs3-svn:/# dmesg |grep ext4     EXT4-fs error (device dm-0) in ext4_reserve_inode_write:4507: Journal has aborted     EXT4-fs error (device dm-0) in ext4_reserve_inode_write:4507: Journal has aborted     EXT4-fs error (device dm-0) in ext4_dirty_inode:4634: Journal has aborted     EXT4-fs error (device dm-0): ext4_discard_preallocations:3894: comm rsyslogd: Error loading buddy information for 1     EXT4-fs warning (device dm-0): ext4_end_bio:250: I/O error -5 writing to inode 133130 (offset 132726784 size 8192 starting block 159380)     EXT4-fs error (device dm-0): ext4_journal_start_sb:327: Detected aborted journal      5 errors and 1 warning. Any ideas? Is it safe to use mount -o remount,rw / ?


How to get the name of the user that launched `sudo`

My problem: I have a Python program, and the user launch it using `sudo`. Sometimes I have to get the user's home, and I can do this only knowing its name:               import pwd          pwd.getpwnam(username)      So: how can I get the name of the user that launched the program?


Create ssh root password

For some reason, after a plesk update, I can no longer login to ssh as root using my old password. I have tried to create a user with: > /bin/bash & /bin/bash (chrooted) in plesk Which lets me login but has no root privileges. How can I either recover my old password or get access to the ssh config to check whether root login is disabled. I installed ssh term in plesk, but that bums out with an error of: > jarsigning exception Guess it's because there is only the default certificate on the server. I would be grateful if someone could help with this as I have reached a point where I am struggling to find other things to try. Many thanks Plesk 11.5 CentOS 6 SSH Client


"or" in shell glob

I want to ls the files containing the substring "s1r", "s2r", "s3r" or "s19r" in their filenames. I'm almost there! Botched attempts:               ls *s[123][9?]r*      The above gives me only files including the substring > s19r While               ls *s[1-3]|[19]r*      returns > -bash: [19]r*: command not found > > ls: *s[1-3]: No such file or directory That is, it does not recognize the or | operator - which makes sense as it is also used to pipe. How do I ls the files containing "s1r", "s2r", "s3r" or "s19r"?


Multiple option arguments using getopts in bash

I am trying to process command line arguments using `getopts` in bash. One of the requirements is for the processing of an arbitrary number of option arguments (without the use of quotes). 1st example (only grabs the 1st argument)               madcap:~/projects$ ./getoptz.sh -s a b c     -s was triggered     Argument: a      2nd example (I want it to behave like this but without needing to quote the argument"               madcap:~/projects$ ./getoptz.sh -s "a b c"     -s was triggered     Argument: a b c      Is there a way to do this? Here's the code I have now:               #!/bin/bash     while getopts ":s:" opt; do         case $opt in         s) echo "-s was triggered" >&2            args="$OPTARG"            echo "Argument: $args"            ;;            \?) echo "Invalid option: -$OPTARG" >&2            ;;         :) echo "Option -$OPTARG requires an argument." >&2            exit 1            ;;         esac     done      Note that I want to support multiple flags this way, e.g.               madcap:~/projects$ ./getoptz.sh -s a b c -u 1 2 3 4     -s was triggered     Argument: a b c     -u was triggered     Argument: 1 2 3 4


Direct recursive shell script output to each subdirectory, not parent directory

I'm processing a batch of subjects data recursively, calling the script within the parent directory. For example, I have the parent directory:               /home/subjects      and the subdirectories which contain the data:               /home/subjects/0393     /home/subjects/0389     /home/subjects/9920 (Around 250 subjects)      Each file in each subdirectory has the file extension ".nii". I have composed a code, which calls a number of commands from a neuroscience program, searching for that particular file extension as the input. The input to the first command "fslroi" is the .nii file ($file), while the output file of that command is "rawdata.nii". As you can see the output from one command, is the input to the next etc               for file in $(find ./ -name "*.nii")     do     fslroi $file rawdata.nii 0 33     gunzip rawdata.nii.gz -f     fslroi rawdata.nii rawnodif 0 1     bet rawnodif rawnodif_brain -m -g 0.2 -f 0.3     fslmaths rawnodif -mas rawnodif_brain_mask rawnodif_brain     gunzip rawnodif_brain_mask.nii.gz -f     done      However, this code is inadequate as I am unable to save the output into the particular subdirectory. Thus, as I am processing several subjects the code will not work as everything is being saved to the parent directory. Could someone please be able to give me any hints to how I can modify the code to save the output according to the input ".nii" file?


Does AppArmor decrease the system performance? I have a slow system (900 MHz CPU) which has AppArmor because it was installed by default I would like to know if it become faster if I remove it, security is less important than performance on that system.


Why is my swap not being activated automatically via fstab?

I've got a Linux embedded system that I'm experimenting with (the Elektor Embedded Linux Made Easy board, based on the GNUBLIN http://en.gnublin.org/index.php/GNUBLIN-Elektor). I'm using the 3.3 kernel provided by them (http://en.gnublin.org/index.php/Kernel_compile_%2B_Module_installation), which I've configured and compiled myself. I built the root file system myself using buildroot. I've been experimenting with swap on this board (it's only got 8MB RAM!) and I've got it working. However I can't seem to get the system to automatically mount and activate the swap via fstab. My swap is implemented as a dedicated partition on the microSD card (mmcblk0p4). Here is my fstab:               # /etc/fstab: static file system information.     #     # <file system> <mount pt>     <type>   <options>         <dump> <pass>     /dev/root       /              ext4     rw,noauto         0      1     /dev/mmcblk0p1  /media/mmc_1   ext2     defaults          0      0     /dev/mmcblk0p4  none           swap     auto              0      0     proc            /proc          proc     defaults          0      0     devpts          /dev/pts       devpts   defaults,gid=5,mode=620   0      0     tmpfs           /dev/shm       tmpfs    mode=0777         0      0     tmpfs           /tmp           tmpfs    mode=1777         0      0     sysfs           /sys           sysfs    defaults          0      0      swap works, because if I enter `swapon -a` in the command line, it becomes activated, as reported by `free`. But it just won't activate automatically on boot. My other entries in fstab work fine - for example, /dev/mmcblk0p1 is auto mounted correctly on boot. I've pasted the output of the boot process here: http://pastebin.com/0qQ4RAd8 Any thoughts?


Headless Debian Server + Windows Clients + X11 Forwarding

I have a headless debian server that I SSH into regularly. I want to know set it up so that users can ssh in and then run something like iceweasel, and a window will popup on their machine which is the browser window. I don't want to install KDE or Gnome or anything like that on the server. I have tightvncserver running on the server, and a vnc client on the windows machine. However, when I connect I get the following message: > Xsession: X session started for myuser at Wed Mar 28 15:41:39 EDT 2012 > Xsession: unable to start X session --- no "/home/myuser/.xsession" file, no > "/home/myuser/.Xsession" file, no session managers, no window managers, and > no terminal emulators found; aborting. What am I missing? I feel I am a bit confused with ssh+vnc, and how it all works together. Should the client use putty to connect first? then try and vnc in separately outside of putty? Any help would be great!


How to disable multiple logins in GNOME?

Basically, I want to disable multiple logins. The family laptop (not mine) has a problem with the x server -- at least it seems to be the x server. When two users are logged in simultaneously the x-server fails to start for the one who was logged in first. Having two users logged in seems to steal processor speed anyway. So I want to disable people from choosing 'switch user' over 'log out (username)' or 'shut down'.


Dual Monitor Issues

Two screens Home screen is on right. Blank home screen on left. Mouse will go from left to right and right to left correctly. Trying to get home screen to the left screen and let the right screen be the blank home screen.


How can I copy a subset of files from a directory while preserving the folder structure?

I want to move some subset of files from dirA to dirB (let's say files with "blah" in the filename), but I want all the nested directories to be the same in the new location. How can I do that?


Unix gunzip decompression

So this is a very annoying problem, I have a file in the Linux terminal               ERR091571_1.fastq.gz      And I run gunzip on it to decompress the file...               gunzip ERR091571_1.fastq.gz      But all that happens is it enters to a new line, and I have to cntrl + C to exit with nothing being done to my compressed file. What am I doing wrong here??


Script runs manually but not from cron

As per the monitoring of my mysql replication status. I wrote a simple shell script with the following code               #!/bin/bash     date > /tmp/mysql_repl_status.txt     cd /usr/bin/     "/usr/bin/mysql" "-e" "SHOW SLAVE STATUS \G" >> /tmp/mysql_repl_status.txt     mail -s "Netspective MySQL replication status" name@abc.com < /tmp/mysql_repl_status.txt      The issue is when i execute this script manually it works fine, but using cron the script not works. Using cron got the mail with the output of date command only. What is wrong with my side?


How to set window size and location of an application on screen via command line?

I want Firefox window to be opened in a specific size, and location on screen using a shell command, for example:               firefox myfile.html size 800x600 location bottom-left      Is there such a command?


How to get alt+right mouse to resize windows again!

I'm frustrated that this was removed/altered in gnome-shell3. There are certain key bindings for resizing and moving windows like alt+right click etc, that I'd like back. I've tried to use the system settings but to no avail. Has anyone else worked with this and got it to work?


LFS 7.5 - Glibc-2.19 compile errors at section 6.9, are they fatal to my LFS build?

I am using a host Ubuntu 14.04 system, and I am currently going through the Linux From Scratch guide here. At section 6.9, http://www.linuxfromscratch.org/lfs/view/stable/chapter06/glibc.html, after compiling and testing glibc-2.19 I have received the following errors:               make[2]: *** [/sources/glibc-build/libio/tst-ftell-partial-wide.out] Error 1     make[1]: *** [libio/tests] Error 2     make[2]: *** [/sources/glibc-build/posix/tst-getaddrinfo4.out] Error 1     make[2]: [/sources/glibc-build/posix/annexc.out] Error 1 (ignored)     make[1]: *** [posix/tests] Error 2     make[2]: [/sources/glibc-build/conform/run-conformtest.out] Error 1 (ignored)     make: *** [check] Error 2      A better formatted paste is at pastebin: http://pastebin.com/qTCM1Rif So far there was no other issues before this chapter, and I don't think there are any other problems. Can these errors be safely ignored, and what are the causes of these errors? There might be a timeout factor involved, I am going to retry the tests with:               TIMEOUTFACTOR=16 make -k check 2>&1 | tee glibc-check-log      To see if the errors will clear up. Will post results when complete


Loss of .eps file quality after using scp to transfer from remote server

When I scp (secure copy protocol) a .eps image file (generated using IDL) from a remote server to my desktop, the image seems to be of a lowered resolution and "choppy". Strangely, when I transfer from one remote server to another I do not have this problem. How can I maintain image quality while transferring such files to my desktop?


How to quickly send commands to nested tmux sessions?

I have the following in my .tmux.conf               set -g prefix M-j     bind-key j  send-prefix      I need to press (`Atl`+`J`) + (`J`) + bound-key to send something to the nested tmux session. I feel it is rather slow. Is there any better way? For example, I would love to be able to do (`Alt`+`J`) + (2x bound-key) to do stuff in the nested session. I constantly execute commands in the top tmux session instead of executing them in the nested one. Also, how come everybody binds `prefix` to `C-a`? I find it awfully slow and unpleasant to type this combination. Am I missing something?


Sending signal to user that a partricular driver is loaded

These are some of the messages coming on console from Microzed board (Cortex A9):               [Sat May 17 18:18:26.603 2014] DMA: preallocated 256 KiB pool for atomic coherent allocations     [Sat May 17 18:18:26.603 2014] xgpiops e000a000.ps7-gpio: gpio at 0xe000a000 mapped to 0xf004e000     [Sat May 17 18:18:26.603 2014] usbcore: registered new interface driver usbfs     [Sat May 17 18:18:26.624 2014] usbcore: registered new interface driver hub     [Sat May 17 18:18:26.624 2014] usbcore: registered new device driver usb     [Sat May 17 18:18:26.624 2014] Switching to clocksource xttcps_clocksource     [Sat May 17 18:18:26.624 2014] e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 82) is a xuartps     [Sat May 17 18:18:26.624 2014] console [ttyPS0] enabled     [Sat May 17 18:18:26.634 2014] xdevcfg f8007000.ps7-dev-cfg: ioremap f8007000 to f0052000 with size 100     [Sat May 17 18:18:26.662 2014] xqspips e000d000.ps7-qspi: master is unqueued, this is deprecated     [Sat May 17 18:18:26.662 2014] spi spi32766.0: setup: unsupported mode bits 3     [Sat May 17 18:18:26.662 2014] xqspips e000d000.ps7-qspi: can't setup spi32766.0, status -22     [Sat May 17 18:18:26.662 2014] spi_master spi32766: spi_device register error /amba@0/ps7-qspi@e000d000/ps7-qspi@0     [Sat May 17 18:18:26.662 2014] xqspips e000d000.ps7-qspi: at 0xE000D000 mapped to 0xF0054000, irq=51     [Sat May 17 18:18:26.671 2014] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver     [Sat May 17 18:18:26.680 2014] ULPI transceiver vendor/product ID 0x0424/0x0007      After the line:               [Sat May 17 18:18:26.624 2014] usbcore: registered new device driver usb      I want to inform that yes USB driver is indeed loaded. One way I though would be to light an LED immediately after this line is printed on the console. But how do I do this? Is there any other better way of doing this? Main requirement is to measure the timing right from power ON to the USB driver loaded. This can be done if I get any signal on the board the moment USB driver is loaded. I will capture this signal along with power ON, and this will give me precise information about the time USB is loaded. This precision cannot be achieved by looking at the time stamps in log file since the messages do not come immediately and there is considerable time spent before the message start coming.


How to enable nagios user created by yum to use check_by_ssh

I've used `yum install nagios` on an Amazon Linux instance, and it created a nagios user with shell `/sbin/nologin` and homedir `/var/spool/nagios`. This is the behaviour on EC2. I want to use `check_by_ssh` running locally as user `nagios` to execute a command on the remote host as some user, without typing in a password. So using `ssh-keygen` seems logical, but how do I generate a public key for user `nagios` if that user doesn't have a shell? Is the answer to change the default shell (e.g. to bash) and perhaps the homedir of local user `nagios` so I can generate the key, or is there another way?   * Question: Is it bad practice to allow the `nagios` user to login?   * Question: Is it bad practice to change the homedir, e.g. to /home/nagios?   * Question: What is the recommended way of doing this?


No wired ethernet connection

I'm using elementary OS (based on Ubuntu 12.04) and yesterday I woke up to no wired ethernet connection. As far as I can remember I changed absolutely nothing, it was working at night and not anymore the next morning. If I plug in my USB wi-fi antennae it picks it up immediately so it's not my connection/modem. If I start my PC with Ubuntu ethernet works fine so it's not something physically broken. Here are some outputs:               $ifconfig -a     lo        Link encap:Bucle local                 Direc. inet:127.0.0.1  Másc:255.0.0.0               Dirección inet6: ::1/128 Alcance:Anfitrión               ACTIVO BUCLE FUNCIONANDO  MTU:16436  Métrica:1               Paquetes RX:2279 errores:0 perdidos:0 overruns:0 frame:0               Paquetes TX:2279 errores:0 perdidos:0 overruns:0 carrier:0               colisiones:0 long.colaTX:0                Bytes RX:201028 (201.0 KB)  TX bytes:201028 (201.0 KB)          wlan0     Link encap:Ethernet  direcciónHW 00:25:9c:a4:32:51                 Direc. inet:192.168.1.101  Difus.:192.168.1.255  Másc:255.255.255.0               Dirección inet6: fe80::225:9cff:fea4:3251/64 Alcance:Enlace               ACTIVO DIFUSIÓN FUNCIONANDO MULTICAST  MTU:1500  Métrica:1               Paquetes RX:53991 errores:0 perdidos:0 overruns:0 frame:0               Paquetes TX:43111 errores:0 perdidos:0 overruns:0 carrier:0               colisiones:0 long.colaTX:1000                Bytes RX:57986158 (57.9 MB)  TX bytes:16845669 (16.8 MB)               $sudo ethtool eth0     Settings for eth0:     Cannot get device settings: No such device     Cannot get wake-on-lan settings: No such device     Cannot get message level: No such device     Cannot get link status: No such device     No data available          $sudo dhclient eth0     Cannot find device "eth0"      My `/etc/network/interfaces` file contains:               auto lo     iface lo inet loopback      So there's definitely something wrong with my `eth0` settings but I just don't know how it is or how to fix it. Any help will be much appreciated. * * * **Add** Here's the output from `sudo lshw -c network -sanitize`:                 *-network NO RECLAMADO              descripción: Ethernet controller            producto: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller            fabricante: Realtek Semiconductor Co., Ltd.            id físico: 0            información del bus: pci@0000:04:00.0            versión: 06            anchura: 64 bits            reloj: 33MHz            capacidades: pm msi pciexpress msix vpd bus_master cap_list            configuración: latency=0            recursos: ioport:d000(size=256) memoria:d0004000-d0004fff memoria:d0000000-d0003fff       *-network            descripción: Interfaz inalámbrica            id físico: 1            información del bus: usb@1:5            nombre lógico: wlan0            serie: [REMOVED]            capacidades: ethernet physical wireless            configuración: broadcast=yes driver=rt2800usb driverversion=3.2.0-60-generic-pae firmware=0.29 ip=[REMOVED] link=yes multicast=yes wireless=IEEE 802.11bg      where "NO RECLAMADO" means "NOT CLAIMED".


Related to this question on StackOverflow, I am wondering if there is a way for me to flush the NFS cache / force Linux to see the most up-to-date copy of a file that's on an NFS share. I have a situation where four Apache servers mount the same directory via NFS, and when one server make a change to a file, it takes about 5 - 10 seconds for the other servers to see that change. If a second change is made to that file within this window, it may overwrite the first change. The `fstab` entry for the filesystem is:               172.16.1.15:/home               /media/home     nfs     vers=3,defaults,noauto,sync,acregmin=1          0       0      Is there a command which will force Linux to flush cache of one file on an NFS share?


Command for swap info in HPUX itanium and HPUX PARISC?

I need to get commands for swap information in HPUX (both Itanium and PARISC) somebody please help.


Tunnel openwrt requests

I am pretty new to OpenWrt what I want to achieve is the following scenario: I have a socks5 proxy server running on a machine witch is at work. From my home I wish to configure my router who is running OpenWrt to forward all connections to the socks5 proxy server Is this possible using OpenWrt. If it is how can I do it ?


Internet sharing with iptables: choosing which connection to share

I have a computer with two network devices (`eth0` and `wlan0`), both connected to the internet (two different connections/isp). I'm trying to share the connection of `wlan0` to another computer connected via ethernet to `eth0`. What I'm doing is:               # sysctl net.ipv4.ip_forward=1     # iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE      From the client computer I can then connect to this one, but the internet connection that gets shared is the one on `eth0` and not the one on `wlan0`. If I disable the internet connection on `eth0` (by setting no gateway), then the connection to be shared is the one on `wlan0`. However, I'd like to have both internet connections enabled and specify to iptables which one to share. Is this possible? What am I missing? Do I need some forwarding rule?


Internetless/Remote Arch Install

Don't have a WiFi card compatible with any modules for Linux or Ethernet, but I do have working OS X install with WiFi. Do have brew on OS X, and it being OSX, most Linux programs will run. How can I install Arch in this scenario? What are my install options? I have heard If I am running a existing Linux install (not sure if BSD/Darwin counts, hoping it does) I can do a install without booting to **LIVE ARCH LINUX DISK**. Will I have hope? I don't need wifi, I just need it installed with packages!


How to rename pattern in one file to another over several directories recursively

I have several directories through which I want to recursively iterate over and change the file name of > *.GEOT14246.* to > *.GEOT15000.* Is there a one liner on the bash script to do this or do I have to the write a script with a for loop. My try (which doesn't work) is below:               #!/bin/bash          for file in `find . -type f -name "*.GEOT14246.*"`       do         echo "file = $file"         mv $file *.GEOT15000.*     done      I then call with:               cd /path/to/script/     sh ./script1.sh /path/to/starting/dir      Obviously this doesn't work because I don't think I'm passing the starting directory path as an argument. I'm very new to Unix, so how can I pass arguments to it to say from which directory it should start searching and how do I get the script to work?


Background Tasks on Multicore machine?

Say I have a dual core cpu running linux. If I start two single threaded processes (nodejs) in the background, how are they scheduled? Can I assume that the OS will as best as it can, attempt to have each process run on different cores, or do I have do something different?


long format of ps command in Solaris

Jobs with a long command-line is not printing in Solaris:                  bash-3.2$ /usr/ucb/ps auxwww | grep ftf | awk '{print $NF}' | head -5       /proj/cmp01/app/btws/cfg/btw       /proj/cmp01/app/btws/cfg/btw       /proj/cmp01/app/btws/cfg/btw       /proj/cmp01/app/btws/cfg/btw       /proj/cmp01/app/btws/cfg/btw            bash-3.2$ /usr/ucb/ps -alxww | grep -v "alxww" | grep ftf | grep -v grep|head -5       0 39548   737   693  0  50 20 5112 3952 603110c3e70 S ?        249:55 /usr/bin/bash                         /proj/cmp01/app/ftf/bin/ftf.sh -y -c /proj/cmp01/app/btws/cfg/btw       0 39548   906   871  0  50 20 4568 3488 6034bfbf348 S ?        245:12 /usr/bin/bash          /proj/cmp01/app/ftf/bin/ftf.sh -y -c /proj/cmp01/app/btws/cfg/btw       0 39548  2512  2480  0  50 20 4552 3544 603d5120df8 S ?        134:04 /usr/bin/bash        /proj/cmp01/app/ftf/bin/ftf.sh -y -c /proj/cmp01/app/btws/cfg/btw       0 39548  2523  2496  0  50 20 4728 3688 602fcee1d28 S ?        135:43 /usr/bin/bash        /proj/cmp01/app/ftf/bin/ftf.sh -y -c /proj/cmp01/app/btws/cfg/btw       0 39548  2557  2535  0  50 20 4472 3480 603df1e0838 S ?        133:48 /usr/bin/bash        /proj/cmp01/app/ftf/bin/ftf.sh -y -c /proj/cmp01/app/btws/cfg/btw      It is chopping off part of the configuraton file. I also cannot use `pargs`:                  bash-3.2$ for i in `/usr/ucb/ps -alxww | grep -v "alxww" | grep ftf | grep -v gr        ep| awk '{print $3}'|head -3`; do pargs $i; done         pargs: cannot examine 737: permission denied        pargs: cannot examine 2512: permission denied        pargs: cannot examine 2523: permission denied        bash-3.2$       I checked this question, but I couldn't get the complete arguments:


How to give Windows partions' file execute permission

I have installed Linux Mint 17 and Windows 8, as dual boot. 500GB hard disk has 5 partitions. Two of them are NTFS and the other 3 are ext4 partitions. When I log into Windows, I can not see any ext4 partition, only NTFS partitions. When I am on Linux, I can see all partitions. But when I go and try to give execution permission to files in NTFS, it cannot be done. No error message appears, but the permissions are not changed. How can I give the execution permission to a file on a NTFS partition?.


How to split a file by using keyword boundaries

I have a vcf file that contains numerous vcards. When importing the vcf file to outlook it seems to only import the first vcard. Hence I want to split them up. Given that a vcard starts with               BEGIN:VCARD      and ends with               END:VCARD      What is the best way to split each vcard into it's own file. Thanks **UPDATE** Thanks for all the responses. As with questions of this nature there's various ways to skin a cat. Here's the reasoning why I chose the one I did. **ROUND-UP** Here's a roundup of what I liked from each answer and what drove me to select one of them.   * `csplit`: I really really liked the conciseness of this method. I just wished it was able to also set the file extension.   * `gawk`: It did everything i asked of it.   * `paralell`: Worked. But I had to install new things. (it also decided to make a new /bin dir in my home dir)   * `perl`: I liked that it created vcf based on contact's name. But the -o option didn't really work **Conclusion**   * So the first one to go was `perl` because it was a bit broken   * Next was `paralell` because I had to install new things   * Next was `csplit`, because as far as I can see it can't create extensions on the output files   * So the award goes to gawk, for being a utility that's readily available, and versatile enough that I can chop and change the file name a bit. Bonus marks for `cmp` too :)


Change a specific line using sed

I need to change a line in a Java file called `DbConnection.java` using the `sed` command. The line is:               connection = DriverManager.getConnection("jdbc:mysql://**localhost**/**bajaj**","**root**", "**root**");      I have tried the below which works fine (I can replace user provided value):               sed -i "s|://localhost/bajaj|://${HOSTNAME}/${DBNAME}|" DbConnection.java      But the below one I need some help with, I can't replace the `DBUSERNAME` & `DBPASSWORD`:               sed -i "s|"jdbc:mysql://localhost/bajaj","root", "root"|"jdbc:mysql://${HOSTNAME}/${DBNAME}","${DBUSERNAME}", "${DBPASSWORD}"|" DbConnection.java


Can change monitor resolution of a SyncMaster SA850 and Intel HD graphics

I have installed Debian 7.2 from liveUSB and connected the monitor Samsung SyncMaster SA850 with DVI cable into integrated Intel HD graphics. However I have very low resolution and can't change it. In addition, the system doesn't want to shut down (drivers update didn't help). With VGA cable everything works fine. Configuration: I have ASUS H87-Pro motherboard and Intel Core i7-4770K. Linux kernel 3.2.0-4-amd64


set rules for openvpn by iptables in firewall CentOS 6.2

Firewall (FW), three leg:   * eth0: 172.16.1.101   * eth1: 192.168.99.99 (LAN)   * eth2: 10.0.0.1 (DMZ) I installed `openvpn` in FW by tunnel mode, already ok:   * tun0: 192.168.10.0/24.  If I use `shorewall` and `squid` proxy FW is ok. At beside can connect to FW, LAN, DMZ using my company services. Now, I want to use `iptables` rules + `squid` proxy. What do I set rules for openvpn? And I have set rules below but not connect to server firewall installed `openvpn`:   * Packet forwarding `net.ipv4.ip_forward = 1`   * OpenVPN `iptables -A INPUT -i eth0 -m state --state NEW -p udp --dport 1194 -j ACCEPT`   * Allow TUN interface connections to OpenVPN server `iptables -A INPUT -i tun+ -j ACCEPT`   * Allow TUN interface connections to be forwarded through other interfaces              iptables -A FORWARD -i tun+ -j ACCEPT     iptables -A FORWARD -i tun+ -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT     iptables -A FORWARD -i eth0 -o tun+ -m state --state RELATED,ESTABLISHED -j ACCEPT        * NAT the VPN client traffic to the internet `iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -o eth0 -j MASQUERADE`   * If your default iptables OUTPUT value is not ACCEPT, you will also need a line like:              iptables -A OUTPUT -o tun+ -j ACCEPT


Application does not see environmental variables

I am running following 32 bit command on 64 bit system:               LIBGL_DEBUG=verbose glxinfo32 -v -t | head -5      It's output says               direct rendering: No (If you want to find out why, try setting LIBGL_DEBUG=verbose)      So it looks like 32 bit application is not seeing environmental variables. How can I export variables to 32 bit app?


Can`t part disk because 'invalid token primary'

I`m trying to partition the external HDD on my raspberry, I am running Raspbian (debian). When I run the command;               mkpart primary ntfs 45%      It will say: ![invalid token primary](http://i.stack.imgur.com/TfGyf.png) But the help says: ![primary](http://i.stack.imgur.com/3etXY.png) What I am doing wrong?


Do not set $? to non-zero on Control+C

My `$PS1` in Zsh includes this expression: `%(?. %?.)` It means «if exit code of previous command (`$?`) is true, show `$?`, else show nothing». This is generally useful, but one thing annoys me: shells set return code of last command to non-zero when I press Control+C without running a command! Zsh sets it to 1, Bash sets it to 130. Dash is the only shell on my system that does not reset it on Control+C. How to reproduce:   1. Launch zsh or bash.   2. Press Control+C.   3. `echo $?`. Is there a way to turn off this behavior on Zsh?


How to clear journalctl

I couldn't find in google any safe way to clear systemd journal. Do anyone know any safe and reliable way to do so? **Added:** As a reason, let's say I was experimenting with something and my logs got cluttered with various error messages. Moreover I'm displaying my journal on my desktop by using Conky. I really don't want to see those errors as they remind me an awful day I was fixing this stuff, I want to feel like a fresh man after this horror. I think everyone will agree that this is a valid reason to clear the logs :P .


how to execute more than one command gnome-terminal

I have a script which is running some of (more than 15) applications like:               cd mypath     sleep 1     gnome-terminal -t App1 --tab -e "./App1"      sleep 1     gnome-terminal -t App2 --tab -e "./App2"      ..     ..     sleep 1     gnome-terminal -t App15 --tab -e "./App15"        As you can notice this will start apps in 15 different terminals. Now what happens is when I kill any `./AppX` by `Ctrl`+`C`, for any reason, it terminates the program as well as exits that terminal. What I want is when I press `Ctrl`+`C` it should only terminates the `./AppX`, but terminal still remain open, that is beacause when I want to start that `AppX` again I should press only Up Arrow key and Enter. **EDIT::**   **Got the Answer** :: see the accepted answer from askubuntu.com. **Another question is** : How do I execute more than one command like following:               gnome-terminal -e "sleep 1; AppX"        which is NOT working, I tried various other methods (&, &&, |) but all failed.


What is the difference between exiting a process via Ctrl+C vs issuing a kill -9 command?

I know I can kill any process with kill -9 command . But sometimes i see that even if I have terminated a program with `CTRL+C` , the process doesn't get killed . So I want to know the difference between kill -9 vs `CTRL+C`


samba 4 force user

I have a directory with files owned by Linux user `quux`. I want to give access to it over CIFS using Samba 4 for two persons so they have different usernames `foo` and `bar` and passwords but access the same files under the same Unix UID and GID of `quux`. In Samba 3 it was possible by using `force user` and `forced group` parameters of share configuration in `smb.conf` but the options are no longer supported in Samba 4. Is something similar possible with Samba 4? Upd: We use samba to edit files on development Linux server from Windows PCs. For simplicity of deployment it's better to have the same file ownership and permissions on production and development servers. Ideally every developer should have single pair of username/password to remember and use it to connect to any project at any server as opposed to having different credentials for different projects and/or servers.


Create directory using filenames and move the files to its repective folder

I have a folder with around 150 text files. I would like to create folders in the name of the 150 files. After that I would like the text file to be moved to its respective folder. Example names of the files inside myfolder directory:               ~/myfolder/            |______ ajhaslf.txt            |______ oiueed.txt            |______ dsflije.txt      How I would like my new structure to be:               ~/myfolder/            |______ ajhaslf                        |____ajhaslf.txt            |______ oiueed                        |____oiueed.txt            |______ dsflije                        |____dsflije.txt      Of course creating directory with the filenames is not a problem for me with `mkdir`.


How to retrieve monitors configuration from the command line?

I am making a script that needs to access the computer's monitor(s) configuration. How can I do that? Is there a command or a file I could read where I can access this information? At the moment, I do               xwininfo -root      But I only have the total resolution and not the details (What I need is the resolution of each screen individually). Thanks!


How do I periodically run a command with very short intervall and get the return?

i need to call a specific command in an interval of about 5 sec. How would I setup a daemon/process running in the background or something similiar to do that? I looked at cronjobs, but the minimum intervall seems to be 1 minute. Any advice is apperciated ;) Fedora is the system. EDIT the command would be a bashscript, so "watch" wouldn´t do it I think.


Viewing foreground process using ps

I can see the background process using ps. But Is there a way to view the foreground process? For example, > $nohup process1 & then > ps -ef | grep "process1" would display the process "process1" in execution. But the above command wouldn't show a foreground process executed like, > $process2


Starting A Bind/DHCP server

I am looking for some reading material on starting my own BIND/DHCP server. I mainly want the bind server to just be a caching server and for my home computers but it may also need to be authoritative for a domain that I may buy later. Also some material on starting a DHCP server would be great. Also I want to run this on either freebsd or openbsd. Thanks in advance.


Can't enable TRIM on SSD

I can't enable TRIM on my newly-installed SSD. Ubuntu Server 12.04, Linux 3.11.0-15-generic. I turned TRIM on through discard setting in /etc/fstab. Also TRIM doesn't work with fstrim command. Here is how I check if TRIM works or not:               #for i in {1..100000}; do echo "1" >> tempfile; done     #sudo hdparm --fibmap tempfile     #sudo hdparm --read-sector 293865512 /dev/sda     #rm tempfile     #sync     #sudo hdparm --read-sector 293865512 /dev/sda      The second run of hdparm --read-sector command should return zeros in case of enabled TRIM, but the result is the same as with the first run of that command. fstrim command does not work:               #sudo fstrim -v /     /: 0 bytes were trimmed      Here's the result of hdparm -i /dev/sda:               Model=KINGSTON SV300S37A240G, FwRev=520ABBF0, SerialNo=50026B7243004D3E     Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }     RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4     BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=1     CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=468862128     IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}     PIO modes:  pio0 pio1 pio2 pio3 pio4      DMA modes:  mdma0 mdma1 mdma2      UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6      AdvancedPM=yes: unknown setting WriteCache=disabled     Drive conforms to: unknown:  ATA/ATAPI-2,3,4,5,6,7      Here's the result of sudo hdparm -I /dev/sda:               /dev/sda:              ATA device, with non-removable media         Model Number:       KINGSTON SV300S37A240G                           Serial Number:      50026B7243004D3E             Firmware Revision:  520ABBF0         Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0     Standards:         Used: unknown (minor revision code 0x0110)          Supported: 8 7 6 5          Likely used: 8     Configuration:         Logical     max current         cylinders   16383   16383         heads       16  16         sectors/track   63  63         --         CHS current addressable sectors:   16514064         LBA    user addressable sectors:  268435455         LBA48  user addressable sectors:  468862128         Logical  Sector size:                   512 bytes         Physical Sector size:                   512 bytes         Logical Sector-0 offset:                  0 bytes         device size with M = 1024*1024:      228936 MBytes         device size with M = 1000*1000:      240057 MBytes (240 GB)         cache/buffer size  = unknown         Nominal Media Rotation Rate: Solid State Device     Capabilities:         LBA, IORDY(can be disabled)         Queue depth: 32         Standby timer values: spec'd by Standard, with device specific minimum         R/W multiple sector transfer: Max = 16  Current = 1         Advanced power management level: 254         DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6               Cycle time: min=120ns recommended=120ns         PIO: pio0 pio1 pio2 pio3 pio4               Cycle time: no flow control=120ns  IORDY flow control=120ns     Commands/features:         Enabled Supported:            *    SMART feature set                 Security Mode feature set            *    Power Management feature set                 Write cache                 Look-ahead            *    Host Protected Area feature set            *    WRITE_BUFFER command            *    READ_BUFFER command            *    NOP cmd            *    DOWNLOAD_MICROCODE            *    Advanced Power Management feature set                 Power-Up In Standby feature set            *    SET_FEATURES required to spinup after power up                 SET_MAX security extension            *    48-bit Address feature set            *    Mandatory FLUSH_CACHE            *    FLUSH_CACHE_EXT            *    SMART error logging            *    SMART self-test            *    General Purpose Logging feature set            *    WRITE_{DMA|MULTIPLE}_FUA_EXT            *    64-bit World wide name            *    IDLE_IMMEDIATE with UNLOAD                 Write-Read-Verify feature set            *    {READ,WRITE}_DMA_EXT_GPL commands            *    Segmented DOWNLOAD_MICROCODE                 unknown 119[6]            *    Gen1 signaling speed (1.5Gb/s)            *    Gen2 signaling speed (3.0Gb/s)            *    Gen3 signaling speed (6.0Gb/s)            *    Native Command Queueing (NCQ)            *    Phy event counters            *    NCQ priority information            *    unknown 76[15]            *    DMA Setup Auto-Activate optimization                 Device-initiated interface power management            *    Software settings preservation            *    SMART Command Transport (SCT) feature set            *    SCT LBA Segment Access (AC2)            *    SCT Data Tables (AC5)            *    reserved 69[3]            *    DOWNLOAD MICROCODE DMA command            *    SET MAX SETPASSWORD/UNLOCK DMA commands            *    WRITE BUFFER DMA command            *    READ BUFFER DMA command            *    Data Set Management TRIM supported (limit 1 block)     Security:          Master password revision code = 65534             supported         not enabled         not locked         not frozen         not expired: security count             supported: enhanced erase         4min for SECURITY ERASE UNIT. 2min for ENHANCED SECURITY ERASE UNIT.     Logical Unit WWN Device Identifier: 50026b7243004d3e         NAA     : 5         IEEE OUI    : 0026b7         Unique ID   : 243004d3e     Checksum: correct      Here's dmesg | grep discard:               [    6.417350] EXT4-fs (sda1): re-mounted. Opts: discard,errors=remount-ro     [    6.471628] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: discard      And here's cat /etc/mtab | grep discard:               /dev/sda1 / ext4 rw,noatime,nodiratime,discard,errors=remount-ro 0 0     /dev/sdb1 /home/backup ext4 rw,noatime,nodiratime,discard 0 0      Also I have successfully enabled TRIM through discard on two other computers with the same OS but the different SSD.


Creating an email that can trigger a script

I have a CentOS 6.3 server. I would like to create an email address like, for example, list@myserver.com that will be a special kind of email that will trigger a script. For example: suppose I mail list@myserver.com and the subject is an IP address. I want the server to receive that mail, extract that IP from the subject and append it to a file. How is this done on Linux? Can you guys tell me how this can be done?


Installing a program in Linux via package

I'm trying to create a `*.deb`-Package to install a program I have written. It consists of three executables which hash to be in the same subdirectory. Example:               .../myprogram/         |         +- Program A         +- Program B         +- Program C      I thought I can store them in `/usr/share/...` but lintian gives an error. So I read that in `/usr/share/...` arch-dependent objects can not have a place. But where else? It is necessary that the executables are grouped in a "own" subfolder. When I look into e.g. `/usr/bin/` there are no subfolders for programs.


How can I make a user able to log in with ssh keys but not with a password?

I would like to create a user and have no password. As in you cant log in with a password. I want to add keys to its authorized_keys by using root. This is for my automated backup system.


PHP imageline function doesn't work. What and how should I download?

PHP function _imageline_ on localhost works, but on VPS cloud hosting doesn't. I guess I have download something, but I don't know what. Could you give me a hand? P.S. PHP GD is already downloaded.


Selectively disabling gvfsd-cdda in Debian Squeeze?

Is there a way to selectively disable `gvfsd-cdda` on Debian Squeeze? Since I updated my machine to Squeeze `grip` can no longer eject a CD, which interferes with ripping. I traced it back to `gvfsd-cdda`, but found no preference or configuration to disable it. I can't uninstall package `gvfs- backends` either, because it is required by `gnome-core`. I did find `/usr/share/mounts/cdda.mount`, but disabling that feels like an ugly hack that will be overwritten on the next update of the package.


In Gnu Emacs how do I set up a global key to toggle the menu-bar?

Using Gnu Emacs 23.1.1 on Ubuntu 10.04... I'm currently a total newb with emacs, and I've decided to go cold turkey with the Gnome menu bar. (but I do want it to be "available" for the teething transition period... tepid turkey? :) So I'd like to know how to assign a key to toggle it on/off.. I'm currently starting Emacs in full screen mode, with no menu-bar and no tool-bar I'm trying out a tabbar (when in X, but not when in terminal) .. I'm almost getting used to it, but I find I feel completely lost sometimes without the menubar... I've read that Emacs without the GUI paraphenalia is the way to go.. and I believe it!... the paradigms clash.. But for now I'd like a menu-bar toggle, and it will be good experience to see how it is done..


Do I have to compile the kernel every time, even for a small change?

In my project I configure the kernel (2.6.32) in `block/ioctl.c`. We all know that kernel compiling and building takes few hours. Even for a small change, I'm compiling from scratch. So is there any way to compile and build only the changed file?


Pipe / direct image / video output to foreign server

I am working on a Project that involves taking the output from a Webcam which is in either jpg or h.264 format, and outputting it to a foreign server (HTTP / FTP would work, I am open minded). What is the most logical way of doing this. I would imagine that it would be achieved with `(command) | (commandtooutput [params]) [location]`. Am I looking at this wrong? With images, I would prefer to upload them periodically such as once a minute. Eventually I would like to allow for this period to be changed. Does this seem logical / realistic? I presume the most logical way to implement this would be with Python or BASH scripting, having the script read period information before each sync and then have the script adjust accordingly. To give some background the output is from a Raspberry Pi's `raspistill` or `raspivid` program, (it will either be running ArchARM or the usual Raspbian). I decided not to place this question in those forums because I think it applies more any distro of Linux. I believe the only thing that is unique to the Pi in this situation is irrelevant to my question, however if this is an inappropriate place to ask let me know and I will be sure to move / delete the post.


ffmpeg and libmp3lame produces bad audio quality?

when I get a flash video from YouTube, why is the quality of the audio much worse than the origin video on YouTube? When I downloaded the flash movie, I convert it to avi like this:                  ffmpeg -i ~/"$2.flv" -sameq -acodec libmp3lame -vol 200 -ar 44100 -aq 300 -ab 2097152 ~/"$2.avi"      I already set -aq (audio quality) to 300, but no difference to 100 or 200. Moreover 100 is the max. value in my opinion. -ar (frequecy) 44100 should be ok too and the bitrate in bit/s (-ab) should be 256kb/s (2097152 / 1024 / 8). I am not sure what is the right bitrate for a good quality but I think 256kb/s should be fine. Or did I calculate it wrong? What could be the problem?


How to get elapsed time from two "text based" dates

I would like to know if there is a way to calculate the difference between two times in bash. I have two fields that are extracted from a log file: Start time: Feb 12 10:02:10 End time: Feb 12 10:53:15 What I need is a manual way to get the elapsed time between these 2 dates. Since the time values are "text based", and not from a date generating command, I don't know if there's a way to do it. The times are 24 hour based, so hopefully that'll make times spanning midnight easier to handle. Any suggestions will be greatly appreciated. Peter V.


What happened to bzip1?

bzip2 had been a _de facto_ standard for quite strong compression throughout many years already. I myself had typed the `bzip2` command thousands of times already, which makes me wonder - what happened to bzip, or bzip1? Google doesn't seem to tell me much about it and it sounds like it could be an interesting history lesson.


When I execute a cpio command, it hangs forever

I've been trying to unarchive a cpio archive (in this case, my initial ramdisk). However, when I try to extract the files, `cpio` hangs forever. It happens if I pass the `-V` argument to print extra info, too.               alex@alexs-arch-imac:/tmp/initramfs$ cpio -i initramfs-linux.img # wait for a while after this     ^C     alex@alexs-arch-imac:/tmp/initramfs$       How can I extract a cpio archive without the utility hanging?


Cowfiles directory?

My bashrc issues a cow from `cowsay` and with a random `fortune`. Like this:               echo -e "\e[00;33m $(fortune -a -o -s | cowsay -f $(ls /usr/share/cowsay/cows/ | shuf -n1) | sed -e 's/^/       /g')\e[00m"      This works on Linux Mint but I moved to Arch Linux, and the cowfile directory is different now. Is there a standard way to figure out the cow directory?


How to import screenlets on Python

**(I'm using Ubuntu 10.04 with`Linux 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:10:02 UTC 2010 i686`)** For some reason I had updated some Python files (I'm not able to tell which ones, but it was during the installation of Hugin). After that I noticed that my screenlets had disappeared after rebooting. I'm trying to make screenlets work again since 3 days. I removed Hugin and everything related with `python3`. I have               $ python --version     Python 2.7.6      When I try to call `screenlets` I got               $ screenlets     Traceback (most recent call last):       File "/usr/share/screenlets-manager/screenlets-manager.py", line 34, in <module>         import screenlets     ImportError: No module named screenlets      I'm Googling for hours to find a solution but anything is working. Helps are appreciated.


Emacs paste into search (C-s) field?

Let's say you are writing code in one of _Emacs_ window and then want to search for a string that you have copied manually (`M`-`w`) some time before. The problem is, that by default, when you issue `C`-`s`, `C`-`y` key sequence, _Emacs_ pastes the remaining line under a cursor as a search parameter -- but that's not what I want. My current workaround is to grab a mouse, click on a _Minibuf_ then yank, but it's too much time consuming. Version: _GNU Emacs 23.3.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10)_


sudo: ulimit: command not found

I was using ubuntu 12.04 ,on which I run ulimit -n ,it is showing 1024, I want to increase my open file limit from 1024 to 65535,so I tried the following command:               sudo ulimit -n 65535      but i get the following error:               sudo: ulimit: command not found      How to increase the file limit from 1024 to 65535? Any help will be appreciated.


How to use Super-L instead of Alt in XFCE for resizing/moving windows?

In XFCE, when holding down `Alt` and then clicking anywhere in a window with the left button will move that window (as if by dragging the title bar), or resize the windows when clicking and dragging with the right button. I like this feature very much, and I'm used to it, since forever. But I've always had it bound to `Super-L`(left "Windows"-Key). How do I change the behavior of `Alt` for `Super-L`? I was looking at _XFCE Settings Manager_ but I couldn't find it anywhere.


Unable to install Backtrack 5

I'm using a Dell Inspiron 15r laptop with existing Windows 7 ultimate 32-bit operating system. Now I want to install Backtrack 5 and dual boot. And I'm not able do it, getting the following errors: I just log in with username `root` and password `toor`, then type `startx` to launch the GUI, but `startx` reports "command not found". I've tried various commands such as `login` and `sh`, but no luck. `sudo` is out of the question, too.


What does hierarchy support do in cgroup?

`cgroup` has 2 options for memory control:   * `memory.use_hierarchy = 1` : use hierarchy   * `memory.use_hierarchy = 0` : use flat hierarchy, according to this answer What is the difference between the two? I think, hierarchy is hierarchy, what does "flat" mean here? I read the cgroup documentation here explained the hierarchical support: > In the diagram above, with hierarchical accounting enabled, all memory usage > of e, is accounted to its ancestors up until the root (i.e, c and root), > that has memory.use_hierarchy enabled. If one of the ancestors goes over its > limit, the reclaim algorithm reclaims from the tasks in the ancestor and the > children of the ancestor.   * What does it mean by `accounted to its ancestors up until the root`?    * How can ancestors can go over its limit, since its children capacities are allocated that sum to the capacity of the ancestor?    * Why are tasks reclaimed in both ancestor and children? I thought that tasks are only allocated in the children and those tasks automatically belong to ancestor. i.e. "WWW Browsing" has 20% capacity; its children are "Professors" and "Students" that have 15% and 5% respectively. The maximum can never exceed 20%. Why is there a case in the document stated that: > If one of the ancestors goes over its limit, the reclaim algorithm reclaims > from the tasks in the ancestor and the children of the ancestor.


Difference between Login Shell and Non-Login Shell?

I understand the basic difference between an interactive shell and a non- interactive shell. But what exactly differentiates a login shell from a non- login shell? Can you give examples for uses of a **_non-login interactive_** shell?


Different representation of bash in 'ps -f' command

![enter image description here](http://i.stack.imgur.com/WYouU.png) I have two bash running; one is Terminal application that runs bash, the other one is xterm application that runs bash. With `ps -f`, I have `-bash` one, and `bash` at the other. What makes this difference?


What is the difference between interactive shells, login shells, non-login shell and their use cases?

> **Possible Duplicate:**   >  Difference between Login Shell and Non-Login Shell? I have been looking at /etc/profile. bash.bashrc to see how they are run, and notice that some are executed by non-login shells, some work with interactive shells etc. What are the differences in this type of shells, ie interactive & non- interactive, login & non-login etc? The question may be pretty basic,but it seems I need to ask what a shell is, first and foremost. What is a shell, what is its relevance, how do you use it, and why does it exist to start with? Update: To make the intent of the question better understood, what I need to understand besides the definitions, are the use cases for one type of shell or the other. It is the use cases that help understanding, not just dictionary definitions.


Compare a filesystem to a dump

Is there a way to compare the current state of the filesystem to that stored in a backup created by `dump`? I recently had some major corruption in the filesystem and my most recent backup is from several months ago. I want to compare the two in order to get an idea of how much was corrupted and hopefully see how much has changed since the backup.


Install RHEL 5.7S on machine with 4TB disks

I'm getting errors about GPT when installing OS using kickstart. The Dell R720 has 8x 600GB SAS. I can't figure out what to configure in BIOS and kickstart file. In BIOS, there're boot options of BIOS and UEFI. SATA has a few options, AHCI and RAID mode. In PERC, I select all disks and select RAID level 5. I tried a few combinations but they all don't work. Does anyone here has experience setting up machine with such large local disk array? My kickstart.cfg has this:               clearpart --all --drives=sda     part /boot --fstype ext3 --size=16     part pv.2 --size=0 --grow --ondisk=sda     volgroup vg --pesize=65536 pv.2          logvol / --fstype ext3 --name=root --vgname=vg --size=51200     logvol swap --fstype swap --name=swp --vgname=vg --size=131072     logvol /tmp --fstype ext3 --name=tmp --vgname=vg --size=524288     logvol /opt/lo --fstype ext3 --name=lo --vgname=vg --size=3072000      Thank you in advance.


Compiling PHP and installing it under one directory

I have to compile a few versions of PHP in work but I need an apache service for each version running like we have on Windows. However the configure options seem to have different folders for everything. I was wondering if there was an easy way to configure so when I make install it is all in one folder, with all the extensions in ext etc rather than scattered around the system. I want to compile 5.5.1, 5.3.27, 5.2.17 and 4.3.11. Now this wouldn't be a problem with just one PHP version but with multiple versions things will probably be overwritten/conflicted in other ways. Say I want everything to go to `/php/5.5.1/` ./configure --prefix=`/php/5.5.1/` How else is this to be configured to put everything in that folder? Has anyone else done this?


How to know I am using vi or emacs input?

Crash shell allows to specify the command line editing mode to vi or emacs. What will be the difference in these input methods? I am not asking about the internal features.


OOM Killer value always one less than set

I am trying to set the `oom_adj` value for the out of memory killer, and each time I do (regardless of the process) I get back exactly one less than I set (at least for positive integers. I haven't tried negative integers since I want these processes to be killed by OOM Killer first).               [root@server ~]# echo 10 > /proc/12581/oom_adj     [root@server ~]# cat /proc/12581/oom_adj     9     [root@server ~]# echo 9 > /proc/12581/oom_adj     [root@server ~]# cat /proc/12581/oom_adj     8     [root@server ~]# echo 8 > /proc/12581/oom_adj     [root@server ~]# cat /proc/12581/oom_adj     7     [root@server ~]# echo 7 > /proc/12581/oom_adj     [root@server ~]# cat /proc/12581/oom_adj     6     [root@server ~]#       Is this expected behavior? If not, why is this happening?


How do I process ifconfig output to determine my link speed?

Here's script I wrote out of boredom, for download speed test:               #!/bin/bash          get_ispeed() {         echo $(ifconfig eth0 | grep bytes | grep RX | cut -d ':' -f 2 | cut -d ' ' -f 1);     }          for((;;));     do         s1=`get_ispeed`;              sleep 1s;              s2=`get_ispeed`;              d=$(($s2-$s1));              echo $(($d / 1000))" kB/s";     done      Not sure if it's "doing the job", though I'm not true bashist :p   Since ifconfig yields RX bytes, I divide it by 1000 to get kB/s


Why is the unit separator (ASCII 31) invisible in terminal output?

The unit separator ASCII character (ASCII 31, octal 37), is visible in Vim as a `^_`. But if I print the same file to the terminal, the character is invisible. This causes the fields on a line to get stuck together:               # In Vim and less:          first field^_second field^_last field          # cat the same file to terminal:     cat delim.txt     first fieldsecond fieldlast field          # print 2nd field with awk      cat delim.txt | awk 'BEGIN {FS = "\037"} {print $2}'     second field      I suppose I can make the unit separator visible with cat -v:               cat -v delim.txt     first field^_second field^_last field      But this is rather cumbersome. Why doesn't the unit separator have a visible representation when printed to stdout in the Bash shell? I can't even copy and paste the shell output correctly; the unit separator gets lost in the process.


How close smartcard after sign rpm with GPG2?

Adding to this question: How do I close gnupg V2.0 smartcard after signing an rpm? I tried to execute:               gpg-agent --default-cache-ttl 15 --max-cache-ttl 15 --daemon      But after 15 seconds, if I execute again a signature, `gpg2` doesn't prompt for the PIN. The only solution I've found so far, is to unplug/plug smartcard on the reader.


Host freeware API over apt-get

I am new to Linux and Unix environment. I have built a Pro*C API for C++ and Oracle interaction, which much more easy to use than the conventional Pro*C technology. > If you are using Pro*C then you might be aware of its pain. That, you need > to write .pc file, then using Oracle precompiler, you need to compile the > code to get .cpp file, then again compile it to get the .o (executable > file). To make the process easy I created an API which provides the > programmer with built-in classes and functions, so that he/she can implement > it to boost the development of C++ and Oracle SQL. Now, I want to host the API as a freeware so, that one can download the API using apt-get to their respective system. How can I host my file over apt-get?


Prevent clashing of development version with system packages

What I mean is, I intend to work a bit on an open source project which I already have installed through my system packages. What I'm wondering is if there is a suggested workflow for managing this situation, where I want to keep my system-installed packages but also compile and run the version I'm developing. My question is general as I've wondered this before with other projects, but this particular instance drove me to ask this question. The project I'm referring to is rtorrent. The project has a other dependencies of course, but in particular it has one by the same author: libtorrent. The point is that both of these things are newer than my system's packages, so I need to pull them both and build rtorrent against that libtorrent version. So far I have compiled libtorrent, short of actually doing `make install` since that is where it would clash with my system packages I imagine. It ended up dumping the library files in `src/.libs`, but I think I will also need access to the header file(s) as well right?. How should I go forward with building this git-cloned rtorrent? I've never done this before so please excuse the ignorance, but does it all revolve around the `./configure` script? Should I simply use use `LDFLAGS` to add the library path with `-L` and `CPPFLAGS` to add the include path (for header(s)) with `-I`? Or should I re-`./configure` libtorrent with a `\--prefix` common to libtorrent and rtorrent, and then `make install` libtorrent? Thanks! **EDIT** : `./configure --help` shows these "influential environment variables"               libtorrent_CFLAGS               C compiler flags for libtorrent, overriding pkg-config     libtorrent_LIBS               linker flags for libtorrent, overriding pkg-config      What I'm curious about is, this gives me the impression that even if I were to set `LDFLAGS` and `CPPFLAGS`, ultimately it gets the information for libtorrent using `pkg-config` anyways, so I have to use those instead. Using those did result in a successful `./configure` execution, along with a `\--prefix` parameter I think I'm good to go.


How do I launch Pidgin when I click on an irc:// link?

Is there a way that when you click an IRC url (such as `irc://##linux`) that it will open Pidgin? I believe it has something to do with `gconf-editor`, but I do not know the terminal command to start an IRC chat in Pidgin. I am using Linux Mint, if that matters.


Weird zsh grep -P behaviour

I connect to server with PuTTY from Windows. I have a long yet not touched (I suppose) by hands of local admin config:               $ cat /opt/jira/.subversion/config     ...         ### must be enabled, which is typically done by setting the     ### 'enable-auto-props' option.     # *.c = svn:eol-style=native     # *.cpp = svn:eol-style=native     ...      Want to see if there are lines, which begin with something not `#`:               $ cat /opt/jira/.subversion/config | grep -P "$[^#]"     zsh: bad math expression: operand expected at `^#'     $     [1]    broken pipe  cat /opt/jira/.subversion/config          $ cat /opt/jira/.subversion/config | grep -P "\$[^#]"          $ cat /opt/jira/.subversion/config | grep -P "\$#"          $ cat /opt/jira/.subversion/config | grep -P "$#"     ### details, see Debian Bug #413102):     # global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo      Can anyone explain why 2nd and 3rd outputs are same empty and what is that 4th? UPD: here file is:               ### This file configures various client-side behaviors.     ###     ### The commented-out examples below are intended to demonstrate     ### how to use this file.          ### Section for authentication and authorization customizations.     [auth]     ### Set store-passwords to 'no' to avoid storing passwords in the     ### auth/ area of your config directory.  It defaults to 'yes'.     ### Note that this option only prevents saving of *new* passwords;     ### it doesn't invalidate existing passwords.  (To do that, remove     ### the cache files by hand as described in the Subversion book.)     # store-passwords = no     ### Set store-auth-creds to 'no' to avoid storing any subversion     ### credentials in the auth/ area of your config directory.     ### It defaults to 'yes'.  Note that this option only prevents     ### saving of *new* credentials;  it doesn't invalidate existing     ### caches.  (To do that, remove the cache files by hand.)     # store-auth-creds = no          ### Section for configuring external helper applications.     [helpers]     ### Set editor to the command used to invoke your text editor.     ###   This will override the environment variables that Subversion     ###   examines by default to find this information ($EDITOR,     ###   et al).     # editor-cmd = editor (vi, emacs, notepad, etc.)     ### Set diff-cmd to the absolute path of your 'diff' program.     ###   This will override the compile-time default, which is to use     ###   Subversion's internal diff implementation.     # diff-cmd = diff_program (diff, gdiff, etc.)     ### Set diff3-cmd to the absolute path of your 'diff3' program.     ###   This will override the compile-time default, which is to use     ###   Subversion's internal diff3 implementation.     # diff3-cmd = diff3_program (diff3, gdiff3, etc.)     ### Set diff3-has-program-arg to 'true' or 'yes' if your 'diff3'     ###   program accepts the '--diff-program' option.     # diff3-has-program-arg = [true | false]     ### Set merge-tool-cmd to the command used to invoke your external     ### merging tool of choice. Subversion will pass 4 arguments to     ### the specified command: base theirs mine merged     # merge-tool-cmd = merge_command          ### Section for configuring tunnel agents.     [tunnels]     ### Configure svn protocol tunnel schemes here.  By default, only     ### the 'ssh' scheme is defined.  You can define other schemes to     ### be used with 'svn+scheme://hostname/path' URLs.  A scheme     ### definition is simply a command, optionally prefixed by an     ### environment variable name which can override the command if it     ### is defined.  The command (or environment variable) may contain     ### arguments, using standard shell quoting for arguments with     ### spaces.  The command will be invoked as:     ###   <command> <hostname> svnserve -t     ### (If the URL includes a username, then the hostname will be     ### passed to the tunnel agent as <user>@<hostname>.)  Here we     ### redefine the built-in 'ssh' scheme to avoid an unfortunate     ### interaction with the "ControlMaster auto" feature (for     ### details, see Debian Bug #413102):     ssh = $SVN_SSH ssh -o ControlMaster=no     ### If you wanted to define a new 'rsh' scheme, to be used with     ### 'svn+rsh:' URLs, you could do so as follows:     # rsh = rsh     ### Or, if you wanted to specify a full path and arguments:     # rsh = /path/to/rsh -l myusername     ### On Windows, if you are specifying a full path to a command,     ### use a forward slash (/) or a paired backslash (\\) as the     ### path separator.  A single backslash will be treated as an     ### escape for the following character.          ### Section for configuring miscelleneous Subversion options.     [miscellany]     ### Set global-ignores to a set of whitespace-delimited globs     ### which Subversion will ignore in its 'status' output, and     ### while importing or adding files and directories.     ### '*' matches leading dots, e.g. '*.rej' matches '.foo.rej'.     # global-ignores = *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo     #   *.rej *~ #*# .#* .*.swp .DS_Store     ### Set log-encoding to the default encoding for log messages     # log-encoding = latin1     ### Set use-commit-times to make checkout/update/switch/revert     ### put last-committed timestamps on every file touched.     # use-commit-times = yes     ### Set no-unlock to prevent 'svn commit' from automatically     ### releasing locks on files.     # no-unlock = yes     ### Set mime-types-file to a MIME type registry file, used to     ### provide hints to Subversion's MIME type auto-detection     ### algorithm.     # mime-types-file = /path/to/mime.types     ### Set preserved-conflict-file-exts to a whitespace-delimited     ### list of patterns matching file extensions which should be     ### preserved in generated conflict file names.  By default,     ### conflict files use custom extensions.     # preserved-conflict-file-exts = doc ppt xls od?     ### Set enable-auto-props to 'yes' to enable automatic properties     ### for 'svn add' and 'svn import', it defaults to 'no'.     ### Automatic properties are defined in the section 'auto-props'.     # enable-auto-props = yes     ### Set interactive-conflicts to 'no' to disable interactive     ### conflict resolution prompting.  It defaults to 'yes'.     # interactive-conflicts = no          ### Section for configuring automatic properties.     [auto-props]     ### The format of the entries is:     ###   file-name-pattern = propname[=value][;propname[=value]...]     ### The file-name-pattern can contain wildcards (such as '*' and     ### '?').  All entries which match (case-insensitively) will be     ### applied to the file.  Note that auto-props functionality     ### must be enabled, which is typically done by setting the     ### 'enable-auto-props' option.     # *.c = svn:eol-style=native     # *.cpp = svn:eol-style=native     # *.h = svn:eol-style=native     # *.dsp = svn:eol-style=CRLF     # *.dsw = svn:eol-style=CRLF     # *.sh = svn:eol-style=native;svn:executable     # *.txt = svn:eol-style=native     # *.png = svn:mime-type=image/png     # *.jpg = svn:mime-type=image/jpeg     # Makefile = svn:eol-style=native


Calculate the date from 1125 days ago on non-GNU systems?

On the Unix Bash commandline, I want to calculate the date from 1125 days ago using the base operating system (e.g. No Perl or Python). On systems running GNU Date, I can do something like this:               ubuntu $ date --date="1125 days ago"     Wed Nov  7 15:12:33 PST 2007      FreeBSD or MacOSX systems don't ship with GNU Date, and don't support values like "X days ago".               freebsd81 $ date --date="+1125 days ago"     date: illegal option -- -      I _can_ calculate a date from a few days ago on a Mac or FreeBSD system, but this is limited to a few days:               # Today is really Dec 6, 2010. 4 days ago it was:     macosx $ TZ=GMT+96 date +%Y%m%d     20101202          # But that doesn't work if I want to see the date 8 days ago:     macosx $ TZ=GMT+192 date +%Y%m%d     20101206      Can I calculate old dates on non-GNU systems without delving into tools like Perl or Python? Or must I use a more powerful scripting language?


last reboot/uptime/... strange behaviour

I know this has been more or less asked before but I still don't have any answer. I started to investigate why on my system (it is a remote machine) `who -b` and `uptime` gave different results (~3 days for one / 5 days for the other). Some answers would say that maybe `/var/run/utmp` is corrupted. Some other answers would say that the ntp server was launched after the reboot and so the system had to go backwards to set the time. Here are a few commands I have typed down :               ubuntu@arm:~$ sudo hwclock --show     Mon 25 Nov 2013 03:07:02 PM CET  -0.464179 seconds          ubuntu@arm:~$ uptime     15:08:17 up 3 days, 53 min,  1 user,  load average: 0.88, 0.51, 0.41          ubuntu@arm:~$ date     Mon Nov 25 15:08:33 CET 2013          ubuntu@arm:~$ who -b     system boot  2013-11-20 12:38          ubuntu@arm:~$ last reboot     reboot   system boot  3.7.10-x9        Wed Nov 20 12:38 - 15:08 (5+02:30)        reboot   system boot  3.7.10-x9        Wed Nov 20 12:37 - 15:08 (5+02:31)        reboot   system boot  3.7.10-x9        Thu Nov  7 14:26 - 12:36 (12+22:10)       reboot   system boot  3.7.10-x9        Thu Nov  7 14:25 - 12:36 (12+22:11)       reboot   system boot  3.7.10-x9        Thu Nov  7 14:23 - 12:36 (12+22:12)       reboot   system boot  3.7.10-x9        Thu Nov  7 14:22 - 12:36 (12+22:14)       reboot   system boot  3.7.10-x9        Tue Nov  5 14:58 - 14:22 (1+23:23)        reboot   system boot  3.7.10-x9        Sat Nov  2 12:20 - 14:58 (3+02:37)        reboot   system boot  3.7.10-x9        Sat Nov  2 12:20 - 12:20  (00:00)              wtmp begins Sat Nov  2 12:20:00 2013      Notes : the machine is remote/embed in a system. Sometimes the electricity is shut down. The internet connection is very slow (sim card) Questions : 1) What does it mean when there are multiple lines for 1 boot ? I would expect all the lines to look like Nov 5, but on the 7th there are 4 lines at almost the same time and the end time is the same for all of them. I would expect 14:22-14:23 (00:01), 14:23-14:25 (00:02), ... 2) If the electricity is turned down and up again, does it count as a reboot ? How does it affect the internal time ? (ntp server stuff) 3) Is there a scenario one can trust for the 2 days difference between uptime and who -b ? My guts tell me that the file `/var/run/utmp` can't be corrupted/have permissions errors as no one else than the system use it. Any help is grandly appreciated Ref: Uptime and who -b are showing different times when the system was last booted on Linux


mv file without write permission to the source file

I just realised that I can move a file that I do not own and don't have write permissions on. I have write permissions to the directory, so I am guessing that is why I could move it, but in this instance, is there anyway of protecting the source file? The permissions for the file are as follows;               cgi-bin> ls -al           drwxrwxrwx   3 voyager  endeavor     512 Feb  1 10:45 .     drwxrwxrwx   6 voyager  endeavor     512 Feb  1 09:38 ..     -rwxr-xr-x   1 voyager  endeavor   22374 Feb  1 10:45 webvoyage_link.cgi          cgi-bin> whoami     moorc          cgi-bin> groups     lrsn endeavor          cgi-bin> rm webvoyage_link.cgi     rm: webvoyage_link.cgi: override protection 755 (yes/no)? yes      This last one is a big surprise to me to. How can I delete a file that I don't have access to. There is obviously something I'm missing.


debootstrap from Intel Atom (i686) to AMD Sempron (AMD 64)

I'm working on setting up a minimal Debian install on a USB stick, and am just trying to wrap my head around `debootstrap` and differences in architectures. I want to create a system to run on AMD64 (AMD Sempron 145) from i686 (Intel Atom N450). As far as I understand, the atom is a 64 bit processor, so can I just do this:               debootstrap --arch=amd64 wheezy /mnt/foobar      Or do I have to follow one of the more complicated cross-debootstrap procedures? ### extra info:               $ lscpu     Architecture:          i686     CPU op-mode(s):        32-bit, 64-bit     CPU(s):                2     Thread(s) per core:    2     Core(s) per socket:    1     CPU socket(s):         1     Vendor ID:             GenuineIntel     CPU family:            6     Model:                 28     Stepping:              10     CPU MHz:               1666.444     L1d cache:             24K     L1i cache:             32K     L2 cache:              512K


What is [jbd2/dm-3-8] and [kdmflush]? And why are they constantly on iotop?

The title says it all. Using Fedora for a small Samba and development server.


Bandwidth throttling per user group

I am wondering if it is possible to create a bandwidth shaping/throttling script that shapes traffic based on user group. That is, if user1, user2, are in user group group1, they will have 1mb/s download and 1mb/s upload, whilst if user3 and user4 are in group2, they will have 256kb/s download and 256kb/s upload. I've read a bit about this and I found some iptables and TC implementations of a per user solution, but I have not seen anything for a user group. Hopefully it can be simply implemented in form of a custom iptables rules and script running with TC or the like. Here is a script I was looking into that does a system wide throttle: http://atmail.com/kb/2009/throttling-bandwidth/ I assume it is possible to do user group throttling since it is possible for throttling on a per user basis. Thanks for any info you can provide for this question.


CANON printer setup with no driver openSUSE

I just bought a new printer/scanner combo and am attempting to set it up with my pc which runs openSUSE 13.1. I went to yast-> hardware-> printers and followed the prompts however, although my printer was detected there were no found drivers. So when I go to print the computer does not acknowledge my printer. I went to the canon website, and it states there are no linux drivers for the printer, which is the canon pixma mx459. any suggestions?


Disallow File IO for a process except for FIFOs

How do you start a process that cannot do _any_ file IO (opening / closing files, creating / deleting files, reading / writing files, etc.), except to read and write to pre-created FIFOs? (`chroot` will not work because the process can break out of it, but messing with / modifying the kernel and such is okay) BTW: I cannot modify the programs that are being run


cat line X to line Y on a huge file

Say I have a huge text file (>2GB) and I just want to `cat` the lines `X` to `Y` (e.g. 57890000 to 57890010). From what I understand I can do this by piping `head` into `tail` or viceversa, i.e.               head -A /path/to/file | tail -B      or alternatively               tail -C /path/to/file | head -D      where `A`,`B`,`C` and `D` can be computed from the number of lines in the file, `X` and `Y`. But there are two problems with this approach:   1. You have to compute `A`,`B`,`C` and `D`.   2. The commands could `pipe` to each other **many more** lines than I am interested in reading (e.g. if I am reading just a few lines in the middle of a huge file) Is there a way to have the shell just work with and output the lines I want? (while providing only `X` and `Y`)?


Efficient way to print lines from a massive file using awk, sed, or something else?

If I had a plain-text file containing 8 million lines and I want to print out lines 4,000,010 to 4,000,000 to the screen, which would be more efficient: awk or sed? There is no pattern to the text, and unfortunately, a database isn't an option. I know this isn't ideal, I'm just curious on which one would complete the task quicker. Or maybe there is even a better alternative to sed or awk?


Split a file into multiple based on selected lines

I have a file in which more than 50,000 lines are there. How can I split the file into two or more based on the selected lines? Suppose I want to split a file from line 10,000 to line 40,000.


How to echo from specific line of a file to another specific line

Assume I have a file with about 10000 lines. How can I print 100 lines, starting from line 1200 to line 1300?


read specific lines from the file

I have some text file (for example json). I can use `head` order for the reading of the first lines. For example:               head -n 100 file.json      get me 100 first lines back. What is Linux order, which I can use to read some general lines somewhere in file? For example from the line 500 to the line 700.


How can I get a specific line from a file?

I want to extract an exact line from a very big file. For example, line 8000 would be gotten like this:               command -line 8000 > output_line_8000.txt


Easy way to copy lines from one file to another

> **Possible Duplicate:**   >  cat line X to line Y on a huge file Very simple issue but can't seem to find a simple resolution! I have a massive text file from which I only need around 150 lines. The lines are really long and therefore viewing it in putty is a bit of a nightmare. I just want to copy these lines to another file so that I can view it properly in an editor. (I can't view the original file in an editor as my Windows machine can't handle it). The lines I want start at around line 2000. Thanks,


Command to print few consecutive lines from middle of a file

For a file containing 20 lines, lines 6-10 can be printed using following command:               head -10 filename | tail -5      Can this exactly same thing be done without using 'head' and 'tail' commands ?? Please comment the link if similar question already exists.


Is no caching mode page a serious error?

My server log displays the following error messages in RED:               kernel:  sda: sda1 sda2     kernel: sd 0:1:0:0: [sda] No Caching mode page found     kernel: sd 0:1:0:0: [sda] Assuming drive cache: write through     kernel: sd 0:1:0:0: [sda] Attached SCSI disk      I am using Seagate hard disk ST3300657SS with RAID 1 configuration. I have read the answer in this question which mentions: > In your case the device doesn't have a caching mode page, so the kernel > assumes there is no caching of reads or buffering of writes, and that > therefore writes to the device will be "write through," i.e. will go > directly to the media. Is this error a hardware issue that needs rectification?


where does Cron look for the default mail binary?

I have setup Cron Jobs to run inside a Chroot Environment, depending on the User/Group; I have noticed that these cron jobs, running inside the chroot environment, fail to send any mail. Log files report that it cannot find a program to send mail. Where does the Cron process look for the default mail binary? Can you set or configure this path? and on a side note.. if the MAILTO= variable is not set, how does Cron know where to send mail to? does it just send mail to the user running the job, on the local host? thanks!


Mint 12, workspaces and two screens

I have two screens connected to my machine, using the _NVIDIA X Server Settings_ program I set them up with _TwinView_. I had the same exact set up in _Mint 11_ and it all worked well, today after switching to _Mint 12_ the workspace only affect one screen, not both. That is, if I switch to another workspace only one screen is showing the new workspace and the other one always stays with the same content. Any idea why? And how I can resolve this?


proper permissions under HTTP root with Apache2 + FastCGI + Suexec

I currently have a setup which runs Apache2 + FastCGI PHP + Suexec. As an example, I'm using `/mnt/data/www/vhosts/inflex.co.uk/htdocs` as a DocRoot for one of my virtual hosts. I have a script `/mnt/data/www/php5-cgi/inflex.co.uk/php5-cgi` which contains:                   #!/bin/sh         exec /usr/bin/php5-cgi      The account the scripts should run under is `duncan`, this file is owned by duncan and also in the group duncan. It has `-rwxr-x---` permissions. `.../www/vhosts/inflex.co.uk` and `../inflex.co.uk/htdocs` is owned by duncan and in the group duncan. If I remove all access for others, such as `chmod 750`, I get an error regarding permissions when trying to access the website, if I allow read/write for others, 755 say, it works. I'm assuming this is an issue with `www-data` (apache2 user) accessing the directory, but I thought the point of Suexec was that all of this was ran under a seperate user, or does `www-data` require read (maybe write?) on the folder and then executes PHP php file as the user?


Zsh — more intelligent autocorrection

Is it possible to make Zsh stop trying to correct arguments that are not meant to be files with files from the current directory without turning off correction completely or limiting it to `setopt CORRECT` (only correct the command)? For example, when `CORRECT_ALL` is set with `setopt`, this happens:                gris@arefiev: ~% cd srcc      change srcc to src-nyae? n      So far, good (argument to `cd` should be a file). However,                gris@arefiev: ~% man zile     change zile to .zile-nyae?       What? I would expect it to correct `zile` to `.zile` when `man` is called with `-C` option. It also tries to correct host parameters of `ssh`, first arguments to `sudo` etc which gets really annoying. I have to resort to a crutch: set `alias man='nocorrect man'` etc etc, for every affected command, but clearly it's not the best solution. I also don't like `CORRECT` and would prefer the crutch plus `CORRECT_ALL` to just `CORRECT`. Zsh is `zsh 4.3.17 (x86_64-unknown-linux-gnu)`, Debian sid. **Update** : here is my `.zshrc` http://pastebin.com/67mykgRv


Uninstalling GDB on a Mac

I'm having lots of problems with GDB; usually crashes and starts using 100% CPU until I kill the process using the activity monitor on the Mac (using Mavericks). How do I remove GDB from my machine (using GDB 7.6.1)? I plan to install an older version (GDB 6.x.x) after uninstalling this version.


Thunar file manager: Sort by column keyboard shortcut?

I'm using Xfce 4.3 and the lightweight Thunar file manager. I often change file listings between Sort by Date Modified and Sort by Name. But it seems the only way to do this is by clicking the column header with the mouse, which slows down productivity. Is there anyway to activate these sort mechanisms using the keyboard? They are not listed in any of the menus.


Linux Home Firewall

I was recently delving into thoughts of building a small home server to run random things off of (maybe a TF2 server). Thinking about this further I realized I would need to get a better firewall system for my current home network. I was wondering what would be a good Linux distro to run for a home network firewall? There are a ton of distro's out there, and it is kinda overwhelming when you're new to it. I have looked at Zentyal (previously eBox), SmoothWall, M0n0wall and a couple others. I have little experience in setting up firewalls, but I am willing to do some research into it and give it a shot. I would just like a little help with the starting ground. If someone could provide some pro's/con's of available distro's or some insight on what might be best to set up in a home network it would be appreciated! Thanks!


Is it possible to bind a shell script to a key press

I used xev to find the key code for fn-f5 and came up with a little script to toggle the bluetooth on or off. My question is whether it's possible to bind fn-f5 (keycode 246) to my shell script (bttoggle) using, preferably, xmodmap.


Excessive Samba messages in logs, how to mediate?

Samba is constantly spewing messages into the logs that are of no use. How can I mitigate these messages so that log reporting softwere (logcheck) does not have to report them. The cause of the messages is also somewhat mysterious, so any tips on interpreting them is also welcome. System is latest Ubuntu LTS server.               Jun  3 12:22:43 xxx nmbd[zzz]: [2011/06/03 12:22:43,  0] nmbd/nmbd_browsesync.c:350(find_domain_master_name_query_fail)          Jun  3 12:22:43 xxx nmbd[zzz]:   Unable to find the Domain Master Browser name WORKGROUP<1b> for the workgroup WORKGROUP.          Jun  3 12:22:43 xxx nmbd[zzz]:   Unable to sync browse lists in this workgroup.          Jun  3 12:34:51 xxx smbd[yyy]: [2011/06/03 12:34:51,  0] lib/util_sock.c:539(read_fd_with_timeout)          Jun  3 12:34:51 xxx smbd[yyy]: [2011/06/03 12:34:51,  0]


Trouble installing MySQL from binaries

So, I am a freshman in Computer Science, and I have dug an old computer out of my garage to use as a personal hosting server for various services (email, web site, subversion, etc.), partly because I actually need those things and partially for the learning experience. WOPR (props if you get the reference) is a 10yr+ old Dell Dimension with 256 MB RAM and a 500MHz Intel Pentium III processor. It is running Arch Linux 2010.05 (kernel 2.6.33); I downloaded the MySQL binaries from here just now and tried installing. I am following this procedure from the MySQL docs:                   shell> groupadd mysql         shell> useradd -r -g mysql mysql         shell> cd /usr/local         shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz         shell> ln -s full-path-to-mysql-VERSION-OS mysql         shell> cd mysql         shell> chown -R mysql .         shell> chgrp -R mysql .         shell> scripts/mysql_install_db --user=mysql         shell> chown -R root .         shell> chown -R mysql data         shell> cp support-files/my-medium.cnf /etc/my.cnf         shell> bin/mysqld_safe --user=mysql &         shell> cp support-files/mysql.server /etc/init.d/mysql.server      I get the following messages: > >     WARNING: The host 'WOPR' could not be looked up with resolveip. >     This probably means that your libc libraries are not 100 % >   > > compatible with this binary MySQL version. The MySQL daemon, mysqld, should > work normally with the exception that host name resolving will not work. > This means that you should use IP addresses instead of hostnames when > specifying MySQL privileges ! Installing MySQL system tables... > ./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open > shared object file: No such file or directory >   >   >     Installation of system tables failed!  Examine the logs in >     ./data for more information. >   >     You can try to start the mysqld daemon with: >   >         shell> ./bin/mysqld --skip-grant & >   >     and use the command line tool ./bin/mysql >     to connect to the mysql database and look at the grant tables: >   >         shell> ./bin/mysql -u root mysql >         mysql> show tables >   >     Try 'mysqld --help' if you have problems with paths.  Using --log >     gives you a log in ./data that may be helpful. >   >     Please consult the MySQL manual section >     'Problems running mysql_install_db', and the manual section that >     describes problems on your OS.  Another information source are the >     MySQL email archives available at http://lists.mysql.com/. >   >     Please check all of the above before mailing us!  And remember, if >     you do mail us, you MUST use the ./bin/mysqlbug script! >   I have glibc installed from the latest version of Arch. Does anyone know what libaio.so.1 is, what package it comes from, and what its dependencies might be?


Is there a vim shortcut for <name of current file>?

In vim, if I'm working on a Python script, I will commonly type:               :! python this_script.py      to execute the script. Is there a shortcut for the name of the current file? If not, can I easily make one? I'm new at vim, and I'm not sure how to google for this.


Read/Write to a Serial Port Without Root?

I'm writing an application to read/write to/from a serial port in Fedora14, and it works great when I run it as root. But when I run it as a normal user I'm unable to obtain the privileges required to access the device (/dev/ttySx). That's kind of crappy because now I can't actually debug the damn thing using Eclipse. I've tried running Eclipse with sudo but it corrupts my workspace and I can't even open the project. So I'd like to know if it's possible to lower the access requirements to write to /dev/ttySx so that any normal user can access it. Is this possible?


Nano editor - display not updating with PuTTY

When I use PuTTY to connect to a specific Linux server via the SSH protocol, and I try to edit a file using the nano editor, the "enter" does not update the display. When I press enter to insert another line break, the following lines do not move down. However, if I save the file and re-open it, the new line breaks are there. I have further discovered that this only occurs on the first 3-4 lines of the file. This particular server runs CentOS 6. When I connect to a different server, I don't have the same problem. Where does the problem lie and how do I fix it? Running `infocmp $TERM` reports:               #       Reconstructed via infocmp from file: /usr/share/terminfo/l/linux     linux|linux console,         am, bce, ccc, eo, mir, msgr, xenl, xon,         colors#8, it#8, ncv#18, pairs#64,         acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376,         bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l\E[?1c,         clear=\E[H\E[J, cnorm=\E[?25h\E[?0c, cr=^M,         csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C,         cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, cvvis=\E[?25h\E[?8c,         dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM,         dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K,         flash=\E[?5h\E[?5l$<200/>, home=\E[H, hpa=\E[%i%p1%dG,         ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL,         il1=\E[L, ind=^J,         initc=\E]P%p1%x%p2%{256}%*%{1000}%/%02x%p3%{256}%*%{1000}%/%02x%p4%{256}%*%{1000}%/%02x,         kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B,         kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\E[[A,         kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~,         kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~,         kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, kf20=\E[34~,         kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~,         kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~,         kmous=\E[M, knp=\E[6~, kpp=\E[5~, kspd=^Z, nel=^M^J, oc=\E]R,         op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E[10m,         rmam=\E[?7l, rmir=\E[4l, rmpch=\E[10m, rmso=\E[27m,         rmul=\E[24m, rs1=\Ec\E]R, sc=\E7, setab=\E[4%p1%dm,         setaf=\E[3%p1%dm,         sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m,         sgr0=\E[0;10m, smacs=\E[11m, smam=\E[?7h, smir=\E[4h,         smpch=\E[11m, smso=\E[7m, smul=\E[4m, tbc=\E[3g,         u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?6c, u9=\E[c,         vpa=\E[%i%p1%dd,


Dump process core without killing the process

Is there a way to get a core dump (or something similar) for a process without actually killing the processes? I have a multithreaded python process running on an embedded system. And I want to be able to get a snapshot of the process under normal conditions (ie with the other processes required to be running), but I don't have enough memory to connect gdb (or run it under gdb) without the python process being the only one running. I hope this question makes sense.


Using YUM or installing APT on CentOS

I am having trouble with a centOS machine I am using. I need some packages, including _john the ripper_ , but **`yum`** cannot find the packages. When I type `sudo yum install john`, I get back the _nothing to do_ message. Is there a way to improve the searched locations to install **`john`** or is it possible to install APT on CentOS machines? I know it isn't exactly supported but I am at a loss and do not have the hours necessary to install from source and rpms :(


Install the same 64-bit packages as a 32-bit Xubuntu installation

I have been using a virtual machine (Xubuntu 12.10, with VMWare on a windows host) for all my programming work, which I am trying to transition from a 32-bit install to a 64-bit install. I am hoping to be able to automatically re-install all the packages I have been using in the 32-bit VM in my new 64-bit VM. Reading these instructions, I ran `sudo dpkg --get-selections` to get a list of installed packages, but many of the packages have an `:i386` suffix. Is there an easy way to install the corresponding 64-bit packages? Am I safe to replace `:i386` with `:x86_64` or something similar in my package listing before trying to install them?