creating archive using tar including all 'dotfiles' but excluding all subdirectories and /wo directory structure

I want to backup all the 'dotfiles' (f.e. `.zshrc`) under my home directory with **tar** , but excluding the directory structure and all subdirectories. I've tried it several times with different commands, but the best i achieved was an archive which included the hidden directories under `$HOME` as well.               #!/bin/zsh     BACKUPFILE=dotfile_backup.tar.gz     tar --create --file=$HOME/$BACKUPFILE --auto-compress --no-recursion --exclude=. --exclude=.. --exclude=*/ --directory=$HOME .*      I also thought about using `find` and piping the result to tar, but with no luck. Does somebody know how to achieve this - seemingly easy - task? PS: Most of the time when I'm using tar to create an archive, i have to think about xkcd comic: ![xkcd 1168](http://i.stack.imgur.com/VFqK5.png) :)


Invalid version string 'GNU/Linux'" when creating bootable USB stick

When I tried to create a bootable USB stick using Startup Disk Creator, appear this massege below. Invalid version string 'GNU/Linux'" ![enter image description here](http://i.stack.imgur.com/vQzcU.jpg) How can I create a bootable USB stick on Ubuntu 14.04?


How to get the value from rows and columns from text file in bash?

I am working on a bash project. I need to get all the values (one at a time because I will be using them somewhere else) from a text file. The text file I will be getting is structured like this:               Report:     -----------     Name  Column1  Column2  Column3  Column4     row1  val1     val2     val3     val4          row2  val5     val6     val7     val8          row3  val9     val10    val11    val12        There are no fixed amount of rows and columns so I will need something general. How do I retrieve each val one by one in bash? Thanks.


How to force a particular version of Java?

I am on a RHEL 5.5 64 bit box. The systems engineer installed the 64-bit Java VM under `/usr/bin` ; however, I needed a 32 bit VM which he installed in `/opt/jdk1.6.0_35`. But now, everytime I do `java -version` it shows that I'm using the 64-bit VM. How do I force it to select the 32 bit VM? I changed the PATH to not include `/usr/bin`, but that's where most of the important programs like vi and nano are, and I cannot exclude that. Is there another variable I can add to force it to select the 32 bit VM by default?


Adding a character to every other text line

I have a huge (ca. 20G) text file which contains millions of passages (a.k.a. paragraphs) with headers. Headers and paragraphs are always one line each, e.g., > Sunshine   >  This is a sunny day.   >  Darkness   >  A cave is a dark place. What I try to come up with is a terminal command which goes through the text and adds a '>' in front of every header, i.e., every _odd-numbered line_ (lines 1, 3, 5, …), e.g., > >Sunshine   >  This is a sunny day.   >  >Darkness   >  A cave is a dark place. Any ideas? If this is relevant: the above text was just an example. Most of the headers are MD5s, followed by a DNA sequence ('paragraph'), e.g., > 0002ebd9ca12d6b69dfc3066356fc299   > > CATTAACCATTGGATACCTTCGGGTATATCCCATCCGTGTCTACATACTCTTGTTGCTTTGGCAGGCCGTGGTCACACACTGTGGGCTATGCCTGCATGTGCCTGCCAGAGGACCA … which I'm trying to convert to > >0002ebd9ca12d6b69dfc3066356fc299   > > CATTAACCATTGGATACCTTCGGGTATATCCCATCCGTGTCTACATACTCTTGTTGCTTTGGCAGGCCGTGGTCACACACTGTGGGCTATGCCTGCATGTGCCTGCCAGAGGACCA


Is there a selinux, httpd, or PHP configuration that prevents reading mounted drives?

I'm moving a virtualized centos web server over that has an all-to-small hard drive to a new machine and I hooked up a bigger drive for hosting videos and downloads and stuff. W When I try to run a readfile or filesize or anything from my PHP script, I get the stat failed error telling me I don't have rights to my file. Everything looks like it should work according to permissions (I can even chmod them 777 all and I get the same problem). When I put files in the /mnt folder, I can read them, but if I put them in the mounted /mnt/data folder. Other than file/directory level permissions, are there permissions that need to be granted to allow the apache user/group or the httpd service to be able to communicate with mounted drives. (If this is a security feature, I think it's a great idea, I just need to be able to subvert it in this case)


Finding parentheses with % in vim across lines

In the following text block, starting at 1 or 3, and pressing `%` in normal mode in `vim`, finds the pair of matching parentheses, and toggles between them if you press `%` again. Starting at 1 finds the closing `)` first. Starting at 3 finds the opening `(` first. This is all OK and useful.               Some lines 1 with (stuff 2 in     matching 3 parentheses)      However, starting at 2 and pressing `%` finds nothing. What's going on? _Update_ : other commands such as `vib` can find the `(...)` block from either 2 or 3 (but not 1) which is one way around the limitation, but still curious...


Yast is unable to access software repositories even though URLs are accessible in browser and system date is correct

I am using Yast on OpenSuse 12.1. When trying to install packages from the software repositories, I get an error that the repo cannot be accessed because the network is unreachable: > Download (curl) error for > 'http://download.opensuse.org/update/12.1/repodata/repomd.xml': Error code: > Connection failed Error message: Failed to connect to 2001:67c:2178:8::13: > Network is unreachable I tried accessing this URL in the browser, and it works fine. This question suggests that the system date may have reset itself, but that is not the case for me. While it's a duplicate _question_ , the accepted answer there is incorrect for me.


How to change the color of all highlights in a PDF file?

I want to change the color of every highlight in a PDF file (without having it do for every highlight manually). Preferably with a command line command. Here is an example PDF with a highlighted line.


Unable to mount external USB HDD because of GPT on debian

I have tried to mount an external USB 3.0 hdd on my debian virtual machine (I'm using VirtualBox). I have tried to mount it using `mount /dev/sdb1/ /media/vol1/` but I get the following error:               mount: can't find /dev/sdb1 in /etc/fstab of /etc/mtab      I have tried to use `fdisk -l`, the error I get is the following:                   WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.          Disk /dev/sdb: 1000.2 GB, 1000170586112 bytes     255 heads, 63 sectors/track, 121597 cylinders, total 1953458176 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x00000000             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1               1  1953458175   976729087+  ee  GPT      This is the result of `parted -l`:               Model: WD My Passport 0748 (scsi)     Disk /dev/sdb: 1000GB     Sector size (logical/physical): 512B/512B     Partition Table: gpt          Number  Start   End     Size    File system  Name                   Flags      1      20,5kB  210MB   210MB   fat32        EFI System Partition   boot      2      210MB   1000GB  1000GB  hfsx         Apple_HFSX_Untitled_2      How can I mount the hdd and read its content?


Why does installing to /usr/bin automatically install to /usr/bin/X11?

I am using the command:               install ./prog /usr/bin      to copy the program to the `/usr/bin` directory. Doing this automatically installs the prog to `/usr/bin/X11`. Deleting from `/usr/bin` also automatically removes it from `/usr/bin/X11`. Does my Linux Mint automatically do this? What is the reason for this feature?


Upstart documentation for CentOS 6

I am currently migrating from CentOS 5.5 to 6.4. Having fun converting **/etc/inittab** stuff to upstart. Ran into a lot of little problems but am getting the hang of it now. The best documentation I've found is for Ubuntu: http://upstart.ubuntu.com/cookbook/#id416 It was helpful with various upstart issues I ran into. The only problem is that some of the ubuntu items do not work with CentOS (Can't get logger function to work but found a way around that with 'exec >/dev/kmsg 2>&1'). Is there any CentOS specific documentation out there to help with upstart scripts? CentOS needs the same document that Ubuntu has..Argg!! Since I'm new to upstart, I'm still not sure what the best practices are. The script below seems to work great too. Any comments on it are welcome..Thx!! Here is a script that launches TTYs for modem dialin service to the server. It can launch TTYs for modems connected by USB,Serial,Network modem bank (Digi Port Server). It uses a file maintained by an admin to specify which ttys to launch : **/etc/init/ssi-ttys.conf:**               start on stopped rc RUNLEVEL=[2345]          task     script       #--------------------------------------------------------------------       # The following exec will send the data to the kernels ring buffer.       # Once the syslog daemon starts, this data will be redirected to the       # system log file. So, the echo below will be written out to       # /var/log/messages. Helps out a ton when you need to debug these       # scripts.       #--------------------------------------------------------------------       exec >/dev/kmsg 2>&1       re="^#"       while read line       do         tty=         identifier=         # Proccess /etc/ssi-init-ttys.conf lines without comments         if [[ ! $line =~ $re ]]         then           set $line           tty=$1           identifier=$2           echo "Starting TTY ($tty) ($identifier) using ssi-tty.conf"           #-----------------------------------------------------------------           # Remember that Upstart runs every script section using /bin/sh -e.           # This means that if any simple command fails, the shell will exit.           # So, this is why || true is added to the start so if one of the           # TTYs is already running (Which would normally cause an exit,           # the loop will continue and start other TTYs without exiting.           # Add || true to any system command that might return a code other           # than 0.           #------------------------------------------------------------------           initctl start ssi-tty TTY=$tty IDENTIFIER=$identifier || true         fi       done </etc/ssi-init-ttys.conf     end script      **/etc/init/ssi-tty.conf:**               stop on runlevel [S016]          respawn     respawn limit 5 10     # There's an automatic limit set to this: if a process is respawned more     # than 5 times within 10 seconds, it will be stopped and not restarted.     # Check /var/log/messages and /var/log/mgetty.log.<tty> for error messages     instance $TTY     script       # Regex for serial and USB ttys       reg1="ttyUSB"       reg2="ttyS"       m_flg=""       # Check for USB or serial ttys which use the -D flag for mgetty        if [[ $TTY =~ $reg1 ]] || [[ $TTY =~ $reg2 ]]       then         # Use -D flag with mgetty for ttyUSB and ttyS ports         m_flg="-D"       fi       exec /sbin/mgetty $m_flg $TTY $IDENTIFIER     end script     usage 'ssi-tty TTY=ttyX IDENTIFIER=Z  - ttyX is the tty id and Z is the /etc/gettydefs identifier'      /etc/ssi-init-ttys.conf:               # Serial port TTY     ttyS0 9     # USB port tty     ttyUSB0 9     # Digi port tty     ttyA18 9      **Note:** 9 indicates the appropriate /etc/gettydefs identifier to use for the tty.


Can't resize lvm volume "lv_home is in use. e2fsck: Cannot continue, aborting"

I would like to shrink my logical volume for home directory, so that I can extend volume for root. **`df -h`**               /dev/mapper/vg_mitoscomp-lv_root   50G   33G   15G  70% /     /dev/mapper/vg_mitoscomp-lv_home   53G  180M   51G   1% /home      **`lsblk`**               ─sdc2                                                                      8:34   0 111.3G  0 part       ├─vg_mitoscomp-lv_root (dm-0)                                           253:0    0    50G  0 lvm  /       ├─vg_mitoscomp-lv_swap (dm-1)                                           253:1    0   7.6G  0 lvm  [SWAP]       └─vg_mitoscomp-lv_home (dm-2)                                           253:2    0  53.8G  0 lvm  /home      I can successfully unmount `/home`, but than I can't perform health check nor can I resize volume.               [root@MITOs-Comp ~]# e2fsck -f /dev/mapper/vg_mitoscomp-lv_home     e2fsck 1.41.12 (17-May-2010)     /dev/mapper/vg_mitoscomp-lv_home is in use.     e2fsck: Cannot continue, aborting.                    root@MITOs-Comp ~]# resize2fs /dev/mapper/vg_mitoscomp-lv_home 10G     resize2fs 1.41.12 (17-May-2010)     resize2fs: Device or resource busy while trying to open /dev/mapper/vg_mitoscomp-lv_home     Couldn't find valid filesystem superblock.


"Self-test Failed" in Disks

On Lubuntu when I open "Disks", it says "80 GB Hard disk" in red, followed by " **SELF-TEST FAILED** ". What's wrong? How do I fix it?


Automate DISA STIG controls for RHEL/CentOS?

I am deploying systems that must be configured using the Red Hat 6 (v1r2) Security Technical Implementation Guide(STIG) published by the Defense Information Systems Agency (DISA). Link to site. I've started developing a Kickstart file to automate many of these settings based on other KS files I've found via Google. Does anyone have any advice, additional tools, or other resources that will help? I do not _need_ to use Kickstart, it just seemed like the easiest way to get started. I'm looking for any resources: playbooks for Ansible, basic shell scripts, etc.


how to synchronize two directory?

I want to using crontab to synchronize two directory between my linux partion and windows partion like this:               24 9 * * * cp -r /home/fan/Data /media/T/Data      But it would create a directory named Data in the origin Data directory, instead of copy the missing file from the source directory. I can't find a proper option at the cp manual to perfectly solve this. How can i copy the missing file(they do exist at the destination directory) from the src to dir. And by the way, seems it need the T disk have been mounted to run the copy command, how to automatically mount the disk when i need to run the command(the mount command should run as root). And how can i get the error message if the command have an exception?


Ubuntu 12.04.1 LTS - /boot is using 98.4% of 193MB

I have a problem. I have noticed that my VPS is saying : > => /boot is using 98.4% of 193MB Looks like something went wrong, doesn't it? I have tried to run `dpkg -l | grep linux` to check what's there. Here is the output:               ii  libselinux1                        2.1.0-4.1ubuntu1             SELinux runt                                                                                ime shared libraries     ii  linux-firmware                     1.79.7                       Firmware for                                                                                Linux kernel drivers     iU  linux-generic-pae                  3.2.0.56.66                  Complete Gen                                                                                eric Linux kernel     ii  linux-headers-3.2.0-45             3.2.0-45.70                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-45-generic-pae 3.2.0-45.70                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-3.2.0-48             3.2.0-48.74                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-48-generic-pae 3.2.0-48.74                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-3.2.0-51             3.2.0-51.77                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-51-generic-pae 3.2.0-51.77                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-3.2.0-52             3.2.0-52.78                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-52-generic-pae 3.2.0-52.78                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-3.2.0-53             3.2.0-53.81                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-53-generic-pae 3.2.0-53.81                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-3.2.0-54             3.2.0-54.82                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-54-generic-pae 3.2.0-54.82                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-3.2.0-55             3.2.0-55.85                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-55-generic-pae 3.2.0-55.85                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-3.2.0-56             3.2.0-56.86                  Header files                                                                                related to Linux kernel version 3.2.0     ii  linux-headers-3.2.0-56-generic-pae 3.2.0-56.86                  Linux kernel                                                                                headers for version 3.2.0 on 32 bit x86 SMP     ii  linux-headers-generic-pae          3.2.0.56.66                  Generic Linu                                                                                x kernel headers     ii  linux-image-3.2.0-29-generic-pae   3.2.0-29.46                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     ii  linux-image-3.2.0-45-generic-pae   3.2.0-45.70                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     ii  linux-image-3.2.0-48-generic-pae   3.2.0-48.74                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     ii  linux-image-3.2.0-51-generic-pae   3.2.0-51.77                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     ii  linux-image-3.2.0-52-generic-pae   3.2.0-52.78                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     ii  linux-image-3.2.0-53-generic-pae   3.2.0-53.81                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     ii  linux-image-3.2.0-54-generic-pae   3.2.0-54.82                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     ii  linux-image-3.2.0-55-generic-pae   3.2.0-55.85                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     iF  linux-image-3.2.0-56-generic-pae   3.2.0-56.86                  Linux kernel                                                                                image for version 3.2.0 on 32 bit x86 SMP     iU  linux-image-generic-pae            3.2.0.56.66                  Generic Linu                                                                                x kernel image     ii  util-linux                         2.20.1-1ubuntu3              Miscellaneou        What can I do to solve this problem? What may I safely remove?


What is the keyboard shortcut opposite to Ctrl+k?

`Ctrl` + `K` deletes rest of line in an UNIX command line. How do I delete all the text _before_ the cursor?


"mke2fs -r fs-revision-level" - how is this used?

`mke2fs -r` offers > Set the filesystem revision for the new filesystem. Note that 1.2 kernels > only support revision 0 filesystems. The default is to create revision 1 > filesystems. Trying to look up what was meant by that I found loads of screenshots etc. of `dumpe2fs`containing the line > Filesystem revision #: 1 (dynamic) ## Question: _What does that mean? What does the option actually do and what is meant with this output?_ Where is documented what a value of zero would mean, what _dynamic_ actually means; and is there a value of two also? I could live with » _keep untouched as you won't ever need to change it_ « - but as there is an option for that and no note about backward compatibility, this makes me wonder…


Append output to a file and redirect stderr to null

How can I append the result of a command to a file and redirect stderr to null?


How do I tell `ps` to use all available columns?

To specify columns, I can use `ps`'s `-o` option:               ps -o pid,cmd      How can I tell `ps` to output all of its available columns?


Running C Programs on Linux

I watched a video lecture today that introduced C and things like how to make a C program that will run in Linux. I followed the steps given and now I'm stuck with a bit of a problem. I created my C file (HelloWorld.c) and used the command `gcc -o HelloWorld HelloWorld.c` to compile the file, both of these steps were successful. Afterwards I checked to make sure that HelloWorld had been created by using the command `ls`, and it had been. However, when I use the command `HelloWorld`, which is supposed to run the program, I get an error that says `HelloWorld: command not found`. In the video lecture the professor did mention that this worked for 32-bit systems and I'm using a 64-bit system. Perhaps this could be the problem? EDIT: Also in the video lecture the professor mentioned that when I use the command `ls` I should see `HelloWorld*`. I see only HelloWorld (without the star).


Terminal command vs. GUI drag & drop when copying large no. of files: Any tangible benefit?

I'm finding myself in a terminal more and more often these days as I learn to do certain types of things quicker or more conveniently. However, when it comes to copying a large amount of data (i.e. hundreds of gigabytes) from one HDD to another, I always revert to the GUI (Nautilus or Finder in my case; the file systems are ext4 or HFS+). What I have in mind is the initial copying of data to a new larger HDD that's replacing an older one, or to an external back-up HDD. Are there any tangible benefits to be had using terminal commands in this setting? If so, what are they? **EDIT** Sometimes with these large GUI copies it'll get tripped up somewhere along the way due to a corrupt file or for some other reason. I guess I was wondering if terminal commands, rather than the GUI method, can avoid this problem. It's often quite difficult to determine where the GUI copy has got to, where to resume, and which files are causing the issues. To my eyes at least, these copies seem a little bit random as to where they start and end.


No window menus in freenx

I recently upgraded an openSUSE 11.3 install to 11.4 by downloading the DVD, burning it, & chosing the upgrade option upon booting to it. I used all the upgrade defaults. Upon coming back up, I added the FreeNX zypper repository & installed the latest FreeNX. Connecting via FreeNX works, but I'm not able to see any window menus on any of my applications. They get stuck to the top left corner of the screen &/or they don't have the window border surrounding the window (as in the top bar that contains the minimize/maximize buttons). I've verified it's not a user problem because I created a new user & logged in as the user for the first time & it still happened to that user too. *** EDIT *** Client is OS X 10.6.7 using NX Client by NoMachine, ver 3.4.0-8. I should also point out I have other servers running FreeNX that still work fine, none of which are openSUSE 11.4 however. I think it is an openSUSE 11.4 specific problem. *** EDIT 2 *** Desktop environment on openSUSE is Gnome (whatever the standard is for 11.4). Window manager is the default, so I guess Nautilus. I should point out that it works fine locally & with VNC, so it must be a FreeNX problem... *** EDIT 3 *** This is what I'm seeing: ![enter image description here](http://i.stack.imgur.com/s0GBF.png)


Where did Trampoline.S go?

Dear all, I was wondering where the trampoline code went. It is referenced here, and I could find some code in an earlier distro, but I can't find it in the 2.6.38 kernel. Can you explain to me the path of execution, if `trampoline.S` is not there anymore? Thanks.


Hiding data in filesystems

I want to hide some files such that not even 'ls -a' can find it. I'm not talking about adding '.' in front of the filename. I was thinking if I could create separate system calls for accessing those files The actual need is to hide some log files from the user. I'm storing the MAC data of some files and don't want the user to see those log files. At present I know only one way to hide data,i.e, by adding '.' in front of filename. But the file can be seen by the user by the simple call ' ls -a'. So I want to know if there is any other way to hide those log data?


How to trick an init script into returning 0

I have a init script which is poorly designed because it does not conform to the Linux Standard Base Specifications The following should have an exit code of 0 if running, and 3 if not running               service foo status; echo $?       However because of the way the script is designed, it always returns a 0. I can not fix the script without a significant rewrite (because service foo restart is dependent on service foo status). How could you work around the issue so that `service foo status` returns a 0 if running, and a 3 if not running? What I have so far:               root@foo:/vagrant# service foo start     root@foo:/vagrant# /etc/init.d/foo status | /bin/grep "up and running"|wc -l     1     root@foo:/vagrant# /etc/init.d/foo status | /bin/grep "up and running"|wc -l;echo $?     0 # <looks good so far          root@foo:/vagrant# service foo stop     root@foo:/vagrant# /etc/init.d/foo status | /bin/grep "up and running"|wc -l     0     root@foo:/vagrant# /etc/init.d/foo status | /bin/grep "up and running"|wc -l;echo $?     0 # <I need this to be a 3, not a 0


Zsh possibly adding quotes to variable value (works in bash though)

I'm fairly new to zsh (shifted yesterday from bash) I had a bash function in bash like               vl() { cmd=`echo $1 | sed -r 's/(.+):([0-9]+).+/\1 +\2/g'`; vim $cmd }      This basically converts a argument like:               vl ./manifests/production/test.pp:387:foobar  # A output of $grep -iHn test       to               vim ./manifests/production/test.pp +387   #Aim is to open file at line-number 387      The same function in zsh doesn't work as expected. It opens a file named `./manifests/production/test.pp +387` in vim instead of opening a file named `./manifests/production/test.pp` with `+387` appended to it. Seems like, it's adding the quotes to `$cmd`. It would be great if someone explains what's happening here. Thanks


Where kernel configuration file is stored?

I currently run Angstrom Linux 2.6.32. I intend to upgrade linux kernel from 2.6.32 to 3.0.7. For this reason, I had to configure kernel 3.0.7 running `make menuconfig`. Now, I want to compare the new kernel configuration with the previous, but I can't find kernel 3.0.7 configuration file. Any ideas?


Install-on-Demand Wrapper Function for Executables

How do I make the following function work correctly               # Install git on demand     function git()     {         if ! type git &> /dev/null; then sudo $APT install git; fi         git $*;     }      by making `git $*` call `/usr/bin/git` instead of the function `git()`?


How to make a script run at boot time in Debian Wheezy?

I am writing a script to do some tasks at boot up time in my Debian Wheezy AWS EC2 AMI. Sources on the internet say that usual way to do this is to use `update-rc.d` to install the symlinks needed to set it up to run at boot time. However, when I try this, I get the error               $ update-rc.d     -bash: update-rc.d: command not found      This method has been working for me till Debian Squeeze. Has the standard way to do this changed in Debian 7.0? I am not able to find any documentation that explains how to do it in the official way.


Pamtester automate password testing

We have a system image which uses a default password for root. This _should_ be changed, though I have a feeling not all users do this. I know I can test login with pamtester:               # pamtester system-auth root authenticate     Password:      It asks for the password on the command line. I want to automate this. Can this be done?


Uninstalling LDAP on Fedora

I'm attempting to maintain a legacy collection of Fedora VMs, all configured to a old LDAP server. However, it's very touchy, and whenever the VM running the LDAP server is slow or unresponsive for any reason, everyone gets locked out of the entire system, since no one can login. As I no longer have the manpower to manage such a complicated setup, I want to completely remove LDAP as the single point of failure, and simply use SSH keys to login to the VMs, so if one VM is down it won't disable all the others. As I'm the only person who ever logs into these systems anyways, having LDAP is overkill. What's the easiest way do do this? I tried the obvious `yum remove openldap` but that attempted to uninstall nearly all packages, including yum. I currently can't login to any of them, so I have to boot each VM in single user mode and start its network interface.


Are the crontabs of users linked?

Our Linux server has a community user that has a crontab for itself. The admins don't want me to schedule my scripts on their crontab because they don't want to take responsibility for my programming. Different department, Fair enough. I suggested that I use my own users crontab to schedule my programming and now the aren't certain that if my crontab failed, theirs wouldn't too. Please tell me they aren't linked. Isn't that one of the purposes for having the ability to make multiple crontabs?


What do the kernel parameters acpi_osi=linux and acpi_backlight=vendor do?

I had troubles with the screen brightness control in my laptop and I fixed it by adding the `acpi_osi=linux` and `acpi_backlight=vendor`parameters to the file`grub.cfg`. I'd like to know what these parameters mean and why they work.


How does Linux manage fonts?

When I used Windows (a very very long time ago!), and Mac OS X, there was always a central "repository" of fonts shared and accessed by the OS and all programs (the font folder in Windows, and Font Book in Mac OS X). How are fonts managed in Linux? Is there also a central store for fonts that all programs (the shell with no X, with X, window managers, other GUI software) can use? Or are fonts managed separately? What can I do to efficiently and easily manage my fonts in Linux?


Network Filesystem + Local Access

I need to set up a network fs, so that I can mount a directory from `Box A` on to `Box B` and `Box C`. However, I need those files to not be transferred from `Box A` upon every access request; basically, I need the files cached locally, and only updated when "pushed" from `Box A`. Any suggestions?


I can't delete a file that I have write permissions for as a group member

$ touch testfile     $ chmod g+w testfile     $ sudo adduser user2 user1     $ stat -c'%a %A' testfile     664 -rw-rw-r--     $ su user2     Password:      $ groups     user2 user1     $ rm testfile      rm: cannot remove `testfile': Permission denied      What is missing?


Cannot change brightness after standby or logout

Laptop: Toshiba R630     http://www.linlap.com/toshiba_portege_r700-r705     OS: Mint 14, Cinnamon           $ lspci | grep -i vGA     00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)      Apart from the commonly reported problem of loss of brightness level, I cannot change my brightness at all once I recover from stand by. If I use 'brightness and lock' and try to move the slider, the brightness never change. I have seen multiple threads related to the problem. I have tried a few suggested fixes but I could not get it to work. It looks like for an average linux user like me the solutions described are not much understandable. Can someone explain or point to right documentation to understand the problem related to setting/modify display brightness? # 1. xrandr               xrandr --output LVDS1 --brightness 0.8      this works but what i do not understand is when I bring the value below 1.0 (max brightness), the screen is not convenient to look at. I am unable to describe technically which constituent related to brightness is not correct. # 2. acpi               echo 7 > /sys/class/backlight/acpi_video0/brightness      i tried this solution but it does not change brightness # 3. toshset               $ toshset     required kernel toshiba support not enabled.      Not sure what to do with the above. # 4. setpci               rag@rag-tos-laptop:~$ sudo lspci | grep VGA     00:02.0 VGA compatible controller: Intel Corporation Core Processor         Integrated Graphics Controller (rev 02)     $ setpci -s 00:02.0 F4.B=80     pcilib: Cannot open /sys/bus/pci/devices/0000:00:02.0/config      but something seems to be different for my laptop


How to more easily specify tasks for batch, using command prefix tool?

The tool `batch` that comes with the `atd` daemon is pretty useful in principle, running commands only when the system utilisation falls below a certain level (by default, 1.5). However, using it (and also `at`) is pretty ugly by modern standards: you either have to feed a script which can be run by `/bin/sh`, or type commands interactively into a basic prompt with no completion, color-coding, etc. What would be really nice is a command prefix tool, more like `nice`, that one can put in front of any command to add it to the batch queue (and a similar utility for `at` would be handy, although that's not the main point of my question). For example, it might work like this: `my-batchifying-command python some_longrunning_computational_script.py` Does such a thing exist? If not, how might it be created? I use `zsh` for my main shell, but a `bash` answer would be equally OK and might have wider applicability.


Using $ in a password

Lets assume that password of my server is `Abcd$1234` I am trying to ftp a file from other server to my server using the following in shell script               ftp -inv (IP) << EOF     user Username Abcd$1234          "lines to ftp file"          bye      I am unable to ftp. I tried replacing password as `Abcd\$1234` and also `"Abcd\$1234"` but no use. But I am able to login to my server without ftp (just to verify whether password is valid or not) Can anyone please help. I want to use `$` in my password at any cost


How do I configure mailutils pop3d to not set the flags on the mailspool?

How do I configure mailutils pop3d to not set the flags on the mail spool to read? I could not find a setting for this in the documentation. I am using an android (stock) MUA and this does not seem to have an option for this setting. The user functionality I am seeking is that the mail must remain as _unread_ on the server so that when I use my _official_ application, then I see mails as _unread_ even though I may have read them _on the go_ as it were. Thanks for any suggestions.


Asus USB N10 wireless adapter works on Ubuntu but not Fedora

I could make it work in Ubuntu, due to this answer. But the same approach shows no result in Fedora 15 (64 bits). The device is an Asus USB N10 (wireless-usb converter): Bus 001 Device 003: ID 0b05:1786 ASUSTek Computer, Inc. Any idea how to make it work? Fedora doesn't come with this driver?


Are limits in linux (like those controlled by ulimit or /etc/security/limits.conf) per user or per user per process?

I saw three copies of a process running and one of them cored in what seems like memory issue. Each individually occupies about 3-4 GB of memory..would a limit account for killing one of them? And if this was the case which one would be killed?


Ignorantly dd'd /dev/sda*

I was trying to write an iso to a flash drive. I mistakenly thought that all /dev/sda* are flash drives attached to the system. I wasn't sure how to figure out which was which, so I just unplugged my flash drives and overwrote them all. In retrospect.... this was unbelievably dumb. So I now have a non-booting system (grub-rescue prompt at boot). I do have an eeebuntu iso on a flash, so I can boot into linux off that, but I'm at a loss. I have a windows partition on the first part of the drive, then the Ubuntu install, but GParted is showing a single 500GB unallocated partition. I would greatly appreciate advice... I have no idea where to start.


How to display result of df every 30s?

All I want to see is the % after I issue `df /` every 30s but on the same line just after the previous number. So the final output would be `86% 86% 86% 87% 87% ......` Could it be one line code? Or multiple line 'program'?


How can I do the equivalent of tail -f with ls?

> **Possible Duplicate:**   >  Is it possible to follow a command (run repeatedly)? as one would follow a > file using tail -f? I would like to monitor files that are being downloaded to a directory in real time on screen in bash. Is there an easy way in Linux to do the equivalent of `tail -f` but on a directory, perhaps using ls?


Can I install "development-tools" offline? Or, how to make my CD the yum repository?

I'm looking for the "development-tools" for Fedora, but I can't find information about how/where to download it to install offline (I have no internet connection in my Fedora). **Attempt 1:** There's a hint here about how to use the DVD as repository, but I don't have the `media.repo` in the root of my Fedora 15 DVD.. any idea where's it? **Attempt 2:** I also found this image, in a page saying that I can choose during the installation to install the development-tools. But I just re- installed Fedora paying attention, and didn't saw that screen or that option.. **Attempt 3:** I found this approach, but it requires to install the `createrepo`, and I can't install a thing here.. **Using Bakha Nurzhanov's approach:** Mount your DVD media: mount -r /dev/cdrom /media/CentOS Create file /etc/yum.repos.d/CentOS-Media.repo with the following content:               [c5-media]     name=CentOS-$releasever - Media     baseurl=file:///media/CentOS/     gpgcheck=0     enabled=0      Use your DVD to install "Development Tools"               yum --disablerepo=\* --enablerepo=c5-media groupinstall "Development Tools"      On this last step I got:               $ yum --disablerepo=\* --enablerepo=c5-media     Loaded plugins: langpacks, presto, refresh-packagekit     file:///media/CentOS/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/CentOS/repodata/repomd.xml     Trying other mirror.     You need to give some command     Usage: yum [options] COMMAND      I checked, really there's no repodata folder or repomd.xml file.. Here's the DVD tree:               $ tree     .     ├── EFI     │   └── boot     │       ├── bootx64.conf     │       ├── bootx64.efi     │       ├── grub.conf     │       ├── initrd0.img     │       ├── isolinux.bin     │       ├── isolinux.cfg     │       ├── memtest     │       ├── splash.jpg     │       ├── splash.xpm.gz     │       ├── vesamenu.c32     │       └── vmlinuz0     ├── GPL     ├── isolinux     │   ├── boot.cat     │   ├── initrd0.img     │   ├── isolinux.bin     │   ├── isolinux.cfg     │   ├── memtest     │   ├── splash.jpg     │   ├── vesamenu.c32     │   └── vmlinuz0     └── LiveOS         ├── livecd-iso-to-disk         ├── osmin.img         └── squashfs.img          4 directories, 23 files      Is my version of the DVD different of your? I downloaded the lastest from the site..


How to set default file permissions for all folders/files in a directory?

I want to set a folder such that anything created within it (directories, files) inherit default permissions and group. Lets call the group "media". And also, the folders/files created within the directory should have g+rw automatically.


Pre-defined umask under a given path

> **Possible Duplicate:**   >  How to set default file permissions for all folders/files in a directory? Say I have default umask, `umask1`. I would like all files/folders that I create/modify under a specific path               /path/to/foo      to have a different umask, `umask2`, and keep using `umask1` for everything else. Is there a way to have the shell do this automatically for me? If so, how? Is there a way to do this for everyone else who belongs to the groupID of `/path/to/foo`?


Gnome 3 always on fallback upon login

I have a Debian Wheezy install, with Gnome 3 as the windows manager. I also have a NVidia video card for what it matters. I autolog in gnome upon boot to my user account, but it always start gnome in fallback mode. After I logout and relog again in the same account (without changing options in the login windows), then it starts gnome 3 properly. I was wondering if this could be linked to 3D rendering, but: `|> cat /etc/X11/xorg.conf` [...]               Section "Device"         Identifier     "Device0"         Driver         "nvidia"         VendorName     "NVIDIA Corporation"     EndSection          Section "Screen"         Identifier     "Screen0"         Device         "Device0"         Monitor        "Monitor0"         DefaultDepth    24         SubSection     "Display"             Depth       24         EndSubSection     EndSection      and `glxinfo | grep -e "direct " -e" renderer"`               direct rendering: Yes      OpenGL renderer string: NVS 4200M/PCIe/SSE2


Finding the current speaker volume (signal strength)

I'm trying to create a widget for awesome wm that controls and monitors volume. Getting and setting the speaker volume is easy in ALSA and PulseAudio, but how about getting the actual signal strength? By this I mean the actual noise you hear, e.g. if no sound is playing it is zero. Just like you would see of an amplifier (the VU-monitor). Usually I can manage to find a file in `/proc/` that holds some value as to what is being used (eg. `/proc/stat` for cpu usage), but this is not the case this time. The goal is really to show a real-time audio display (preferrably separate L/R channels) that resembles the gain VU-monitor from an amplifier. _note that the question is not about how to program this for awesome wm, but how to get the values that can be used to do it_


FTP bulk download and rename

First of all: Why I'm trying this? Because we need to download some files AND rename to shorten ones with date "stamps". The remote files have really huge filenames and it's not an option to change(isn't our ftp). I'm trying to make a bulk download and rename of some files in a remote ftp server, without having to open one ftp connection to each file I have to download. So far, i could achieve renaming and download on-the-fly with `nmap` ftp command, renaming every file that starts with "N" and ends with ".TXT" to "N_date_time_stamp.TXT"               ftp -niv $url << FTP_COMMAND             user $user $password             cd $remotedir             nmap N*.TXT N_`date "+%H%M%N"`.TXT             mget N*             bye     FTP_COMMAND      The problem is: nmap keeps the same %N value to all files passed to mget, and it should change on every download to the current nanosecond value:               250 CWD command successful.     local: N_1054232349627.TXT remote: NO2346662345257245624572457245724562411125555341346134771345123461146-44.TXT     227 Entering Passive Mode (xxxxxxxxxxxxxxx).     125 Data connection already open; Transfer starting.     226 Transfer complete.     2220 bytes received in 0,0995 secs (22 Kbytes/sec)     local: N_1054232349627.TXT remote: NO2346662345257245624572457245724562411125555341346134771345123461146-45.TXT     227 Entering Passive Mode (xxxxxxxxxxxxxx).     125 Data connection already open; Transfer starting.     226 Transfer complete.     2220 bytes received in 0,107 secs (20 Kbytes/sec)      Is there a way to update the `nmap` on each download?


vim - how can i do a 'change word' using the current paste buffer

I have some text in my paste buffer, e.g. I did a `yw` (yank word) and now I have 'foo' in my buffer. I now go to the word 'bar' and I want to replace it with my paste buffer. To replace the text manually I could do `cw` and then type the new word. How can I do a 'change word' but use the contents of my paste buffer instead of manually typing out the replacement word? The best option I have right now is to go to the beginning of the word I want to replace and do `dw` (delete word), then go to the other place and do the `yw` (yank word), then go back to the replacement area and do `p` (paste) which is kinda clumsy especially if they are not on the same screen.


Why can't I run Gnome apps over remote SSH session?

Logging into a remote host using `ssh -X me@host`, I successfully run `gnome- terminal -e "tail -F /var/log/file" &`. When I log off and then try the same thing the next day, I get this: > Failed to get the session bus: Failed to connect to socket > /tmp/dbus-K99gT9yDjS: Connection refused Falling back to non-factory mode. > Failed to summon the GConf demon; exiting. Failed to contact configuration > server; some possible causes are that you need to enable TCP/IP networking > for ORBit, or you have stale NFS locks due to a system crash. See > http://projects.gnome.org/gconf/ for information. (Details - 1: Failed to > get connection to session: Failed to connect to socket /tmp/dbus-K99gT9yDjS: > Connection refused) How do I run gnome-terminal in this situation?


How to display technical codec info for a FLAC file?

Given a `.flac` file, how is it possible to query and display the technical info relating to the codec? I looked into `man flac` with no luck (the `\--analyze` output is not humanly parseable). I'm specifically interested in the **bit rate** (say, 16 bits per sample), the **sample rate** (say, 44.1 KHz) and the **number of channels**. Either GUI or CLI utilities are acceptable.


Why is my embedded Linux unable to detect the sd device?

I have this ARM9 SAM9G25 embedded System, running a Linux 2.6.39 Kernel and a Busybox. I put the Images (of the bootloaders, and the linux+initramfs) on a SD so that in the end the system is booting from it - this works no problem so far. Now when I try to get access of the SD card in Linux or Busybox then the problem starts. It's not there no entry in               ls /dev      about `mmcblk0p1`, `mmcblk0`, `sdb` or anything else related. But with               cat /proc/devices      in the last line there is               179 mmc      I guess the 179 is the major number, so I tried to add it to the device_table, so that buildroot generates the `mmcblk0p1` for the next image               /dev/mmcblk0p1 b 755 0 0 179 0 - - -      > (that's respectively: 'name' 'type' 'mode' 'uid' 'gid' 'major' 'minor' > 'start' 'inc' 'count') but nothing changed again the drivers are selected in Linux menuconfig. Does anyone know why I can't even see the SD Card/Device?


Write default array to variable in Bash

I was expecting               excludes="${excludes:-( ${default_excludes[@]} )}"      to be an array if `$excludes` is empty. Unfortunately the stuff after `:-` is taken to be a string. Did I miss some syntax contortion, or do I have to use the clunky               if [ -z "${excludes:-}" ]     then         excludes=( "${default_excludes[@]}" )     fi      ?


Uncommenting multiple lines of code, specified by line numbers, using vi or vim

I have learned from this Stack Overflow question that it is possible to use `vi`/`vim` to comment out a specified range of line numbers. For example, suppose I have the following bash script:               #!/bin/bash          This     is     my     very     very     great     script      Now suppose that I want to comment out line numbers 6 through 8 (which contain the words `very`, `very`, and `great`) using the `#` comment character. In `vi`/`vim`, I can simply type `:6,8s/^/#` to obtain the following:               #!/bin/bash          This     is     my     #very     #very     #great     script      which comments out lines 6 through 8. My question is, is it possible to type a similar one liner that will **_remove_** the `#` comment character from lines 6 through 8 (but not any other commented lines in the file)? Having said this, I realize that there is some debate about whether I am actually using `vi` or `vim`. In practice, I open a file `script.sh` with the command `vi script.sh`. Also, when I type the command `which vi`, I obtain `/usr/bin/vi`. Nevertheless, when I simply type `vi` and press `Enter`, I obtain this:               ~                              VIM - Vi IMproved     ~     ~                               version 7.2.330     ~                           by Bram Moolenaar et al.     ~                 Vim is open source and freely distributable     ~     ~                           Sponsor Vim development!     ~                type  :help sponsor<Enter>    for information     ~     ~                type  :q<Enter>               to exit     ~                type  :help<Enter>  or  <F1>  for on-line help     ~                type  :help version7<Enter>   for version info      which seems to suggest that I'm actually using `vim`. I am accessing a remote Ubuntu Linux cluster using SSH from my PC. I am not using a Ubuntu Linux GUI.


Why wasn't `creat` called `create`?

Was it just to save typing one letter? I don't think C function names were limited to five characters at the time, as `strcmp` and `unlink` are probably just as old. I'm hoping someone who was involved said something on the record about this, but I haven't been able to find it. This is not the same as asking 'What did Ken Thompson mean when he said, “I'd spell create with an 'e'.' because it is a different question with a different answer.


What is a Transaction Check Error ? (yum update)

I tried today to replace packages from atomiccorp's repositories with newer packages from the epel/remi repositories and received `Transaction Check Error`s. I cannot proceed with my update.               Install       5 Package(s)     Upgrade      23 Package(s)          Total size: 24 M     Is this ok [y/N]: y     Downloading Packages:     Running rpm_check_debug     Running Transaction Test     Finished Transaction Test               Transaction Check Error:       file /etc/php.ini from install of php-common-5.3.6-1.el5.remi.x86_64 conflicts with file from package php-common-5.2.17-1.el5.art.i386       file /usr/share/man/man1/php.1.gz from install of php-cli-5.3.6-1.el5.remi.x86_64 conflicts with file from package php-cli-5.2.17-1.el5.art.i386          Error Summary     -------------      What is a `Transaction Check Error` and how can I fix it ?


configure python3-tk for manually installed python 3.4 debian wheezy

On wheezy apt packaging python3-tk requires python3.2 & python3 packages. I want python 3.4 and have built it manually. The trouble is I don't know how to get my manual 3.4 build to 'see' the python3-tk install - when trying to import tkinter I get:               Traceback (most recent call last):       File "/myscript.py", line 9, in <module>         import tkinter as tk       File "/opt/python3/lib/python3.4/tkinter/__init__.py", line 38, in <module>         import _tkinter # If this fails your Python may not be configured for Tk     ImportError: No module named '_tkinter'      if I start the system python3 interpreter and import tkinter it will load the module. I have my 3.4 manual build installed to a dir in /opt/. How do I get it to see the apt-installed tkinter?


Make a windowmanager/desktop (Gnome) use only a part of an X11 server's (Xvfb) resolution

I have the following problem: Let's say I have an X11 server (it is the Xvfb) set to run at a resolution of 1024x768. Now I want to run inside it the Gnome desktop, not at the resolution of 1024x768 but, lets say, 640x480 with the condition that the Gnome desktop is centered inside the X11 space. Anyone knows how to do that? I have tried passing gnome-session the parameter --geometry but it does not like it. Just In case it matters: The system is a Centos 5.5 with the latest updates installted. Thanks in advance!


where can i find the good man pages?

I have read the man pages that have come along with the red hat os.But it takes too long to understand the documentation. I want to know about the good sites which provide more clear man pages.


PAM authentication program in C recognizes only the logged in user

I am trying to write a C program to authenticate users using PAM. Here is what I have at present:               #include <security/pam_appl.h>     #include <security/pam_misc.h>     #include <stdio.h>          int main (int argc, char* argv[])      {       pam_handle_t* pamh;       struct pam_conv pamc;            /* Set up the PAM conversation.  */       pamc.conv = &misc_conv;       pamc.appdata_ptr = NULL;       /* Start a new authentication session.  */       pam_start ("su", argv[1], &pamc, &pamh);       /* Authenticate the user.  */       if (pam_authenticate (pamh, 0) != PAM_SUCCESS)         fprintf (stderr, "Authentication failed!\n");       else         fprintf (stderr, "Authentication OK.\n");       /* All done.  */       pam_end (pamh, 0);       return 0;     }      This works correctly and authenticates the user I am currently logged in as. It does not recognize any other user on my system and says authentication failed even after providing correct login details.      What am I missing ? **Edit :**   From further reading I think this is because only the user who starts the application is able to authenticate. But I still don't know how to switch users in that case. The attempt is to do something like this:                 su temp     Password:      and eventually switch users.


vim colors not automatically loaded (probable Vundle conflict)

I've been trying to port my Windows .vimrc to Linux, to use on the command line (on gnome-terminal). Everything works fine, except for the colorscheme. It looks like it's loaded (`:colorscheme` returns `solarized`; `:set t_Co` returns `t_Co=256` and `:set background` returns `background=light`), but it looks ugly on my terminal. If I run any of those commands again manually (either setting `colorscheme`, `t_Co` or `background`), then the theme displays normally. This is the .vimrc.bundle that's sourced on my .vimrc GVim also behaves normally. I tried other terminals (xterm, urxvt, screen), but none worked. **Edit:** Looks like there's some sort of conflict with a plugin loaded by Vundle. If I comment out the `source ~/.vimrc.bundle`, the colorscheme is loaded properly.


Linux 0.0.1 Kernel - Starting Kernel Programming

To start kernel programming, instead of reading the books, the online references suggested to download the linux 0.0.1 source and find bugs.   I have downloaded it and I am going through the code with parallel reading of "UNIX internals" by Bauch.   Now, the latest kernels will be far more advanced then this. But at the same time reading Robert Love's book, doesn't give me a clear picture, as the code is not compiled and executed.   How can I test this kernel using my Ubuntu distribution in a way that will not affect my installed system?


difference tun/tap, is the interfaces that handle protocols or the OS?

I have difficulties to understand difference between tap and tun interface. I know it is an often asked question and I apologize for that. I asked the same questions on stackoverflow and someone told me to try this forum so I hope I'm in a good place. Moreover, I'm only curious about networks but I'm not a network student or professional so forgive me if my questions are too easy for you. I read tap work at layer 2 and tun works at layer 3. I also read that tap is used for bridging and tun is used for routing. I already heard things like "ROUTERS work at layer 3" or "BRIDGES work at layer 3" : this make sense for me because routers manipulate layer 3 protocols and bridge manipulate layer 2 protocols? but, because tap and tun are "interfaces", it means the sentence like "INTERFACES work at layer 3" has a sense but i don't understand what it is : I mean interfaces doesn't manipulate protocols(the OS do that but not an interface) so it sounds like tun interface == tap interface: If I create two tap interfaces(with tunctl) with two ip that are on different networks (192.168.2.1/24 and 192.168.3.1/24), then I link these to two kvm virtual machine (one tap interface match to one VM) and if I enable routing on the host, my two VM can communicate. So tap interfaces can also be used for routing : what is the difference with tun ? maybe a tap is also a tun interface? Also I can create a tap interface with tunctl command but how can I create a tun interface with the same command(the command is called TUNctl not TAPctl...)? Moreover someone told me : > a TUN device is a virtual Ethernet adapter whereas a TAP device is a virtual > point-to-point IP link (in case these don't make sense, ask your search > engine what is the difference between point-to-point ip link and an > Ethernet) So i do research about point-to-point ip link and Ethernet link and i have others questions :   1. what is a "point-to-point ip link"? According to me, a point-to-point link is, when we have a network of several machine, the fact of communicate between two machines without the others machines know it. So I guess a "point-to-point ip link" is a specific case of one could call "layer 3 point-to-point link" meaning the point-to-point connection is ensure by the level 3 is that right?   2. if i have several PC connected to a switch by Ethernet , all links can be consider as "point-to-point ip link". the Wiki Ethernet page say a similar thing ("(...)which was designed for point-to-point links"). Same thing here : http://ethernetdirect.com/support_faqs.asp "Ethernet is a point to point network scheme" so what is the difference between "point-to-point ip link" and Ethernet link? Can you help me to clarify that? Thank you.


According to this documentation passenger is a native yum package since RHEL6. **Linux version and type**               [vagrant@localhost ~]$ cat /etc/*release     Scientific Linux release 6.5 (Carbon)     Scientific Linux release 6.5 (Carbon)      **Yum install Passenger** _Before installing RPM_               [vagrant@localhost ~]$ sudo yum search passenger     Loaded plugins: security     sl                                                       | 3.6 kB     00:00     sl-security                                              | 3.0 kB     00:00     sl-security/primary_db                                   | 4.5 MB     00:17     sl6x                                                     | 3.6 kB     00:00     sl6x-security                                            | 3.0 kB     00:00     sl6x-security/primary_db                                 | 4.5 MB     00:19     Warning: No matches found for: passenger     No Matches found      _After installing RPM_               [vagrant@localhost ~]$ sudo yum install mod_passenger -y     Loaded plugins: security     sl                                                       | 3.6 kB     00:00     sl-security                                              | 3.0 kB     00:00     sl-security/primary_db                                   | 4.5 MB     00:19     sl6x                                                     | 3.6 kB     00:00     sl6x-security                                            | 3.0 kB     00:00     sl6x-security/primary_db                                 | 4.5 MB     00:17     Setting up Install Process     No package mod_passenger available.     Error: Nothing to do      As passenger does not to be included in the yum repository, an attempt was done to install it using RPM, although this only should be required in case of RHEL 5 according the documentation. **RPM install** The RPM has been installed.               [vagrant@localhost ~]$ sudo rpm -Uvh http://passenger.stealthymonkeys.com/rhel/5/passenger-release.noarch.rpm     Retrieving http://passenger.stealthymonkeys.com/rhel/5/passenger-release.noarch.rpm     warning: /var/tmp/rpm-tmp.w5Z8Il: Header V4 DSA/SHA1 Signature, key ID 71e042e4: NOKEY     Preparing...                ########################################### [100%]        1:passenger-release      ########################################### [100%]      **Yum install after installing RPM**               [vagrant@localhost ~]$ sudo yum install mod_passenger -y                        Loaded plugins: security     http://passenger.stealthymonkeys.com/rhel/6.5/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     Trying other mirror.     http://passenger.stealthymonkeys.com/rhel/6.5/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     Trying other mirror.     http://mirror.hmdc.harvard.edu/mirrors/passenger/rhel/6.5/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     Trying other mirror.     Error: Cannot retrieve repository metadata (repomd.xml) for repository: passenger. Please verify its path and try again      **Yum search**               [vagrant@localhost ~]$ sudo yum search passenger     Loaded plugins: security     http://passenger.stealthymonkeys.com/rhel/6.5/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     Trying other mirror.     http://passenger.stealthymonkeys.com/rhel/6.5/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     Trying other mirror.     http://mirror.hmdc.harvard.edu/mirrors/passenger/rhel/6.5/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"     Trying other mirror.     Error: Cannot retrieve repository metadata (repomd.xml) for repository: passenger. Please verify its path and try again      **6.5 directory unavailable** It appears that the 6.5. directory does not exist. ![enter image description here](http://i.stack.imgur.com/LQIYl.png) **Question** How to Install Passenger on Scientific Linux 6.5 via RPM?


A set of libraries like ncurses in a shell script

Supose you present the following `TUI` in the shell: ![enter image description here](http://i.stack.imgur.com/uuyqP.png) I need a set of libraries that can be used in the shell to do it. Being sure, `ncurses` has not been used, because it make a dependecy. Question: How to build the widget/window or another `TUI` in the shell?


Simulate x-screen?

I'm working in a koding terminal running ubuntu 13.04, and I'm trying to run an application that requires an x-screen (even to run in terminal mode). I am unable to connect with x11 forwarding, and I'm wondering if there is a workaround that will allow me to run this application (lmms).               $ lmms -v     lmms: cannot connect to X server      $ uname -a     Linux vm-2.masd.koding.kd.io 3.9.0-0-generic #4userns5 SMP Mon May 13 06:15:34 PDT 2013 x86_64 x86_64 x86_64 GNU/Linux     $ lsb_release -a     No LSB modules are available.     Distributor ID: Ubuntu     Description:    Ubuntu 13.04     Release:        13.04     Codename:       raring      Thanks in advance!


Let users create their own daemons

How do I let server's users create their own daemons? They should auto-start on boot and otherwise behave just like regular daemons but with lower privileges overall. I remember I saw a tool that let a user create a file in format similar to a crontab one with his wishes. The tool made sure the programs from the file would _be running at all times_. But now just couldn't find it's name. `nohup ./app &` just doesn't cut because it is won't autostart and the app won't restart automatically. Same as `@reboot` in user's `crontab`. The thing is that I don't want to reinvent a wheel. If there is something that does what I want in full, I would use it. And only if there is nothing, I would fall back to a hand-made approach. (I am using Debian stable, so I don't have systemd yet, as far as I understand.)


clone create date

I would like to clone only the create date and the filenames in source and destination are different. The name part of it is the same, it's the extension that isn't. AVI videos in one directory, MP4 in another. So I wanted to use `touch --reference=file1 file2`. works great on one file but I have about 100. Was hoping to script this but I am clueless. any help is appreciated. I do have a text file containing all the source filenames. Oh and lots of them have spaces and apostrophes in them too.


sh script will not execute as root (cron)

I have the following script added to `cron`. If I add `touch thisisatest.file` to the first line it will create a file named `thisisatest.file`, but not execute the rest of the code. If I manually type `./thescriptname.sh` as root the file will execute as it should. I added `/usr/bin` before `find`, `grep`, and `truncate` as suggested by someone, however the script still will not execute.               #!/bin/bash     KEYWORDS=("Word1" "Word2" "Word3" "Word4" "Word5")     IFS=$'\n'     /usr/bin/find /root/ . -size +1c -type f ! -exec /usr/bin/grep -qwF "${KEYWORDS[*]}" {} \; -exec /usr/bin/truncate -s 0 {} \;      `cronjob -l`:               SHELL=/bin/sh     PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin          */1 * * * *  /bin/sh /root/miami.sh     root@zzzz:~#


Shall I expect faster boot when I boot my system with run level 1

I understand that when I set runlevel as 1, my system will boot with very basic set of commands. Does that mean the system will boot faster as compared to run level 5 or 3?


Fastest way of find and replace in large file with replacing filed present in another file

I have two files. File1 is a csv with 60 fields:               111,Check1|^/h1/h2/h3,22062014184500,20,0.....     111,Check2|^/h43/h40/h9,22062014184500,4,.....     111,Check3|^/h1/h3/h4,22062014184500,0,0,.....      File2 is a mapping file:               OPUM04181,Check1|^/h1/h2/h3     OPUM04040235,Check3|^/h1/h3/h4     OPUM04051898,Check2|^/h43/h40/h9       Now what I have to do is in field 2 of file 1 I have to replace the field with the field 1 of file 1 of matching field 2. Example: In file1:               111,Check1|^/h1/h2/h3,22062014184500,20,0.....      will be               111,OPUM04181,22062014184500,20,0.....       where OPUM04181 and Check1|^/h1/h2/h3 is mapped in file2. My constraint is that File1 and file2 don't have the same set of values, their count is different. Also the line count is 3 million for both the files. This is what I was trying: I ran a loop taking field2 in file 1 I was checking if that field is present in file2. If present I took the field1 in file2. I was replacing the field2 in file1 using sed s///g. But this is taking enormous time. Also I can not sort File1. What is a faster method?


Linux kernel slab usage growing on embedded system

I'm in the process of QA/debugging a project on a custom embedded linux system. The problem we're VERY tight on memory, and even a couple megs can cause issues with our software. What I'm seeing (sometimes) is that when our system crashes (soft crashes), our own software isn't taking up any more memory than usual. But what's weird is that the linux kernel slab has a MUCH higher than normal number of objects in its 32byte slab cache:               size-32           103674 103734     32  113    1 : tunables  120   60    0 : slabdata    918    918      0      This is what the slab looks like under normal circumstances:               size-32             5400   6554     32  113    1 : tunables  120   60    0 : slabdata     58     58      0      Obviously that's a significant difference. I know there's not much information here, but this is really all the information I have to go on. Is there any way to determine what the slab contains? Or where it was allocated from or anything like that? Or maybe just force it to free its memory? This is running on an ARM based board with 64mB of ram running a 2.6.30 kernel. Btw, this is the entirety of what's running on the machine.               10711  8778 root     R     2980  4.9   0  0.0 top      8745  2740 root     S     6452 10.7   0  0.0 sshd: root@ttyp1      9411  2740 root     S     6312 10.4   0  0.0 sshd: root@ttyp2      2740     1 root     S     3704  6.1   0  0.0 /usr/sbin/sshd      8778  8745 root     S     2984  4.9   0  0.0 -sh     10034  9411 root     S     2984  4.9   0  0.0 -sh         1     0 root     S     2980  4.9   0  0.0 init      9432     1 root     S     2848  4.7   0  0.0 runsv ui      1115     1 root     S <   1576  2.6   0  0.0 udevd --daemon       989     2 root     SW<      0  0.0   0  0.0 [mmcqd]       223     2 root     SW<      0  0.0   0  0.0 [kswapd0]       175     2 root     SW<      0  0.0   0  0.0 [kblockd/0]       222     2 root     SW       0  0.0   0  0.0 [pdflush]       221     2 root     SW       0  0.0   0  0.0 [pdflush]         6     2 root     SW<      0  0.0   0  0.0 [khelper]         5     2 root     SW<      0  0.0   0  0.0 [events/0]       186     2 root     SW<      0  0.0   0  0.0 [khubd]         2     0 root     SW<      0  0.0   0  0.0 [kthreadd]       220     2 root     SW       0  0.0   0  0.0 [khungtaskd]         3     2 root     SW<      0  0.0   0  0.0 [ksoftirqd/0]         4     2 root     SW<      0  0.0   0  0.0 [watchdog/0]        12     2 root     SW<      0  0.0   0  0.0 [async/mgr]       189     2 root     SW<      0  0.0   0  0.0 [kseriod]       194     2 root     SW<      0  0.0   0  0.0 [kmmcd]       224     2 root     SW<      0  0.0   0  0.0 [aio/0]       225     2 root     SW<      0  0.0   0  0.0 [unionfs_siod/0]       226     2 root     SW<      0  0.0   0  0.0 [nfsiod]       227     2 root     SW<      0  0.0   0  0.0 [crypto/0]       895     2 root     SW<      0  0.0   0  0.0 [zd1211rw]       899     2 root     SW<      0  0.0   0  0.0 [mtdblockd]       972     2 root     SW<      0  0.0   0  0.0 [usbhid_resumer]       992     2 root     SW<      0  0.0   0  0.0 [rpciod/0]      and it's still growing               size-32           181312 181365     32  113    1 : tunables  120   60    0 : slabdata   1605   1605      0      **Update:**   This is the current state:               Mem: 38416K used, 21764K free, 0K shrd, 1836K buff, 11548K cached     CPU:  0.0% usr  0.0% sys  0.0% nic  100% idle  0.0% io  0.0% irq  0.0% sirq     Load average: 0.01 0.02 0.05 1/28 11050       PID  PPID USER     STAT   VSZ %MEM CPU %CPU COMMAND      8745     1 root     S     6452 10.7   0  0.0 sshd: root@ttyp1     11045     1 root     S     3704  6.1   0  0.0 /usr/sbin/sshd      8778  8745 root     S     2984  4.9   0  0.0 -sh         1     0 root     S     2980  4.9   0  0.0 init     11050  8778 root     R     2980  4.9   0  0.0 top       989     2 root     SW<      0  0.0   0  0.0 [mmcqd]       223     2 root     SW<      0  0.0   0  0.0 [kswapd0]       175     2 root     SW<      0  0.0   0  0.0 [kblockd/0]       222     2 root     SW       0  0.0   0  0.0 [pdflush]       221     2 root     SW       0  0.0   0  0.0 [pdflush]         6     2 root     SW<      0  0.0   0  0.0 [khelper]         5     2 root     SW<      0  0.0   0  0.0 [events/0]       186     2 root     SW<      0  0.0   0  0.0 [khubd]         2     0 root     SW<      0  0.0   0  0.0 [kthreadd]       220     2 root     SW       0  0.0   0  0.0 [khungtaskd]         3     2 root     SW<      0  0.0   0  0.0 [ksoftirqd/0]         4     2 root     SW<      0  0.0   0  0.0 [watchdog/0]        12     2 root     SW<      0  0.0   0  0.0 [async/mgr]       189     2 root     SW<      0  0.0   0  0.0 [kseriod]       194     2 root     SW<      0  0.0   0  0.0 [kmmcd]       224     2 root     SW<      0  0.0   0  0.0 [aio/0]       225     2 root     SW<      0  0.0   0  0.0 [unionfs_siod/0]       226     2 root     SW<      0  0.0   0  0.0 [nfsiod]       227     2 root     SW<      0  0.0   0  0.0 [crypto/0]       895     2 root     SW<      0  0.0   0  0.0 [zd1211rw]       899     2 root     SW<      0  0.0   0  0.0 [mtdblockd]       972     2 root     SW<      0  0.0   0  0.0 [usbhid_resumer]       992     2 root     SW<      0  0.0   0  0.0 [rpciod/0]                       size-32           191069 191083     32  113    1 : tunables  120   60    0 : slabdata   1691   1691      0


command for joining a series of files together

I have... > me@computer:~/gutenberg/euclid$ ls > > book01.html book04.html book07.html book10.html book13.html book02.html > book05.html book08.html book11.html book03.html book06.html book09.html > book12.html and I want to join all these .html files into the same big file, in order. What command or command sequence can I use?


How to find files in subdirs and sort them by filename in a single command?

Result of a normal find using `find . ! -path "./build*" -name "*.txt"`:               ./tool/001-sub.txt     ./tool/000-main.txt     ./zo/001-int.txt     ./zo/id/002-and.txt     ./as/002-mod.txt      and when sorted with `sort -n`:               ./as/002-mod.txt     ./tool/000-main.txt     ./tool/001-sub.txt     ./zo/001-int.txt     ./zo/id/002-and.txt      however the desired output is:               ./tool/000-main.txt     ./zo/001-int.txt     ./tool/001-sub.txt     ./zo/id/002-and.txt     ./as/002-mod.txt      which means output is sorted based on _filename only_ , but folder information should be maintained as part of the output. **Edit** : Make example more complicated as the subdirectory structure may include more than one level.


Installing mlocate on mac OS 10.7

I'm a beginner in using Linux. I'm trying to use the command "locate". Once I use this command, I get an error that says the locate database should be created. I used the command below to create that database, but I still get the same error:               sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist      I tried so many things including installing locate, but the commands work in Ubuntu seem not to work in mac os. Does anybody know what the issue is? Thanks in advance,


Carry-on Ubuntu Customization

Like most of us, I have several machines: at home, at work, for travelling... etc. I mainly write papers or books while I code. But I'm tired of svn'ing, rsync'ing and so on, so I've decided to carry a pendrive with me, with my Ubuntu customizations (bash, emacs, ...) and at the end of the day, do a rsnapshot. My question is: how do I minimally run my home directory from a pendrive? What should I put in there? Thanks for any input.


Network printer needs to be manually enabled after reboot

I've recently installed Debian squeeze on a new machine, and decided to try out the default gnome setup rather than attempt to do everything myself. I added a printer using _System > Administration > Printing_ -- it found my network printer just fine. However, when powering on the machine this printer is disabled. I have to go to the same dialog as above, enter the root password and enable the printer manually before jobs will be accepted. Any ideas on how to enable the printer automatically? Note that it's quite possible the printer is turned on _after_ the computer, if this makes a difference. Either way it would be nice if the computer noticed when the printer was turned on.


How to implement conditional update of deb package

I am creating a deb package of a product which is part open source and part proprietary. In order to reuse the built in functionality of some distributions like Ubuntu to monitor a list of repositories and update the package when a new version comes available I will probably create such a repository. The problem is that the proprietary part of the package depends on licenses which are valid for a limited interval versions (valid for all the versions in a course of a year). Which means that at some point of time when a new version is available it will be nice to at least warn the user that his license will not be valid for the new version. Is there a way to do that check and interact with the user? I see that there are scripts in the deb package itself that can be executed before installation, but I have no idea if they can interact with the user and abort the package installation. Any suggestions on how such a functionality can be created are appreciated.


use net instread of cdrom. linux, aptitude install

Got debian installed finally but during install I think I choose to use the local media over the internet for packages. needed to do that as was not sure if will try to connect right away (my modem needs a login). Now I want to install/ enable sudo and install other programs like thunderbird eclipse, and chrome. but I do not have sudo when I type the command,               aptitude install sudo      Get this message:               The following NEW packages will be installed:       sudo  0 packages upgraded, 1 newly installed, 0 to remove and 0 not     upgraded. Need to get 0 B/842 kB of archives. After unpacking 1,882 kB     will be used. Media change: Please insert the disc labeled 'Debian     GNU/Linux 7.1.0 _Wheezy_ - Official amd64 CD Binary-1 20130615-23:06'     into the drive '/media/cdrom/' and press [Enter].      Do not have a cdrom. What to do? Have root user password though logged in as another user.


Are commands executed through SSH transparent to a remote host's administrator?

Can administrators know what commands I execute **non-interactively** through SSH? For example: does `echo hello` get logged somewhere at `remote` if I run this?               $ ssh me@remote "echo hello"      Can remote commands be otherwise monitored?


awk - gensub function

I need to insert contents of variable to parameter function `gensub` in `awk`, specifically instead of regular expression's parameter. Can you help me with it? I have:               gawk '      BEGIN {        a = "abc15d56ef";        b = gensub(/.*([0-9][0-9])d([0-9][0-9]).*/, "\\2 \\1", "g", a);        print b;      }'      ### output               output:56 15      I need it to be in this form, but it doesn't work:               gawk '      BEGIN {        a = "abc15d56ef";        c="/.*([0-9][0-9])d([0-9][0-9]).*/";        b = gensub(c, "\\2 \\1", "g", a);        print b;      }'      ### output               output:56 15


startx results in blank screen

I just installed Xorg on Arch Linux but when I run startx, I only get a blank screen. What could be the problem here?


Processing control characters

I have a log file which contains a bunch of non visible control characters such as hex \u0003. I would like to replace this using something like SED, but can't get the first part of the regex to match: > /s/^E/some_string I am creating the ^E by pressing CTRL-V CTRL-0 CTRL-3 to create the special character, as read from the 'man ascii' page: > 003 3 03 ETX However, nothing matches this control character. Any help appreciated!


using cron to run script

Hey guys, im trying to run a script using cron, im using a crontab created by the user ashtanga, in the crontab i have               */5 * * * *  /home/custom-django-projects/SiteMonitor/sender.py      in top of the script i have:               #!/usr/local/bin/python      and the user ashtanga does have executable permission to the file, but cron is not running the script, its giving me the error:               /bin/sh: /home/custom-django-projects/SiteMonitor/sender.py: No such file or directory      so my question is, how can i get cron to run the script ?


Redhat Enterprise Linux 4.7 - Ping problem

When I try to ping some of the IP addresses I get "connect: No buffer space is available" error. Also when I check /var/log/messages, there are some errors like as following               printk: 99 messages overflow     kernel: Neighbour table overflow      do you have any ideas about this problem?


sed regexp HEX char

i have this string:                echo -e "a12\x8fb12\x9f"|xxd     0000000: 6131 328f 6231 329f 0a                   a12.b12..      i want delete this sequence string `12\x9f` and `12\x8f` with `sed`. i can do it with this command `sed -e 's_12\x8f__g' -e 's_12\x9f__g'` but why this command dose not work?               sed -e 's_12[\x8f\x9f]__g'


How to update remote file?

I need to update the contents of a file on a remote host from my local Linux machine. How can i do this?


Installing debian on existing ubuntu - will /home folder be removed?

I want to install Debian with LXDE on partition, that already have Ubuntu 11.04 installed. I have a lot of music there, and I don't want copy it to another partition. I know that Debian installer will propt that on this partition is already linux installed, but will it remove all from my /home/ folder if I type the same username in setup? Or should I have to encrypt this folder?


Are there any other Linux distributions that automatically get UEFI right?

Recently I've been trying many different linux distros, and the only one that can setup UEFI correctly out of the box is Fedora. There is 0 tweaking involved. Somehow it just automatically knows if a computer can support UEFI mode or not and automatically sets up the gpt partitions and everything. Are there any other Linux distros that will also correctly setup UEFI mode upon installation?


What does the commands sudo, apt-get, install, and fakeroot stand for?

I am a newbie to Linux and I am trying to build a custom kernel on ubuntu and I saw this document and it said I needed to install the packages https://help.ubuntu.com/community/Kernel/Compile               To start, you will need to install a few packages. The exact commands to install those packages depends on which release you are using:          Hardy (8.04):           sudo apt-get install linux-kernel-devel fakeroot kernel-wedge build-essential     Note: The package makedumpfile is not available in Hardy.          Lucid (10.04):                sudo apt-get install fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge     sudo apt-get build-dep linux     sudo apt-get install git-core libncurses5 libncurses5-dev libelf-dev asciidoc binutils-dev     sudo apt-get install linux-kernel-devel fakeroot kernel-wedge build-essential      > **sudo** = permits users to execute command as super user   >  **apt-get** = Get a package from the Advance Packing Tool ( something like > extract a package from a library kind of I believe)   >  **Install** - Operation to do   >  **linux-kernel-devel - ??????????????( what does this mean)**   >  **fakeroot** - Lets user do file manupulations as a fake user.   >  **kernel-wedge build-essential - ??????????????( what does this mean)** How and where can I see the meaning or function for every command in a document? Thanks in advance


xmodmap hanging the system for 20 secs and not sticking

I edited the keyboard map using xmodmap as per https://wiki.archlinux.org/index.php/Xmodmap, and I have two problems: executing `xmodmap ~/.Xmodmap` completely hangs the system for 15-25secs, which seems a bit odd considereing I'm just remapping the keyboard, and the changes don't stick on logoff, and not even on suspend. It's a pain in the ass for my boot time to be increased by 20 secs or more, plus having to run it everytime I wake up from suspend. Is this normal (I don't really think so?) and is there anything I can do, perhaps an alternative way to remap the keyboard? Linux Mint 15 x64 Cinnamon


Why does the Debian installation manual suggest to do "sync" after raw copy of image file to USB key?

According to the Debian installation manual, section 4.3, the hybrid installation ISO image can be easily copied on a USB key this way:               # cp debian.iso /dev/sdX     # sync      But according to my previous question about `sync`, it looks like it only works to flush _file system_ buffers. Then, **why would`sync` work in the above command which does not involve a file system?**


Script to login to ssh twice

I need to login through `ssh` twice with a script and can't get it to work. This is what I have in my script file:               #!/usr/bin/expect          set login "user"     set addr "address1"     set addr2 "address2"     set pw "password"          spawn ssh $login@$addr     expect "$login@$addr\'s password:"     send "$pw\r"     expect "$login@host:"     spawn ssh $addr2     expect "$login@$addr\'s password:"     send "$pw\r"     interact      but this fails with the error:               user@host:~$ ssh: Could not resolve hostname address2: Name or service not known     send: spawn id exp7 not open         while executing     "send "$pw\r""      If I change the line `spawn ssh $addr2` with `exec ssh $addr2` it fails with the error:               user@host:~$ ssh: Could not resolve hostname address2: Name or service not known         while executing     "exec ssh $addr2"      What do I need to change in order to make this work?


fluxbox keyboard switch german, greek (modern) and polytonic greek

Where can i find a list of keyboard-layout codes to switch between german, greek (modern) and polytonic greek in fluxbox menu?               vim ~/.fluxbox/menu          [begin] (fluxbox)     [include] (/etc/X11/fluxbox/fluxbox-menu)     [submenu] (Keyboards)     [exec] (de) {setxkbmap de}     [exec] (greek) {setxkbmap greek}     [exec] (polytonic greek) {setxkbmap polytonic greek}     [end]


Can't set a blacklist for usb autosuspending

I'm trying to disable usb autosuspend for my wireless USB mouse:               CONTROL_USB_AUTOSUSPEND="auto"     AUTOSUSPEND_USE_WHITELIST=0     AUTOSUSPEND_USBID_BLACKIST="046d:c52f"      I already put these values to `/etc/laptop-mode/conf.d/usb-autosuspend.conf`, and restarted `laptop-mode`, but that just don't work (it still stuck for one second when I move my mouse)


Is there a robust command line tool for processing csv files?

I work with CSV files and sometimes need to quickly check the contents of a row or column from the command line. In many cases `cut`, `head`, `tail`, and friends will do the job; however, cut cannot easily deal with situations such as               "this, is the first entry", this is the second, 34.5      Here, the first comma is part of the first field, but `cut -d, -f1` disagrees. Before I write a solution myself, I was wondering if anyone knew of a good tool that already exists for this job. It would have to, at the very least, be able to handle the example above and return a column from a CSV formatted file. Other desirable features include the ability to select columns based on the column names given in the first row, support for other quoting styles and support for tab-separated files. If you don't know of such a tool but have suggestions regarding implementing such a program in Bash, Perl, or Python, or other common scripting languages, I wouldn't mind such suggestions.


Extract given column from comma-separated values with inner commas and quotation marks

I have a file in which the fields are separated by comma. Some example input:               col1,"1,2",col3     col1,"1,2,3",col3     col1,"1  2,3",col3     col1,"1 "2,3"",col3      Now, I have to fetch the second column, so that I get:               "1,2"     "1,2,3"     "1  2,3"     "1 "2,3""      `cut -d, -f2 file` doesn't do what I want. So, how can I retrieve column 2 from the above input?


Handling comma in string values in a CSV file

I have a comma-separated file which has numeric and string columns. String columns are quoted and can have comma in between the quotes. How do I identify the columns with `FS =","`? Sample records               "prabhat,kumar",19,2000,"bangalore,India"      In AWK it should be               $1 = "prabhat,kumar"     $2 = 19     $3 = "2000"     $4 = "bangalore,india"      Setting `FS=","` is creating the problem. Input is:               "prabhat,kumar",19,2000,"bangalore,India","ABC,DEF","GHI",123,"KLM","NOP,QRS"     "prabhat,kumar",19,2000,"bangalore,India","ABC,DEF","GHI",123,"KLM","NOP,QRS"      Output should be:               "prabhat,kumar"|19|2000|"bangalore,India"|"ABC,DEF"|"GHI"|123|"KLM"|"NOP,QRS"     "prabhat,kumar"|19|2000|"bangalore,India"|"ABC,DEF"|"GHI"|123|"KLM"|"NOP,QRS"      Code I am trying:               awk -F"," '{for(i=1;i<=NF;i++){if(i%NF==0){ORS="\n"} {if($i ~ /^\"/ || $i ~ /\"$/) {a=a OFS $i;j++;{if(j%2==0){sub(/^\,/,X,a); print a;j=0;a=""}}} else {print $i}}} {ORS="|"}}' ORS="|" OFS=, p.txt


Parse csv using awk

> **Possible Duplicate:**   >  Is there a robust command line tool for processing csv files? I am trying to parse the second line in a file (which contains commas within double quotes) > "100 Watt A19 10,000 Hour - Clear Light Bulb",American-Light-Bulb- > Mfg,552,Indoor Living>Home Furnishings>Lighting>Light Bulbs,"Product Code: > H20821 Energy Used: 100 Watts Rated Life: 10,000 Hours Volts: 130 Base: E26 > - Medium Screw (standard household base) Length: 4.45 Inches Diameter: 2.375 > Inches Bulb Type: > A19",1.75,Yes,http://www.buylighting.com/ProductDetails.asp?ProductCode=H20821&click=104182,http://www.buylighting.com/v/vspfiles/photos/H20821-2T.jpg,,New,,,0.1,H20821,,,,,,,,,,,,,,,,.25,Absolute,,,,,,,               head -2 file.csv | tail -1 | awk -F',' '{print $1}'      But it outputs:               "100 Watt A19 10      How can I use `awk` to get `"100 Watt A19 10,000 Hour - Clear Light Bulb"` as the value of `$1`? Also how can I use `awk` to get `"Product Code: H20821 Energy Used: 100 Watts Rated Life: 10,000 Hours Volts: 130 Base: E26 - Medium Screw (standard household base) Length: 4.45 Inches Diameter: 2.375 Inches Bulb Type: A19"` as the value of $5?


Convert Amazon .pem key to Putty .ppk key Linux

I have generated and downloaded a private `.pem` key from AWS. However, to use Putty in order to connect to the virtual machine, I must have that key in `.ppk` format. The process of conversion is detailed in roughly 20 lines here:   * http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/get-set-up-for-amazon-ec2.html#prepare-for-putty I am using Linux Mint (an Ubuntu distro) and I know I can use puttygen in the terminal. However, I have no idea how to use this tool, nor how to configure the needed parameters. When I type puttygen --help I get               PuTTYgen unidentified build, Aug  7 2013 12:24:58     Usage: puttygen ( keyfile | -t type [ -b bits ] )                     [ -C comment ] [ -P ] [ -q ]                     [ -o output-keyfile ] [ -O type | -l | -L | -p ]       -t    specify key type when generating (rsa, dsa, rsa1)       -b    specify number of bits when generating key       -C    change or specify key comment       -P    change key passphrase       -q    quiet: do not display progress bar       -O    specify output type:                private             output PuTTY private key format                private-openssh     export OpenSSH private key                private-sshcom      export ssh.com private key                public              standard / ssh.com public key                public-openssh      OpenSSH public key                fingerprint         output the key fingerprint       -o    specify output file       -l    equivalent to `-O fingerprint'       -L    equivalent to `-O public-openssh'       -p    equivalent to `-O public'      But I have no idea whatsoever on how to do what the website tells me to do and all my tentatives failed so far. How do I do what the website tells me to do, using puttygen on the terminal?


How do you kick a benign user off your system?

I was googling this a bit ago and noticed a couple of ways, but I'm guessing that google doesn't know all. So how do _you_ kick users off your Linux box? also how do you go about seeing they are logged in in the first place? and related... does your method work if the user is logged into an X11 DE (not a requirement I'm just curious)?


debian does not detect serial PCI card after reboot

I have installed a PCI card with two serial and one parallel port on it. the chipset is `MCS9865`. I downloaded the latest driver(V1.0.12) from here. I ran `make` and `make install`. now the two serial ports are `/dev/ttyD0` and `/dev/ttyD1`. I have tested them with `picocom` and it is working perfectly. the problem is that when I reboot the system there is no `/dev/ttyD0` and `/dev/ttyD1`. I need to do another `make install`. Is there any solution? output of `lspci -v` shows this:               03:01.0 Serial controller: NetMos Technology PCI 9865 Multi-I/O Controller (prog-if 02 [16550])         Subsystem: Device a000:1000         Flags: bus master, medium devsel, latency 32, IRQ 19         I/O ports at df00 [size=8]         Memory at fbeff000 (32-bit, non-prefetchable) [size=4K]         Memory at fbefe000 (32-bit, non-prefetchable) [size=4K]         Capabilities: [48] Power Management version 2         Kernel driver in use: mcs9865-serial          03:01.1 Serial controller: NetMos Technology PCI 9865 Multi-I/O Controller (prog-if 02 [16550])         Subsystem: Device a000:1000         Flags: bus master, medium devsel, latency 32, IRQ 18         I/O ports at de00 [size=8]         Memory at fbefd000 (32-bit, non-prefetchable) [size=4K]         Memory at fbefc000 (32-bit, non-prefetchable) [size=4K]         Capabilities: [48] Power Management version 2         Kernel driver in use: mcs9865-serial          03:01.2 Parallel controller: NetMos Technology PCI 9865 Multi-I/O Controller (prog-if 03 [IEEE1284])         Subsystem: Device a000:2000         Flags: bus master, medium devsel, latency 32, IRQ 7         I/O ports at dd00 [size=8]         I/O ports at dc00 [size=8]         Memory at fbefb000 (32-bit, non-prefetchable) [size=4K]         Memory at fbefa000 (32-bit, non-prefetchable) [size=4K]         Capabilities: [48] Power Management version 2      `make install` shows this:               cp mcs9865.ko mcs9865-isa.ko /lib/modules/2.6.32-5-amd64/kernel/drivers/serial/     depmod -A     chmod +x mcs9865     cp mcs9865 /etc/init.d/     ln -s /etc/init.d/mcs9865 /etc/rcS.d/S99mcs9865 || true     ln: creating symbolic link `/etc/rcS.d/S99mcs9865': File exists     modprobe mcs9865     modprobe mcs9865-isa      I'm running debian 6.0.5 with most updated packages.


Importance of fsck at boot with Journalled filesystems?

I noticed that XFS does not implement a fsck at system boot and one of the reasons touted in that journaling file-systems help ensure the file-system is in a consistent state after an unclean shutdown; on the next mount (e.g. after reboot) the journal is replayed. Is a fsck still needed after an unclean shutdown and why?


How do I install openSUSE 12.1 from an external hard disk?

For some reason, my laptop (HP ProBook 5320m) refuses to boot when I install the ISO images for openSUSE 12.1 on an USB stick (the stick starts to blink and then the internal fan goes into overdrive and I have to switch off the laptop). I also tried the NET version, different USB sticks, no game. Currently, openSUSE 11.4 is installed on the laptop, is it's not _impossible_ to install. My guess is that something was changed in the 12.1 release which the BIOS of the laptop doesn't like. So my last hope is to create a bootable external hard disk but when I look into the folder `/boot` of the ISO image, I can't find GRUB or anything that I recognize. Questions:   1. Is there a way to replace the ISO boot loader with GRUB?   2. Is there some other way to install 12.1 on openSUSE 11.4? Ubuntu can do a dist upgrade in the running system, for example. Is something like that possible with openSUSE, too?   3. Could I boot with the installer for 11.4 and somehow make it use the installation files for 12.1? PS: Dear HP engineers. Your BIOS looks great but I'd prefer one that works. Just saying :-(


Builiding a UEFI bootable USB

I'm having a really hard time getting Mint13 installed on my new laptop, no optical UEFI support and having odd corruption of grub.cfg when I do try and use unetbootin. Is there a method to build a UEFI bootable USB drive that I can place the Mint13 iso on? Is below sane sounding?               $ sudo mount /dev/sdb1 /mnt     $ sudo mkdir /mnt/boot     $ sudo mkdir /mnt/boot/efi     $ sudo grub-install --boot-directory=/mnt     $ sudo mkdir /mnt/iso/     $ sudo mkdir /mnt/boot/grub/scripts      Save autoiso.cfg script in the /mnt/boot/grub/scripts               Then echo 'configfile /boot/grub/scripts/autoiso.cfg' >> /mnt/boot/grub/grub.cfg