How do I get shared folders working under Fedora 19 (guest) with open-vm-tools?

Fedora 19 includes the open-vm-tools package. This was installed by default under a VMware Fusion host. Everything works except for shared folders. I'd rather not install from source, since that would mean compiling every time there's a kernel change.


Non-interactive customization and installation of FreeBSD Ports

I'm new to FreeBSD, coming from a Linux background. I want to install a port, changing one of the default configuration options, in a non-interactive way (so that I can script the installation for automated configuration of my FreeBSD servers). As a specific example, the `graphics/ImageMagick-nox11` port has a default configuration option of `PERL=on`. I want to change this. I realize that I can `make config` and then just use the generated entry in `/var/db/ports/` to avoid any interaction in the future, but this still requires the initial interaction to set the options in the ncurses interface. Ideally I want to be able to do something like the following, to build the package with perl support disabled but accepting all other defaults:               $ make PERL=off BATCH=yes install clean      What is the proper way to accomplish this? Can I somehow place port-specific configuration options like this in `/etc/make.conf`?


Learning Ubuntu - Testing on Mac OS 10.7?

I'm a beginner in learning Linux. I know that there are many different distributions of Linux including Ubuntu. I consider Mac OS as a distribution of Linux, is that right? My goal in learning Linux is just to be able to connect to server with my mac to do cloud computing. Here is my problem: I've found very useful videos on youtube teaching how to use Linux (commands in Linux) with Ubuntu distribution. I'm testing what I've learned with my Mac through the terminal. Not surprisingly, many commands in Ubuntu do not work on the Mac.   * What should I do?   * Is this a good strategy to learn Ubuntu? or instead I should learn commands in terminal?    * Is there anyway to install package so that Ubuntu commands work in mac? Would you guys help me and guide me what to do?


build script: how to implement a "skip previously completed step"

I'm trying to create a build script for GCC (which works, for now), but I would like to be able to skip rebuilding all the prereq libraries when I'm only updating GCC/binutils for example. I thought of making the script create a file in the main build directory containing all the steps to skip. How would I do that (something with the `cat` command and find to see if a step is in the file?). This would allow me, albeit manually, to enable a rebuild of certain parts when needed. UPDATE: The answers posted seem to assume that I need a makefile, while I find that very troublesome and don't want it; the build procedure consists of many cd, configure, make, make install steps that I simply don't want in a makefile. The script is near-finished, this is the last step I need for it... UPDATE2: as I said in the comment below, I'm on windows, using MSYS bash as shell. Thanks! PS: this "skipping completed steps" needs to be performed each time the script is run.


How to get external monitor resolution set by xrandr to persist

### tl;dr My laptop keeps forgetting the correct resolution of the external monitor attached to it. How can I make the configuration "stick"? ### Details I have a laptop running Linux Mint attached to an external ViewSonic monitor. I set it up to use the external monitor as a second screen (i.e. not mirrored). This worked fine for some weeks. Suddenly, the laptop no longer recognized it as a ViewSonic, at which point it did not know its optimal resolution (`1600 x 1200`), only allowing a max of `1028 x 768`.1 This did not work well at all with my laptop, which has `1920 x 1200` resolution. After much frustration, I found this answer. It helped me to fix the problem, as follows (the output of the `cvt` command being the modeline which was used in the next command):               cvt 1600 1200     xrandr --newmode "1600x1200_60.00"  161.00  1600 1712 1880 2160  1200 1203 1207 1245 -hsync +vsync     xrandr --addmode VGA-1 1600x1200_60.00      This is _exactly_ what I had been wishing I could do, but could not do through the GUI. (There are reasons why I still love the command-line...) This once again worked well for a time. However, when I booted the computer today and signed in, I got a notification area popup with a string of errors about different attempted modes which weren't working, and the external monitor was switched off. I repeated the commands above, and it is working again. I have an nVidia card. I tried installing the proprietary driver when things began to go awry, but at that point the external monitor was no longer recognized at all, so I am back to the open source driver. I do not have an `Xorg.conf` or an `Xorg.conf.d`, only an `xorg.conf.failsafe`. I don't want to repeat these commands every time I boot the machine. Is there some way I can get this saved to my `Xorg.conf` or something? It's been a number of years since I've done much with X. Can anybody help me here? * * * 1I have been unable to determine why this happened. My best guess is a problematic driver update.


Output "Hollywood-hacker-scene" from a shell

This might seem like a strange question, but what would you use for creating the typical hollywood hacking scene? I got this request from a friend and my brain was blank. All I could think of was all the nmap scenes from movies like _The Matrix_ and so on. But this would need to be done on a Mac with default OSX, which I think is some flavour of *nix, right? They have no internet access so preparing with external tools is out of the question. I was thinking along the lines of writing the equivalent of /var/log/messages to screen maybe...


Get a list of directory names with find

I know I can do this to get a list of directory names:               find . -type d -maxdepth 1       The output looks like this:               .     ./foo     ./bar      I prefer the listing without `./`. Is there a way to get find to output just the raw names? I tried sending the list to stat to format it but that just gives me the same result:               find . -type d -maxdepth 1 -print0 | xargs -0 stat -f '%N'


Make GAIM (Pidgin) wait longer before starting new logfile for idle chat?

If I'm chatting w/ someone via GAIM, and the chat idles for a certain amount of time, GAIM creates a new logfile when the chat resumes. Example from /home/barrycarter/.gaim/logs/jabber/carter.barry@gmail.com/id-of-person/               2010-06-10.094139-0600MDT.txt [mod time: 2010-06-10 14:35]     2010-06-08.140656-0600MDT.txt [mod time: 2010-06-08 16:00]       These are actually the same conversation, with a gap from "2010-06-08 16:00" to "2010-06-10 09:41:39". How would I tell GAIM: "if the conversation idle is less than `<n>` hours, don't create a new log file?" Note: The above is just an example: in reality, I probably wouldn't want the same log file after a 2 day gap (a 20 hour gap, maybe).


How to remove a single line from history?

I'm working in Mac OSX, so I guess I'm using bash...? Sometimes I enter something that I don't want to be remembered in the history. How do I remove it?


What processes are started during linux boot and how to disable them?

I installed nfs-commons on my Ubuntu 11.04 machine so that I can mount an NFS drive. However I late decided to remove NFS from my system so I did a sudo apt-get remove. Now, 1 out of 5 times my machine does not boot. It hangs. The boot messages say somewhere > starting NFSv4 id <-> name mapper [fail] Also one of the message says > init: statd pre-start process (505) terminated with status 2 Now I think both these messages have got something to do with my previous NFS installation. But I don't understand that when I have uninstalled it, why is my OS trying to start these services ? I don't have any entry for NFS in my fstab either. So my question is this : How do I find out what processes / services are going to start during boot and how do I disable them ?


Bash - Continuous String Manipulation

#!/bin/bash          FILE="$(basename "$1")"     FILE="${FILE/%.jpeg/.jpg}"      Is there anyway to glue these two lines together into a one-liner?


Incrementally backup FTP to local computer

I want to backup a FTP directory (not backup _to_ ) with a cron script running daily. I'd prefer a solution that could sync the FTP to my local computer; only copy files changed and remove files that have been deleted. Is there such an application?


What is the difference between the "Retro" and "Standard" version of Puppy Linux?

In one of the download locations for Puppy Linux, two different ISOs are listed:   * `precise-5.7.1.iso` (156 MB)   * `precise-5.7.1-retro.iso` (200 MB) What is the difference between these two versions?


How to get netmask from bash?

I want to get my netmask on Linux. It is outputted with `ifconfig` but I want to extract the string.


Trying to connect to an open network with Ubuntu 14.04, no problem in Windows

The Ubuntu network connection seems to fail at every open network. I have no problem connecting at home to a WPA network. Using WICD. It seems it fail to get an IP. Here are the results of               sudo lshw -C network           sudo lspci -nn >> checksudo lspci -nn           sudo dmesg | grep -e wlan                       *-network            description: Wireless interface            product: AR9285 Wireless Network Adapter (PCI-Express)            vendor: Qualcomm Atheros            physical id: 0            bus info: pci@0000:02:00.0            logical name: mon0            version: 01            serial: 48:5d:xx:xx:xx:xx            width: 64 bits            clock: 33MHz            capabilities: pm msi pciexpress bus_master cap_list logical wireless ethernet physical            configuration: broadcast=yes driver=ath9k driverversion=3.11.0-15-generic firmware=N/A latency=0 link=no multicast=yes promiscuous=yes wireless=IEEE 802.11bgn            resources: irq:17 memory:f1900000-f190ffff       *-network            description: Ethernet interface            product: AR8131 Gigabit Ethernet            vendor: Qualcomm Atheros            physical id: 0            bus info: pci@0000:05:00.0            logical name: eth0            version: c0            serial: bc:ae:c5:35:f0:bc            capacity: 1Gbit/s            width: 64 bits            clock: 33MHz            capabilities: pm msi pciexpress vpd bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation            configuration: autonegotiation=on broadcast=yes driver=atl1c driverversion=1.0.1.1-NAPI latency=0 link=no multicast=yes port=twisted pair            resources: irq:48 memory:f1800000-f183ffff ioport:c000(size=128)               00:00.0 Host bridge [0600]: Intel Corporation Core Processor DRAM Controller [8086:0044] (rev 18)     00:02.0 VGA compatible controller [0300]: Intel Corporation Core Processor Integrated Graphics Controller [8086:0046] (rev 18)     00:16.0 Communication controller [0780]: Intel Corporation 5 Series/3400 Series Chipset HECI Controller [8086:3b64] (rev 06)     00:1a.0 USB controller [0c03]: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller [8086:3b3c] (rev 06)     00:1b.0 Audio device [0403]: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio [8086:3b56] (rev 06)     00:1c.0 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 [8086:3b42] (rev 06)     00:1c.1 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 [8086:3b44] (rev 06)     00:1c.2 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 3 [8086:3b46] (rev 06)     00:1c.4 PCI bridge [0604]: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 5 [8086:3b4a] (rev 06)     00:1d.0 USB controller [0c03]: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller [8086:3b34] (rev 06)     00:1e.0 PCI bridge [0604]: Intel Corporation 82801 Mobile PCI Bridge [8086:2448] (rev a6)     00:1f.0 ISA bridge [0601]: Intel Corporation Mobile 5 Series Chipset LPC Interface Controller [8086:3b09] (rev 06)     00:1f.2 SATA controller [0106]: Intel Corporation 5 Series/3400 Series Chipset 4 port SATA AHCI Controller [8086:3b29] (rev 06)     00:1f.3 SMBus [0c05]: Intel Corporation 5 Series/3400 Series Chipset SMBus Controller [8086:3b30] (rev 06)     00:1f.6 Signal processing controller [1180]: Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem [8086:3b32] (rev 06)     02:00.0 Network controller [0280]: Qualcomm Atheros AR9285 Wireless Network Adapter (PCI-Express) [168c:002b] (rev 01)     05:00.0 Ethernet controller [0200]: Qualcomm Atheros AR8131 Gigabit Ethernet [1969:1063] (rev c0)     3f:00.0 Host bridge [0600]: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers [8086:2c62] (rev 05)     3f:00.1 Host bridge [0600]: Intel Corporation Core Processor QuickPath Architecture System Address Decoder [8086:2d01] (rev 05)     3f:02.0 Host bridge [0600]: Intel Corporation Core Processor QPI Link 0 [8086:2d10] (rev 05)     3f:02.1 Host bridge [0600]: Intel Corporation Core Processor QPI Physical 0 [8086:2d11] (rev 05)     3f:02.2 Host bridge [0600]: Intel Corporation Core Processor Reserved [8086:2d12] (rev 05)     3f:02.3 Host bridge [0600]: Intel Corporation Core Processor Reserved [8086:2d13] (rev 05)               [132673.227036] wlan0: authenticate with 02:0d:xx:xx:xx:xx      [132673.233781] wlan0: send auth to 02:0d:xx:xx:xx:xx (try 1/3)     [132673.235212] wlan0: authenticated     [132673.235328] ath9k 0000:02:00.0 wlan0: disabling HT/VHT due to WEP/TKIP use     [132673.238615] wlan0: associate with 02:0d:xx:xx:xx:xx (try 1/3)     [132673.242412] wlan0: RX AssocResp from 02:0d:xx:xx:xx:xx (capab=0x411 status=0 aid=42)     [132673.242633] wlan0: associated     [132673.242656] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready     [132771.173489] wlan0: authenticate with 02:0d:xx:xx:xx:xx      [132771.176705] wlan0: send auth to 02:0d:xx:xx:xx:xx (try 1/3)     [132771.178662] wlan0: authenticated     [132771.178812] ath9k 0000:02:00.0 wlan0: disabling HT/VHT due to WEP/TKIP use     [132771.180561] wlan0: associate with 02:0d:xx:xx:xx:xx (try 1/3)     [132771.183608] wlan0: RX AssocResp from 02:0d:xx:xx:xx:xx (capab=0x411 status=0 aid=42)     [132771.183788] wlan0: associated     [132847.144627] wlan0: authenticate with 02:0d:xx:xx:xx:xx      [132847.148698] wlan0: send auth to 02:0dxx:xx:xx:xx (try 1/3)     [132847.151334] wlan0: authenticated     [132847.151516] ath9k 0000:02:00.0 wlan0: disabling HT/VHT due to WEP/TKIP use     [132847.153707] wlan0: associate with 02:0d:xx:xx:xx:xx (try 1/3)     [132847.156603] wlan0: RX AssocResp from 02:0d:xx:xx:xx:xx (capab=0x411 status=0 aid=42)     [132847.156887] wlan0: associated     [132934.091818] wlan0: authenticate with 02:0d:xx:xx:xx:xx      [132934.096306] wlan0: send auth to 02:0d:xx:xx:xx:xx (try 1/3)     [132934.100465] wlan0: authenticated     [132934.100729] ath9k 0000:02:00.0 wlan0: disabling HT/VHT due to WEP/TKIP use     [132934.101241] wlan0: associate with 02:0d:xx:xx:xx:xx (try 1/3)     [132934.109120] wlan0: RX AssocResp from 02:0d:xx:xx:xx:xx (capab=0x411 status=0 aid=42)     [132934.109371] wlan0: associated     [132968.899246] wlan0: deauthenticating from 02:0d:xx:xx:xx:xx by local choice (reason=3)     [132975.768437] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [132976.537373] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [265430.541914] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [299569.814859] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [301615.881104] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready     [301615.882783] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready     [374676.306364] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [374677.397056] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [374679.467541] wlan0: authenticate with 00:15:xx:xx:xx:xx      [374679.487502] wlan0: send auth to 00:15:xx:xx:xx:xx (try 1/3)     [374679.529658] wlan0: send auth to 00:15:xx:xx:xx:xx (try 2/3)     [374679.532999] wlan0: authenticated     [374679.534934] wlan0: associate with 00:15:xx:xx:xx:xx (try 1/3)     [374679.541256] wlan0: RX AssocResp from 00:15:xx:xx:xx:xx (capab=0x1 status=0 aid=10)     [374679.541649] wlan0: associated     [374679.541667] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready     [374679.541999] wlan0: deauthenticating from 00:15:xx:xx:xx:xx by local choice (reason=3)     [374700.382139] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [132673.227036] wlan0: authenticate with 02:0d:xx:xx:xx:xx      [132673.233781] wlan0: send auth to 02:0d:xx:xx:xx:xx (try 1/3)     [132673.235212] wlan0: authenticated     [132673.235328] ath9k 0000:02:00.0 wlan0: disabling HT/VHT due to WEP/TKIP use     [132673.238615] wlan0: associate with 02:0d:xx:xx:xx:xx (try 1/3)     [132673.242412] wlan0: RX AssocResp from 02:0d:xx:xx:xx:xx (capab=0x411 status=0 aid=42)     [132673.242633] wlan0: associated     [132673.242656] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready     [132771.173489] wlan0: authenticate with 02:0d:xx:xx:xx:xx      [132771.176705] wlan0: send auth to 02:0d:xx:xx:xx:xx (try 1/3)     [132771.178662] wlan0: authenticated     [132771.178812] ath9k 0000:02:00.0 wlan0: disabling HT/VHT due to WEP/TKIP use     [132771.180561] wlan0: associate with 02:0d:xx:xx:xx:xx (try 1/3)     [132771.183608] wlan0: RX AssocResp from 02:0d:xx:xx:xx:xx (capab=0x411 status=0 aid=42)     [132771.183788] wlan0: associated     [132847.144627] wlan0: authenticate with 02:0d:xx:xx:xx:xx      [132847.148698] wlan0: send auth to 02:0d:xx:xx:xx:xx (try 1/3)     [132847.151334] wlan0: authenticated     [132847.151516] ath9k 0000:02:00.0 wlan0: disabling HT/VHT due to WEP/TKIP use     [132847.153707] wlan0: associate with 02:0d:xx:xx:xx:xx (try 1/3)     [132847.156603] wlan0: RX AssocResp from 02:0d:xx:xx:xx:xx (capab=0x411 status=0 aid=42)     [132847.156887] wlan0: associated     [132934.091818] wlan0: authenticate with 02:0d:xx:xx:xx:xx      [132934.096306] wlan0: send auth to 02:0d:xx:xx:xx:xx (try 1/3)     [132934.100465] wlan0: authenticated     [132934.100729] ath9k 0000:02:00.0 wlan0: disabling HT/VHT due to WEP/TKIP use     [132934.101241] wlan0: associate with 02:0d:xx:xx:xx:xx (try 1/3)     [132934.109120] wlan0: RX AssocResp from 02:0d:xx:xx:xx:xx (capab=0x411 status=0 aid=42)     [132934.109371] wlan0: associated     [132968.899246] wlan0: deauthenticating from 02:0d:xx:xx:xx:xx by local choice (reason=3)     [132975.768437] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [132976.537373] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [265430.541914] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [299569.814859] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [301615.881104] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready     [301615.882783] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready     [374676.306364] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [374677.397056] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [374679.467541] wlan0: authenticate with 00:15:xx:xx:xx:xx      [374679.487502] wlan0: send auth to 00:15:xx:xx:xx:xx (try 1/3)     [374679.529658] wlan0: send auth to 00:15:xx:xx:xx:xx (try 2/3)     [374679.532999] wlan0: authenticated     [374679.534934] wlan0: associate with 00:15:xx:xx:xx:xx (try 1/3)     [374679.541256] wlan0: RX AssocResp from 00:15:xx:xx:xx:xx (capab=0x1 status=0 aid=10)     [374679.541649] wlan0: associated     [374679.541667] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready     [374679.541999] wlan0: deauthenticating from 00:15:xx:xx:xx:xx by local choice (reason=3)     [374700.382139] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready


make an application startup automatically

I'm new to linux. Here I have an application deployed to linux, I want the app to startup automatically when the linux start up. I'm using an command like `'sudo ./start'` to start the application. How Can I do that? Please give an detailed description. OS: CentOS 6 Thanks!


When will `find . -exec COMMAND {} +` execute COMMAND multiple times?

If I do               find . -exec echo {} +      it prints all paths in one line, i.e. command `echo` is only executed once. But according to `man find`, > >     -exec command {} + >         ... the number of invocations of the command will >     be much  less  than  the  number  of matched files. ... >   It seems that in some circumstances the command will be executed multiple times. Am I right? Please exemplify.


Testing intranet network

This is probably a question already discussed here and there. I'd like to try to gathering here all the information. Suppose I'm on a machine connected to a network. This network has access to the internet. I'd like to write a `bash` script to detect the maximum information possible in order to   1. Map the network around me      1. Number of devices connected     2. Types of services offered by each device   2. Know how many devices I must run through in order to reach the router to the internet (counting hops)   3. Latency between each step   4. Strength of signal if the link between A and B is wireless    5. Maximum uplink and downlink speed between two devices on the intranet I don't need the final script, I'd like to get dirty doing this, but I need tips on the right approach. I've got a good knowledge of network theory but really a poor knowledge of the practical side and the best I have come up with is flooding the subnet with pings and trying to reverse engineer the network using it.. rubbish!


xv-like image viewer that lets me annotate/mark images?

When I'm viewing many images w/ xv (sometimes in "visual schnauzer" mode), I sometimes want to "bookmark" or annotate a given image. I don't think xv can do this, but is there another xv-like image viewer that can? Is it possible to add "programmable hot-keys" to xv so that typing certain letters lets you call external commands (eg, "emacs (filename of picture you are viewing)")? I think that xv has a 'mark' feature, but that's more internal, and the marks go away after I close xv. I realize I could just open a text editor and make notes myself (typing in the filename by hand or maybe using xv's "info" window), but is there an easier way to do this?


Where do executables look for shared objects at runtime

The title is pretty explicit. I understand how to define include shared objects at linking/compile time. However I still wonder how do executables look for the shared object (*.so libraries) at execution time. For instance my app `a.out` calls functions defined in the `lib.so` library. After compiling, I move `lib.so` to a new directory in my `$HOME`. How can I tell `a.out` to go look for it there?


How can I fix "cannot find a valid baseurl for repo" errors on CentOS?

I finished installing CentOS 6, but when I tried running `yum update` I got:               [root@centos6test ~]# yum update     Loaded plugins: fastestmirror, refresh-packagekit     Determining fastest mirrors     Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=i386&repo=os     error was 14: PYCURL ERROR 6 - "" Error: Cannot find a valid baseurl for repo: base      Why is that happening? How can I fix it?


Converting a history to a script?

Often times I've typed in a bunch of commands when I realize that I am going to keep typing them in and that I would really like a script. Now I understand that no matter how I save my history, I am going to have to edit it to clean things up, but would like to hear suggestions on how to save my history so that it is close to a usable script.


Does a process invoking oom-killer kill itself?

Looking through `syslog`, I see lines like `dd invoked oom-killer`. Does this mean `dd` is being killed by the `oom-killer` or does it mean `dd` asked oom- killer to go kill another high memory process?


SCP works, but SSH doesn't (over wifi)

As the title says, when I'm using wifi at my office, I'm able to copy files to and from my server using SCP, but for some reason SSH is non-responsive. It just hangs, doesn't print anything, and I can't `ctrl-c` to end it; I have to close the terminal window. When I'm plugged in on the LAN, everything works fine. Any ideas how to figure out what's going on?


Using sed to add a URL to the start of every line

I have the URL (see below) of a certain web page that lists many different versions of a software package.               URL=http://ftp.gnu.org/gnu/wget/      The following one-liner gets me the latest version tar ball and its signature file out of the HTML.               wget -qO- http://ftp.gnu.org/gnu/wget/ | grep tar | cut -d\" -f6 | tail -n4 | grep gz      Probably not the shortest most efficient one liner, but hey, I'm learning and I'm open for feedback. The result of the above is this:               wget-1.15.tar.gz     wget-1.15.tar.gz.sig      Now, the next logical step (to me at least), is to pipe the output above into `sed` and append the `$URL` to the front of each line so that the output looks like:               http://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz     http://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz.sig      And then I want to pipe that right back into `wget` to download the files. The question is this: How do I append the value of the bash variable `$URL` to the front of each line of output using `sed`? I tried the following:               sed "s/^/$URL/"      But that only gives me the error:               sed: -e expression #1, char 11: unknown option to `s'      I also know that the basic concept is good, because when I use the following, I get good results...               VAR="Gorauskas, "     echo "Jonas" | sed "s/^/$VAR/"      So, my guess is that I need to somehow escape all of the `/` character in the `$URL` variable... Am I on the right track?


How to undo sudo add-apt-repository?

I run               sudo add-apt-repository ppa:noobslab/indicators      to install `my-weather-indicator` but it requires GTK3 and I don't want to proceed. So I'd like to undo that command. I'd checked my `/etc/apt/source.list` but I didn't find any line related to it. What should I do now?


Is there a command line utility to transpose a csv-file?

Given a file like so               First, Last, Age     Cory, Klein, 27     John Jacob, Smith, 30      Is there a command line utility to transpose the contents so the output appears like so               First, Cory, John Jacob     Last, Klein, Smith     Age, 27, 30


Gdm uninstallation fails (“pre-removal script returned error”)

I installed gdm on my vps and now I want to remove it but get this error:               root@server2:/etc/init.d# apt-get remove gdm3     Reading package lists... Done     Building dependency tree     Reading state information... Done     The following packages will be REMOVED:       gdm3     0 upgraded, 0 newly installed, 1 to remove and 6 not upgraded.     After this operation, 7066 kB disk space will be freed.     Do you want to continue [Y/n]? y     (Reading database ... 119416 files and directories currently installed.)     Removing gdm3 ...     invoke-rc.d: initscript gdm3, action "stop" failed.     dpkg: error processing gdm3 (--remove):      subprocess installed pre-removal script returned error exit status 127     configured to not write apport reports                                           invoke-rc.d: initscript gdm3, action "reload" failed.     Errors were encountered while processing:      gdm3     E: Sub-process /usr/bin/dpkg returned an error code (1)     root@server2:/etc/init.d#


How to calculate per CPU load

Is there any C API to calculate per CPU load? `/proc/loadavg` gives the CPU average load for all available CPUs and `/proc/stat` doesn't mention anything about active processes per CPU. How can I obtain the load per CPU?


shell script to print rows if there is a value in column 2

1 **2** 3 4     3 1 4 2     1 4 3 2     4 **2** 1 3      How can I print all rows, on which there is a **2** in the second column.


How to set up SSH on Ubuntu desktop and bind sub-domain to it for remote access outside network?

I am pretty to new to SSH and I have a question regarding access to my machine outside network. I have a Linux machine sitting in my apartment running almost all the time and connect to the network through a router. I want to be able to ssh into it from outside the network on my laptop (can ssh within network using private address already). After some research, it seems like I need to enable port forwarding but I am not sure how to do that. Also, I have a domain myself and I would like to bind a sub-domain (ssh.example.com) to my ip address and have my desktop update the binding everytime it reboots (check if ip changed, if so update the domain). Is there a tutorial online for these?


A virtual file containing the concatenation of other files

Is there a way of creating a filesystem object akin to this:               mknod files p     cat file1 file2 ... fileN > files      but such that it can be seeked in, as if it were a regular file?


Linking /proc/mnt to /proc/mounts

I understand that `/proc` filesystem reflects the output of various processes. Unfortunately, I have a propietary (`romdump`) binary that expects the mount table to appear as `/proc/mtd`, while my Android device appears to output it as `/proc/mounts`. I've tried creating a symbolic link, but clearly this only works for actual files or directories. How can I fool this binary to read the output from `/proc/mounts` instead of `/proc/mtd`?


How to split a ddrescue disk image and how to use it again?

I have a 500GB external HDD that I need to rescue the contents of. Unfortunately I only have two 400GB partitions to save the contents to. Can I split the disk image as:               ~$ cd /mnt/part1/Recovery/     /mnt/part1/Recovery/$ ddrescue -f -n -i0 -s250...00 /dev/disk disk.part1.ddraw disk.part1.log     /mnt/part1/Recovery/$ cd /mnt/part2/Recovery/     /mnt/part2/Recovery/$ ddrescue -f -n -i250...00 /dev/disk disk.part2.ddraw disk.part2.log      (values of numbers are missing a few zeros for convenience). That is, can I just use the `-i` and `-s` flags to split the disk image into two parts manually? Secondly, is there a way I can mount the two parts of the image as one?


Some GUI programs hung up

Today I decided to migrate to systemd. Everything work quite good, but I have problem with few GUI programs - they hung up after draw window (see img at the end of msg). Program in which I discovered this problem:   * firefox   * chromium   * gimp   * xnmap   * gparted Program without this issue:   * vlc   * virtualbox   * xclock   * xskat :)   * xcalc   * feh I have no idea whats going wrong. I looked at logs in /var/log but there is nothing new after running problematic app. My system is up-to-date Archlinux, and I have awesome wm. ![Firefox-Chromium-Gimp](http://i.stack.imgur.com/xuf12.png)


How to set up Kate to use Nautilus as a file manager?

I use Gnome-based Ubuntu 10.10 and Kate text editor. If I right-click on a folder in Kate's file system navigation panel and choose to open the folder in a file manager, Filelight (a disk space occupation diagramming tool) pops up (which is far from what was intended). Can I set up Kate to open Nautilus in such a case?


Auto mount HP USB Flash drive Error

I am using RHEL 5, If i plug my USB Flash drive i'm getting Error message as follows, ![alt text](http://i.stack.imgur.com/N1iKf.png) This much days It work smoothly, And now it working with windows XP well. Where is the problem ? How can i solve it ?


Can't access to miniDLNA

I wanted to install a dlna server on my asus eeepc, and tried minidlna. My eeepc runs Wheezy, so I just had to run apt-get install to install minidlna on it. The first time I ran it, everything worked fine, but once I restarted the service, I could never access it from VLC (running in Squeeze) again. My config file:               media_dir=V,/home/media/vid     media_dir=P,/home/media/pic     media_dir=A,/home/media/aud          db_dir=/home/user/.minidlna     log_dir=/var/log          network_interface=wlan0     port=8200          inotify=no      Thanks in advance for helping!


Can't echo or create a symbolic link to a file with special characters in its name inside bash script

I'm trying to create a symbolic link to files with the following naming convention:               .$abc$namehere.zip;1      As can be seen, it has the following special characters in it: . $ ; In my bash script I have the following lines of code:               FILE1=`find /mydir/ -name "\.\$abc\$*namehere*.zip*" | sort -rn | head -1`     ln -s $FILE1 .     echo "$FILE1"      When I issue the `find` command by itself on the command line, I get a result displayed on screen of the file that I am interested in. However, when it is placed in the script above, the symbolic link command returns:               ln: `./.': cannot overwrite directory      And the echo command returns a blank line instead of the file name. May I get some help as to how I can fix this in my script so that I could create a symbolic link to these files with special characters?


How do I share applications windows between OS X and Linux?

I originally asked this question over on Super User, but I didn't get any answers. I'm trying to set up Xdmx on my Macbook Pro and my Ubuntu 10.04 workstation so that I can share my MBP's keyboard and mouse as well as X applications running on the workstation across the laptop display, a laptop attached monitor, and the workstation's monitor.   1. Where do I find the latest Xdmx? The Sourceforge site says that the code there is unmaintained and the project has been merged into Xserver. I can't find an up to date source or binary distribution.   2. How do I install it? Is there a package file? Do I have to build from source?   3. Are there other options for accomplishing what I've described above?


Portable encrypted container

I want to store some data encrypted to carry around with me (this includes some scans of relevant paperwork, my TAN List for online banking, my gnupg and ssh keys and stuff like that). So not really a _huge_ amount of data but also more than a little textfile. What I want is a container I can put on my thumbdrive to carry things around in that is fully encrypted. A few more requirements:   1. Strong Encryption, so no ZIP with passwords   2. I want to sync the container to more than one location (in case the thumbdrive breaks or is stolen for example) so I cannot just create another dmcrypt partition on the thumbdrive   3. I want to open the container from my GNOME environment without a lot of terminal fiddling. Not that I don't like terminals, but I want a certain level of convenience. (Right-clicking in nautilus to "mount" is OK, entering 3 commands in a terminal is not)   4. Bonus: Something I can open from Windows and/or OSX as well


Can you recommed a discrete simulation modelling system (like GPSS or Rockwell Arena) for Linux?

Do you know of a tool for discrete processes (those like production, logistics, client queue service (retail, call center etc.) etc.)) simulation modelling? I am familiar with 2 of such applications for Windows: Rockwell Arena and GPSS World. Are there any free alternatives for Linux? Maybe even standard (BEPL/UML/IDEF0/2/3) aware?


Starting firefox on a remote host (over ssh) opens a new window locally: what is happening?

I have never noticed this behaviour before, and am a little confused as to what is happening. I have a local copy of firefox running, then ssh (`ssh -X <url>`) into a remote server and start a copy there to use the local display. Turns out the local firefox just opened a new window. I verified with `ps x|grep firefox` that indeed no firefox process is started on the remote server. This same strange behaviour happens in reverse: if I have a remote firefox running and try to start a local one, then the remote one opens a new window. I am on ubuntu 10.4, with a nearly completely fresh install (I just got this computer this afternoon). I was trying to have the two firefoxes running at the same time so that I could easily run down the list of plugins to install. What is happening here, and how can I avoid it from happening?


Can I use grep matches to execute command? CentOS

I need to upgrade php from 5.3 to 5.4. I've installed it with rpm. I want clean install: delete all 5.3 packages, and install all necessary 5.4. Here is the command to see all installed packages:               rpm -qa |grep php      It prints out a list of packages, and I want to remove all them with:               rpm -e *pakage.name*      Can I iterate over all matches in grep results and use each match in:               rpm -e *grep.match*


How to calculate the size of a file list (not a directory)?

This command:               $ time (\ls /path/to/lots/of/dir*/*/*/*.ext > inputs.txt )          real    1m9.064s     user    1m3.265s     sys     0m5.993s      Gives me a huge list of file names inside the file "inputs.txt". I need to know the total size of all files described in inputs.txt, preferably without list all of them.


How to make an alias active in both current session and in .bashrc at same time?

I just found frequently I decide to add an alias for longer time use at the same time use it now. So I have to type the same thing twice, first in current bash session then .bashrc.


Why programs often fail to run when started by `daemon`?

I do `daemon -f -i ./some_gui_program` - it starts. I do `daemon -i ./some_gui_program` - nothing visible happens. Why I can't start GUI programs detached on Linux this way? What's the use of daemon's `-f` option if it changes behaviour that much?


do changes in /etc/security/limits.conf require a reboot?

do changes in `/etc/security/limits.conf` require a reboot before taking effect? Like if I have a script that sets the following limits in `/etc/security/limits.conf`, does this require me to reboot the system before those limits will take effect?               * hard nofile 94000     * soft nofile 94000     * hard noproc 64000     * soft noproc 64000


Desktop environment agnostic folder backdrop for wmaker

I recently stripped down my debian box, abandoning all desktop environments and running just WindowMaker with some self-written startup files. While I love the simplicity and speed of this setup, there is one thing I miss: I can no longer drop files onto my desktop. I am wondering if there is a standalone program, I can just start and which displays a certain directory and accepts drops from filemanagers. I thought I might just use some file-manager, make it sticky and somewhat get rid of the window decorations and menus. I tried Thunar, Pcmanfm and Krusader but drag'n drop did not always work between them.   * Is there a lack of standardization for drag'n drop, so it does not always work, or do you think I missed something?   * Is the window manager involved in drag'n drop and my ancient WindowMaker might be to blame?   * Is there such a thing as a standalone (desktop environment agnostic) desktop backdrop?


Python script run while screen is locked

I have a python script which seems to be failing to continue running its `while True: ... sleep()` loop my code is at http://github.com/xdaimon/xdaimonConky What happens is I autostart python on system boot by running... start.sh               #! /bin/bash     sleep 120     cd ${0%/*}     conky -d -c ~/.conkyrc2     python profitability.py &      cd ${0%/*} brings me to the correct directory where I eventually start profitability.py profitability.py eventually runs               while True:         ....         time.sleep(2000)      This works out to be about 33.3 minutes. This python script seems to run correctly as long as my screen does not lock. After a screen lock my script ceases to run, although there is still a python process. I'm writing this to be at least somewhat portable to other linux computers and can't have disabling screen lock or keeping a terminal open for python as prerequisites :) There is a lot that I do not understand I am sure, I'm open to many different options here. Any help is appreciated. * * * I ran this script in the terminal until it quit. I had a urllib error due to poor internet connection. I wrapped urllib2 piece of code in a try: except: statement, which fixed this issue. Although this may have been the cause for my script to fail I have confirmed through much testing that my script still fails if I close my terminal and lock my screen. I have implemented the code found at a url posted below, which works awesome while I use my computer but if I decide to lock and walk away scheduled events do not happen. http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ I'm using ubuntu GNOME 13.10 with gnome 3.


Fedora 19 xrdp login fails after screen lock

I'm using Fedora 19. I've installed xrdp using instructions found here: http://www.scottalanmiller.com/linux/2013/08/18/installing-xrdp-on-fedora-19/ Everything works great until the screen locks. After the screen locks, I can slide the time screen up and the login form appears; it says my user name + "Authentication Error". If I put in my password, a spinner appears and it never logs me back in. Although I can click the "Log in as another user", it doesn't do anything. The only way I've found to clear this is to restart the xrdp service but then all my windows are closed. Is there a way to recover from the lock screen or should I turn it off?


Will stat() cause an actual harddisk access or is the information cached?

While optimising my PHP opcode caches, I tried alternating the stat setting ( = the opcode cache checks, whether a file was modified via `stat()`, before using the cached results). But I did not see any difference in my application benchmarks. The filesystem in use is `ext4`, mounted with `noatime` option. Is it correct to assume, that the metadata used by stat(), is kept in memory, or is there always some kind of harddisk interaction when `stat()` is used?


CUPS remote printer entry is stopped locally

My local CUPS daemon on my laptop has an entry for a remote printer on my CUPS server. My local CUPS daemon thinks this printer is stopped, but it's not. The only interface CUPS gives me to manage this remote printer is a hyperlink to the CUPS printer on the server. This tends to happen when something tries to query status on this remote printer when I'm not on my local network. The local CUPS will then permanently mark it stopped and say it couldn't find it. However, once I get back on the local LAN it never removes the `'stopped'` status. (Even rebooting does nothing) The only way I can print again is to stop my local CUPS process, edit the `/etc/cups/printers.conf` file to manually change the status to "Idle", and restart the CUPS server. Surely there's a better way?? **EDIT:** Oh yeah, I previous solved this by creating a new remote printer entry. However, I couldn't find any way to DELETE the old remote printer entry. I had to edit printers.conf for that as well. Is there a way to manage remote printers entries at all? **EDIT:** This is CUPS 1.4.3. I also found a 'cupsenable' command that was only mentioned on the "What's new" page and the printers.conf docs online. I'll try that next time and see if it works.


Getting contradictory information regarding the linux distribution

I wanted to check which linux distribution is running on a remote linux box given to me .i have see this answer on super user which says that > LSB tools provide this information And then it goes on to say that on systems where LSB is not installed for most popular distros the following will do the trick :               cat /etc/*{release,version}      Now here is what I saw using these two techniques :               [subhrcho@slc04lyo pcbpel]$ lsb_release -irc     Distributor ID: EnterpriseEnterpriseServer     Release:        5.8     Codename:       Carthage     [subhrcho@slc04lyo pcbpel]$ cat /etc/redhat-release     Red Hat Enterprise Linux Server release 5.8 (Tikanga)      My question why am I getting contradictory information from running these commands ? What am I missing here ? Additional information : When issuing uname -or command I get the following :               2.6.18-308.4.1.0.1.el5xen GNU/Linux


Missing Firmware for Wired NIC on Debian

I'm trying to install debian 64bit from a debian live image using YUMI on my usb drive. I'm installing it on an Inspiron 6400, and there is missing firmware. I can't connect to the internet whatsoever, and am at a loss. I've tried configuring it myself to no avail. I downloaded the drivers, transferred them to the laptop, and it wouldn't run the install file because none of the networking directories seemed to exist. Does anybody have experience with this, or could anybody nudge me in the right direction? Thanks. EDIT: So guys, here's what I did. I figured it out eventually. What I did was download the firmware for the wireless card, put it on a usb drive, bring it to my laptop, and install it. Then I painstakingly downloaded every package and every dependency for wicd-curses, and installed that. Then I connected to my wireless with that, and got internet at this point. I tried getting the wired card to work but after many days I gave up and settled for wireless.


Understanding the output of the "who -a" command

I ask this question because, while there are many answers on the internet showing that "who -a" is an option, nobody explains how to read the output. If you can provide a link to an online site that explains this, that would also be an awesome answer. Here is an example that I want to decipher:               [bo@hostname ~]$ who -a                             Jun 17 03:47               590 id=si    term=0 exit=0                system boot  Jun 17 03:47                run-level 3  Jun 17 03:47                   last=S                             Jun 17 03:48              4424 id=l3    term=0 exit=0     LOGIN      tty1         Jun 17 03:48              5503 id=1     LOGIN      tty2         Jun 17 03:48              5504 id=2     LOGIN      tty3         Jun 17 03:48              5505 id=3     LOGIN      tty4         Jun 17 03:48              5506 id=4     LOGIN      tty5         Jun 17 03:48              5507 id=5     LOGIN      tty6         Jun 17 03:48              5508 id=6                pts/0        Oct 19 16:27             15250 id=ts/0  term=0 exit=0     bo       + pts/1        Oct 23 12:24   .         19776 (10.10.10.93)                pts/2        Oct 23 13:07              8551 id=ts/2  term=0 exit=0                pts/3        Oct 22 10:36              5813 id=ts/3  term=0 exit=0                pts/4        Oct 10 09:06             13002 id=ts/4  term=0 exit=0


building my own initrd, how to populate dev directory

I am trying to learn stuff about initrd. I have followed this tutorial to build my own initrd from scratch, and I installed busybox on it. Then I made an .iso from it with isolinux, so I could test it in virtualbox. It works great! I have the basic commands from busybox, so I wanted to mount a filesystem. But the /dev directory is almost empty (no sda), except for some files I created while following the tutorial. I learned about udev and I think this is what I need. However I am not sure how to go on this. Should I just grab the latest source code from udev, compile it and add it to my initrd? And then call /bin/udev or something like that in my init script? Or is there an other/better way to populate the /dev directory? **Edit:** Some additional info and updates on what I have done already.   * I test everything in virtual box. I just installed ubuntu minimal in virtual box, made an .iso from my initrd, and then boot from the iso in virtualbox.   * I used the vmlinuz and `/lib/modules` that were present on a debian-businesscard.iso and copied those over to my initrd which I created by following the tutorial I linked earlier.   * Kernel has `CONFIG_DEVTMPFS=y`   * Some devices show up in `/dev`, like tty0-tty63 and some others, but no sda/hda.   * Ran `lspci -k` in my currently running OS and in a virtual box to check which modules are in use. `SATA Controller` says it uses `ahci` as module.   * When I execute `modprobe -v ahci` it complains a lot about "unknown symbol: ata_some_stuff", but after that it returns something like `SCSI Subsystem initialized`, `ATA-6: VBOX HARDDISK` and `Direct-Access ATA VBOX HARDDISK`. However, still no harddrive devices found in `/dev`. My current `/init/` script is as follows:               #!/bin/ash     mount -t devtmpfs none /dev     mount -t proc /proc /proc     mount -t sysfs none /sys     modprobe -v ahci     echo "Hello world"     exec /bin/ash --login      Does anyone has any idea what I am doing wrong and what I should be doing instead?


Portforwarding on LAN

I have a server with Zentyal 3.0 (Ubuntu 12.04 LTS). I have 2 lancard (`eth0 - internet, eth1 - LAN`), a DNS (`sz**.myftp.org`). The portforward works, but when I aks a request for DNS address or outer IP address from LAN, it can't contact the server. (when I do it from outside it can contact.) Ask for anything that I used or I have, I will tell you about it.


xmllint display values of more than 1 attributes in single execution

I am using xmllint to parse xml file which has several tags and each tag has several attributes. Sample structure as shown below:               <root>        <child attr1="abc" attr2="def" attr3="ghi" />        ...        ...     </root>      I need to fetch the values from the attributes `attr1`,`attr2` and `attr3`. So far, I have tried the following which is giving the data of one attribute perfectly               echo 'cat //root/child/@attr1' | xmllint --shell data.xml       This output               attr1="abc"      So, my question is, how can we specify more than one attributes in the string to get the required output as               attr1="abc"     attr2="def"     attr3="ghi"      I tried the following for this, but no good result:               echo 'cat //root/child/@*[attr1|attr2|attr3]' | xmllint --shell data.xml      echo 'cat //root/child/@*[attr1 or attr2 or attr3]' | xmllint --shell data.xml       output for above was that the echo statement was re-echoed again that means, the xmllint didn't accept it as input. Any ideas on how to go about this?


rpm query does not give complete provided capabilities (commands)

For example, I know /usr/sbin/agetty is provided by the `util-linux` package with the following command:               $ rpm -q --whatprovides /usr/sbin/agetty     util-linux-2.24.1-1.fc20.x86_64      Then I would like to know what commands are provided by `util-linux`:               $ rpm -q --provides util-linux     /bin/dmesg     /bin/kill     /bin/more     /bin/mount     /bin/umount     /sbin/blkid     /sbin/blockdev     /sbin/findfs     /sbin/fsck     /sbin/nologin     config(util-linux) = 2.24.1-1.fc20     eject = 2.1.6     util-linux = 2.24.1-1.fc20     util-linux(x86-64) = 2.24.1-1.fc20     util-linux-ng = 2.24.1-1.fc20      As you can see, the output does not contain agetty. I was wondering if this is an exhaustive list. Any ideas how to get the complete list?


Used xrandr to rotate monitor but cannot reverse it after deleting script

I following a guide to have my tablet (Samsung ativ 700t running ubuntu 12.10 Gnome3) invert the screen 180 on login I place a script file in `/etc/X11/Session.d/45custom-script`. Contents of file: (going by memory)                 # I cannot remember if I had #!/bin/bash here at first but I'm betting no       xrandr -o half       xsetwacom set-prop 9 rotate 2       xsetwacom set-prop 9 area 100 200 25000 14000 # numbers approximated         On the next boot this rotated the monitor correctly but not the stylus input (device 9). I then delete the xrandr line to just test the xsetwacom but on the next boot it was still flipped (login screen was normal). Then I did a bunch of things to attempt to fix it   * changed the xrandr to `xrandr -o none`   * changed the file name to `95custom-script` and `invert-screen` removed the file completely   * made sure to delete the 'filename~' files that gedit created   * removed the xsetwacom lines   * removed and added `#!/bin/bash` and `#!/bin/sh` to the top My only theory is that the command was copied somewhere else and will not change again.


Linux Ubuntu from one architecture to another

I have an ubuntu installation (amd64) on a SSD "A" and I copied the whole harddisk to another SSD "B" , (GPT, sda1=BIOS Boot partion , sda2 = ntfs (windows) sda2=ext4 (ubuntu), sda3 = linux swap) I wrote the grub bootloader to the disk (on System with i7 970 CPU) with               grub-install /dev/sda      everything worked fine! On the i7 architecture I can now boot from the copied SSD "B". But how can I use the copied SSD "B" on another architecture like the i5 LGA1150. Booting on this architecture does not work, the bootloader is not found somehow (black screen with one underline). Do I need to install the grub bootloader on the new architecture first, and will the copied ubuntu installation work then or is there still some inconsistencies? Thanks a lot for the dumb question :-) **UPDATE:** Using Drive "B" : GPT Formated SSD **I have the following motherboard with the i5 CPU (does not work so far):http://www.asus.com/Motherboards/Z87PRO/** **For the i7 I have the Asus P6T7 (boots successfully):http://www.asus.com/Motherboards/P6T7_WS_SuperComputer** Might that be the reason? **UPDATE2:** So far, i disabled secure boot and turned on legacy boot in the bios of the Z87PRO, and changed the SSD "B" back to an MBR format, i installed grub on the i5 platform with the live cd (chroot method) and when trying to boot from "B" I could not boot into the bootloader, just black screen and returning to BIOS, i am a bit desperate... any ideas? **My Boot Repair Dum is here, the correct one now>http://paste.ubuntu.com/7185224/** **Solution:** Finally I was able to boot the SSD "B" drive (architecture was no problem) but I still had a GPT partition table, which was a problem: I Changed the GPT to MBR (here: http://askubuntu.com/questions/84501/how-can-i- change-convert-a-ubuntu-mbr-drive-to-a-gpt-and-make-ubuntu-boot-from) then I reinstalled Grub from a Live CD Ubuntu 13.10 , (SSD "B" system is 13.04) from here: http://ubuntuforums.org/showthread.php?t=1581099 (with the chroot method!) rebooted, and finally the Grub worked! and also I could boot the kernels on the i5 architecture! :-) Thanks a lot all for the kind support!!!


Mounting a network drive automatically when needed and unmount it again after some time with inactivity

I have a somewhat old NAS hosting my music collection. It is not capable of running a DAAP media server so I have mounted the music folder on my Sheevaplug (a tiny headless server running Debian) which then runs the DAAP media server. It works perfectly, but the problem is that the mounting of the samba share prevents the NAS from going into hibernation when there is no activity. If I unmount the share manually, the NAS will hibernate after some time. Because of that I am looking after a way to automatically mount the network drive when needed (ie. accessed) and unmount it again after a period with inactivy. I have tried `inotifywait` to monitor read access in the mount point, but unfortunately that does not catch reading from files not found which is what happens when the DAAP server tries to stream a music file in the empty folder. Then I have googled more and have found `autofs` which seems to be able to do exactly what I need. But unfortunately, even after reading a guide like this, I still don't understand how to use it. EDIT: I was confused by the small differences between Debian and Gentoo. In Gentoo the config file is /etc/autofs/auto.misc whereas Debian uses /etc/auto.misc and so on. Adjusting for those subtle differences, autofs works perfectly. It mounts the samba share when needed and unmouns it again after the timeout period given in auto.master


Make Completion Progress Script

Any time I'm executing a build process that takes several hours, I inevitably stare at my terminal and wonder, "how much longer?" Sometimes, I manually pick up on some pathname echoed to the terminal and then go into the maze of makefiles to determine where in the build process I am. This is obviously an imperfect, tedious process, so I was wondering, does any program out there do this automatically? I can imagine a script that goes through the make dependencies and constructs a dependency tree, and then, using some heuristic, estimates how much of the tree has been "completed" or "built." Has anyone ever heard of something like this?


Compare all text files in a directory, and sort by similarity

In Unix, is there any way to compare every text file in a directory to every other text file in the directory, and then sort each pair of files by similarity (using the `diff` utility)? There are already some command-line Unix programs (such as fdupes) that can find duplicate files in a directory, but I'm wondering if it's possible to find similar files using a shell script as well.


How to decode cmd = 3222823425 in ioctl in Linux 2.6.29

I am just confused like how can I break `cmd=3222823425` value into different parts to figure out what this command means actually in the Linux kernel. I know, some functions are making `ioctl` command with following parameters but I want to know what these parameter values mean.               fd=21, cmd=3222823425 and arg=3203118816       I have been looking into various forums, man pages and other links to figure this out like what does it mean when a `cmd` in an `ioctl` system call has value of `3222823425`. I have found that cmd is a command number which consists of `type`, `number` and `data_type` and first twos are `8-bit` integers (0-255). So my question is how to decode these parameter values to find out what this call is trying to do?


vim how to configure backspace and delete key's both as normal

How to configure following keys in `vim`?   * `Backspace` key to delete a character backwards.   * `Delete` key to delete a character forwards. After reading some posts, I got to know that only one of those can be used to delete a character. But I guess the above behavior would be achievable. ### Current scenario   1. `Backspace` working as said above.   2. `Delete` key is however acting weird. On pressing it, the character under the cursor get's replaced by `~`, and later 5-6 keystrokes changes it to aplahabet and also change the case. `Vim` comes back to normal mode after that, leaving messed-up text. ### Details               $ bash --version     GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)     Copyright (C) 2005 Free Software Foundation, Inc.     $ vim --version     VIM - Vi IMproved 7.0 (2006 May 7, compiled Jun 12 2009 07:08:36)      If the above is not configurable, Please let me know, How I can at-least map `Delete` key to nothing, so that above weird behavior doesn't take place ?


Will kjournald takes too much space?

I am changing my hard disk to ext3 because journalling got so much write my server crash. Well, now I use SSD. Journalling is no longer the issue. But SSD are small. Will journaling takes so much space? kjournald writes 5MB-10MB of data all the time. However, there is no file that's bigger than 2MB. So I wonder what it actually writes. We don't have this in windows right?


Syslinux 4.03 Stuck

I installed android 4.0 X86 in my HP Mini 110-4100LA (1.6GHZ and 1GB RAM, 298GB hard disk). I used LILI and unetbooting to create a pendrive, I used a Kingston USB 8GB, when I reboot my computer and press F9 I choose USB boot and instead of appear LIVECD. or install, or anything that I know that had to appear, I see a black screen with this               SYSLINUX 4.03 2010-10-22 EDD Copyright (c) 1994-2010, H. Peter Anvin et al      Why does this happen? What can I do to fix that?


Use awk to split line into array and use that array's values in calling shell

First of all, my apologies for the somewhat clumsily worded title. If you can think of a better one, please feel free to edit. [EDIT: done] What I am trying to do is use `awk` inside a `bash` script and do a rather common task: iterate well structured file lines and split them by a delimiter into an array. Here is a sample from the file:               Joe:Johnson:25     Sue:Miller:27      There are numerous examples how this can be done on a single line in the interactive mode, however, I am doing it in a script in which I would like to use that array manipulated by awk outside the awk subshell in bash itself:               cat ${smryfile} | while read smryline; do              echo ${smryline}              #now i want to split the line into array 'linearray' in awk but have it usable when i get back to bash         echo ${smryline} | awk '{split($0,$linearray,":")}'              varX=$linearray[2]         echo $varX         #do something with $varX          done      I get an error:               awk: syntax error at source line 1      context is          >>> {split($0,$linearray <<< ,":")}     awk: illegal statement at source line 1      Is it possible to do what I am trying to do (use arrays that are defined in awk outside of its scope) and how should I do it?


Nested loops, if conditions, and background jobs in bash

I have a bash extraction function that I am trying to parallelize. Its job is to find and extract nested archives. Ideally, I want the if evaluation and all of its actions to be sent to the background. The catch is that the action items of the if evaluation need to be done in order, so I can't just add an "&". to the commands in the if. Is there a way to encapsulate the entire if evaluation into a single background job and have the commands execute in order? Here is the current working function:               extract () {     IFS=$'\n'     trap exit SIGINT SIGTERM     for ext in zip rar tar.gz tar.bz2 tbz tgz 7z tar; do         while [ "`find . -type f -iname "*.$ext" | wc -l`" -gt 0 ]; do             for z in `find . -type f -iname "*.$ext"`; do                 if [ ! -d "`echo "$z" | rev | cut -c$(expr ${#ext} + 2)- | rev`" ]; then                     echo "Extracting `basename "$z"` ..."                     mkdir -p `echo "$z" | rev | cut -c$(expr ${#ext} + 2)- | rev`                     if [[ "$z" =~ ^.*\.7z$ ]]; then 7z x "$z" -o"`echo "$z" | rev | cut -c$(expr ${#ext} + 2)- | rev`" > /dev/null                     elif [[ "$z" =~ ^.*\.zip$ ]]; then unzip -uoLq "$z" -d `echo "$z" | rev | cut -c$(expr ${#ext} + 2)- | rev` 2>&1 | grep -ive warning                     elif [[ "$z" =~ ^.*\.tar\.xz$ ]] || [[ "$z" =~ ^.*\.tar\.gz$ ]] || [[ "$z" =~ ^.*\.tar\.bz2$ ]] || [[ "$z" =~ ^.*\.tgz$ ]] || [[ "$z" =~ ^.*\.tbz$ ]] || [[ "$z" =~ ^.*\.tar$ ]] ; then tar -xaf "$z" -C `echo "$z" | rev | cut -c$(expr ${#ext} + 2)- | rev`                      elif [[ "$z" =~ ^.*\.rar$ ]]; then unrar x -y -o+ "$z" `echo "$z" | rev | cut -c$(expr ${#ext} + 2)- | rev`                     fi                     rm -f "$z"                 else echo "Omitting `basename "$z"`, directory with that name already exists."; rm -f "$z"                 fi              done         done     done      }      Also, I am curious if there is any way to perform the extraction without deleting the source archives. I currently do this to prevent an endless loop. For now, the function is reliable enough to not loose any data, but I would like to avoid deleting anything for safety.


How can I read line by line from a variable in bash?

I have a variable which contains multiline output of a command. What's the most effecient way to read the output line by line from the variable? For example:               jobs="$(jobs)"     if [ "$jobs" ]; then         # read lines from $jobs     fi


Allow user1 to "su - user2" without password

I need to allow user `martin` to switch to user `martin-test` without password               su - martin-test      I think this can be configured in `/etc/pam.d/su`. There are already some lines in that file which can be uncommented. However, I don't like the idea of adding user `martin` to group `wheel`. I don't want to give `martin` any more privileges than to be able to switch to `martin-test`. I also do not want to use `sudo`. What would be the best way to do it, while keeping the privileges of user `martin` minimal?


Isn't /boot a separate mount?

My understanding is that `/boot` is being accessed by lower level tools (e.g. grub) during system startup and so it is formatted specially in a simpler format than the rest of the disk.   But when I do:               ~$ df       Filesystem     1K-blocks    Used Available Use% Mounted on       /dev/sdb1      230693004 4764776 214186584   3% /       none                   4       0         4   0% /sys/fs/cgroup       udev             3008452       4   3008448   1% /dev       tmpfs             611080    1220    609860   1% /run       none                5120       0      5120   0% /run/lock       none             3055384     368   3055016   1% /run/shm       none              102400      20    102380   1% /run/user       /dev/sdb5      368970628 1623180 348581216   1% /home        I don't see `/boot` mounted in Kubuntu. Shouldn't it be in this list as a separate mount?   I am using the latest Kubuntu


Let remote ssh session know about tmux?

Assume I run a `tmux` session on machine A and from it I start an interactive shell via `ssh` to machine B. I'd like to change machine B's `PS1` to better suit the use from under `tmux`; for instance, I'd include different things into the XTerm title string. I would rather not edit machine B's settings to always show a tmux-optimized prompt. Sometimes I `ssh` to machine B from a plain terminal (not `tmux`) and would like it to use my regular `PS1` in that case. Is there a standard / accepted best way to achieve this? All I came up with so far is setting `AcceptEnviron` in machine B's `sshd` config and pass a custom signal variable at `ssh` connection time.


Providing ftp access (of selected files) to users from a hashed repository of unique files

We have a portal where each user has an account and a file repository that goes with it. Whenever any user uploads a file using a form, the php app hashes the file contents first and checks to see if the file already exists in the system (even if uploaded by a different user). If the file exists, no new file is stored, instead the system only saves a row with the details of the uploading user and links to the original file. This method eliminates file duplicates and saves space . But we are encountering a problem now; every user also gets an ftp account, which can be utilized to download his repository files. Since only unique files are stored, we need a way to show to every user all files from his repository. Since this isn't a simple ftp folder it requires tinkering around. We have seen symlinks and file mounts, both are not practicable because the former blocks access on permission grounds and latter requires thousands of files to be mounted individually at runtime.


how to determine the permissions of groups?

When you invoke sudo, it prompts for password and then checks the /etc/sudoers configuration file to see if the user is permitted access to run the command. /etc/sudoers is the sudo configuration file that enables certain users or groups to run certain commands. For example, below we make the user called john, from any terminal, run the command power off:               john ALL= /sbin/poweroff      Obviously the root user can do anything:               root    ALL=(ALL) ALL      Since root can do anything, we often want to use the sudo program to elevate ourselves to root (with a password prompt) to perform some system level commands. If we enter the right password for our user, then we can perform the command. But we need a way to make sure this user can be elevated to root in the first place. Hence, the purpose of /etc/group.               sudo:x:27:myuser      /etc/group is a text file which defines the groups to which users belong. File system permissions are organized into user, group, and others. The use of groups allows additional abilities to be delegated in an organized fashion, such as access to disks, printers, and other peripherals. When reading over some articles of how to use gammu-smsd daemon http://www.techytalk.info/send-receive-sms-using-gsm-modem-phone-ubuntu/ I came across this line: > We don't really want to enter our administration password every time we want > to send SMS message, so first thing we must do is to add our selves to the > dialout user group. All members of this group have permission to use modem- > like devices on Ubuntu system. And where is it defined that grants dialout group such privilege? I look in my etc/sudoers file and I find no mention of dialout:               $ sudo cat /etc/sudoers     # /etc/sudoers     #     # This file MUST be edited with the 'visudo' command as root.     #     # See the man page for details on how to write a sudoers file.     #          Defaults    env_reset          # Host alias specification          # User alias specification          # Cmnd alias specification          # User privilege specification     root    ALL=(ALL) ALL      I think there is a key element I am missing about groups.


How do I switch to vi editing mode in readline?

I want to switch to vi editing mode in a readline environment. But I don't want to use 'set -o vi'. I want to temporarily switch using a keyboard shortcut. The man page says I can do this with `M-C-j`. But that doesn't work for me. I'm using Ubuntu and an xterm. Doesn't work under gnome-terminal either.


Regarding separate a single file into multiple files according to line separation

Currently, I have a plain text file, A, such as               lowest priority     very high significance.     outstanding     very novel      In this file, every line contains a sentence. I want to separate this file into multiple files, and each file is composed of a single line of the original file, A. For instance, with respect to the example file A, I want to generate four files:   * A1, which has single line, `lowest priority`   * A2, which has single line, `very high significance`   * A3, which has single line, `outstanding`   * A4, which has single line, `very novel`. How to do that under linux?


Email sent from web server using PHP does not arrive

I am trying to send email via my web server using PHP but for some reason the email never arrives. According to PHP the email was sucessfully sent but I never receive the email. I know its not a spam problem as the web server used to be able to successfully send email until I reinstalled it last week. It has been installed with exactly the same OS and configuration except now it doesn't work. It is using the default PHP settings for sending email and I have enabled SMTP in the firewall but this doesn't seem to be working. Are there any logs for the PHP email sending that may be able to help me trouble shoot why it isn't working?


Shell scripts for the database logs

The actual log file will be like this               $ cat file1.log     time=2014-07-23 23:56:28 GMT, user=[unknown], db=[unknown], host= pid=28254 LOG:      time=2014-07-23 23:56:28 GMT, user=portalman, db=ss, host=172.18.183.45 pid=28254 LOG:  connection authorized: user=portalman database=ss     time=2014-07-23 23:57:28 GMT, user=[unknown], db=[unknown], host= pid=28269 LOG:  connection received: host=172.18.183.45 port=14493     time=2014-07-23 23:57:28 GMT, user=portalman, db=ss, host=172.18.183.45 pid=28269 LOG:  connection authorized: user=portalman database=ss     time=2014-07-23 23:57:28 GMT, user=[unknown], db=[unknown], host= pid=28270 LOG:  connection received: host=172.18.183.45 port=14494     time=2014-07-23 23:57:28 GMT, user=portalman, db=ss, host=172.18.183.45 pid=28270 LOG:  connection authorized: user=portalman database=ss     time=2014-07-23 23:57:58 GMT, user=[unknown], db=[unknown], host= pid=28273 LOG:  connection received: host=172.18.183.45 port=14495                                                 column "actice" does not exist at character 17     .     .     .      The total lines will be around 20,000. In this log file I need to fetch the unique errors, which I got through this command:               $ find file1.log | xargs grep -e ERROR -e FATAL | cut -d ":" -f4,5 |sort |uniq      Following is the result set and it not constant, it varies               syntax error at or near "?" at character 1     syntax error at or near "[" at character 1     syntax error at or near "desc" at character 1     syntax error at or near "describtion" at character 1      For getting the process id (pid) of each error I used:               $ find file1.log | xargs grep 'syntax error at or near "?" at character 1' | cut -d " " -f8 | tail -1     pid=25997      Now I got the process id,then I need to fetch the entire information of that process id               $ find file1.log  | xargs grep pid=25997     time=2014-07-23 23:10:02 GMT, user=[unknown], db=[unknown], host= pid=25997 LOG:  connection received: host=[local]     time=2014-07-23 23:10:02 GMT, user=dbman, db=ss, host=[local] pid=25997 LOG:  connection authorized: user=dbman database=ss     time=2014-07-23 23:10:02 GMT, user=dbman, db=ss, host=[local] pid=25997 ERROR:  syntax error at or near "?" at character 1     time=2014-07-23 23:10:02 GMT, user=dbman, db=ss, host=[local] pid=25997 STATEMENT:  ?column?         How to put all the 3 find commands in a shell script & do the process automatically? The errors & number of lines varies. Nothing is constant.


How to fix "ambiguous package name 'libglib2.0-0'" problem?

Using Ubuntu 11.10 64 bit, whenever I try `apt-get [anything]` or `dpkg [anything]` I get this error:               dpkg: error: el fichero de registros de disparadores menciona un            nombre de paquete ilegal `libglib2.0-0' (en el fichero           `/usr/lib/x86_64-linux-gnu/gio/modules'):           ambiguous package name 'libglib2.0-0' with more than one installed instance      Any ideas for this?


Can sources.list only be updated by hand?

I'm currently running Linux Mint. I remember that under Ubuntu, whenever a new release comes out, it prompts you with a choice of whether to upgrade or not. It seems like this is not happening in Mint, so I decided to do it myself since Lisa came out in December. My /etc/apt/sources.list currently has links to older versions, and there are several of them, some Mint, some Ubuntu, some mediubuntu, etc. Is there a way to update this list automatically? Is there perhaps at least an official sources.list posted somewhere that I can simply get for upgrading to the new Mint version (I'm using `apt-get dist-upgrade`)? Am I missing the point entirely?


aptitude remove pkg_name* not working like apt-get

I have uninstalled (aptitude purge) the `qt-sdk` package but there is still a lot of `qt4*` and `libqt*` packages on my system. Is there a way to remove all these packages with `aptitude remove/purge beginning_of_pkg_name*` like we can do with `apt-get`? Maybe with bash `${}` syntax? I don't understand why we can't do that with aptitude, it really sucks if you have to remove all this packages manually, one by one. PS: shouldn't `aptitude purge package_name` remove all dependencies it has downloaded?


Killing multiple GNU screen sessions with the same name

Sometimes my script bugs out and multiple screen sessions with the same name get created. Is there a way to kill all of these with this name in one command?               Rx:/scripts# screen -S haydoz-script -X quit     There are several suitable screens on:             13372.haydoz-script     (09/10/11 07:44:05)     (Detached)             12287.haydoz-script     (09/10/11 07:30:45)     (Detached)             12230.haydoz-script     (09/10/11 07:17:42)     (Detached)             7824.haydoz-script      (09/09/11 11:42:26)     (Detached)             7764.haydoz-script      (09/09/11 11:35:40)     (Detached)             15753.haydoz-script     (09/04/11 15:00:27)     (Detached)             15744.haydoz-script     (09/04/11 15:00:26)     (Detached)      There are other screens running besides these ones that I do not want to kill.


DTrace to trap any chmod applied to certain files

Underneath the Mac OS X directory /audit I have certain files which users can access and chmod to their liking. I need to audit any chmod done on any files by recording the time, user and file being chmod, especially the latter. I can dtrace -n 'syscall::chmod:entry' and detect the events, how do I read the first argument to chmod? man 2 chmod tells me the path is in the first argument:               chmod(const char *path, mode_t mode);      but how can I read args[0]? I think I am doing this the wrong way around.. perhaps entry doesn't correspond to the actual syscall? If I have a probe I can monitor, how can I check which parameters it offers for access and what types they are? I am assuming some pointers will need to be dereferenced based on their data layout..


How to check if the system is ready for mounting NTFS by user?

There are (too) many posts already on the subject, yet I am stuck. I found very relevant post here: Unable to mount NTFS partition from user account and I also read FAQ here: http://www.tuxera.com/community/ntfs-3g-faq/#useroption and I still have problem mounting NTFS partition as user. Mounting as root (or mounting with sudo) works. So now I am wondering if my system is ready for mounting with user at all. My fstab entry options for the volume are:               noatime,     noauto,     noexec,     rw,     users,     shortname=lower,     uid=MY_USER,     gid=100,     fmask=111,     dmask=000       and when mounting I get error: > Error opening '/dev/sdc1': Permission denied > > Failed to mount '/dev/sdc1': Permission denied > > Please check '/dev/sdc1' and the ntfs-3g binary permissions, and the > mounting user ID. The requirements are (taken from FAQ):   1. ntfs-3g is compiled with integrated FUSE support   2. the ntfs-3g binary is at least version 1.2506   3. the ntfs-3g binary is set to setuid-root   4. the user has access right to the volume   5. the user has access right to the mount point 5 -- done, 4 - done, 3 -- done, 2 -- ntfs-3g-2010.10.2-2.1.x86_64 1 -- ? I have no clue how to check if FUSE is compiled within ntfs3g, and how to compare 1.206 version to 2010.10.2 version. So -- how should I check if it is possible at all to make things work for me? Because maybe my all struggle to mount it from user account are futile, because at my system it is simply not possible. openSUSE 11.4.


piping pwd to an executable as an argument

So I have an alias for "sublime text" http://www.sublimetext.com/docs/2/osx_command_line.html and very often I need to open a file or a folder right from the terminal, easy for a file:               subl myfile.html      and for a folder               subl /Users/me      But how can I use 'pwd' command to open current directory in sublime? Is there a way to pipe it in?


The result of ls * , ls ** and ls ***

I know using the command `ls` will list all the directories. But what does the `ls *` command do ? I used it and it just lists the directories. Is the star in front of `ls` means how deep it can list the directories?


Why do I not seem to have hidraw options on my system, and how can I fix my usb devices?

Starting today, I noticed a few problems with my system. USB devices, including the internal ones such as microphones, don't seem to be working at all. I first noticed when my keyboard and mouse weren't responding - however, checking dmesg, both the logitech unifying receiver and my external mics usb connections where being recognized. Thinking at first that the receiver may have simply stopped recognizing the input devices, I figured I'd resync them and I'd be good to go - except, that when I went to reference the needed hidraw device, I didn't have any. There is no dev/hidraw, no sys/class/hidraw, no anything it seems. (except a hidraw header under usr/include and some hidraw files under usr/src) So that /seems/ to be at least part of the problem - udev seems to be failing to do its job somewhere. But I've got no idea where to go next. Here's relevant bits that might be useful:   From dmesg:               [  178.045682] usb 3-4: SerialNumber: 201203     [  970.636450] usb 1-1.2: new full-speed USB device number 5 using ehci_hcd     [  970.731693] usb 1-1.2: New USB device found, idVendor=046d, idProduct=c52b     [  970.731698] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0     [  970.731701] usb 1-1.2: Product: USB Receiver     [  970.731704] usb 1-1.2: Manufacturer: Logitech      From lsusb:               Bus 001 Device 005: ID 046d:c52b Logitech, Inc. Unifying Receiver      From the udev monitor (udevadm monitor):               KERNEL[1111.431718] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2 (usb)     KERNEL[1111.432374] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0 (usb)     KERNEL[1111.432430] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.1 (usb)     KERNEL[1111.432495] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.2 (usb)     UDEV  [1111.438072] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2 (usb)     UDEV  [1111.441642] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0 (usb)     UDEV  [1111.442308] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.1 (usb)     UDEV  [1111.442924] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.2 (usb)


Are there terminal emulators that support bi-directional text?

I tried searching for this but came out empty-handed. Is it possible for me to get my terminal emulator to display right-to-left Unicode grapheme clusters properly? Use case: I'm writing a script that outputs Arabic letters to the terminal and it's currently outputting the glyphs in reverse order, which messes up the way they're supposed to connect, making them visually difficult to read.


Create a new link to access all files and folders

I get stuck to create a shell script for a new link something like that               link linkPathName orginalPathName      I want to create a link between a new link and original path; however, both can access together. For example, if orignialPathName was a directory, it also creates a link to access all files and folders for a new link


Select between given characters in vim

Given three sample lines:               some('lorem _ ipsum');     $some['lorem _ ipsum'];     <span class="some _ class">      (cursor is in `_` position) Which is the fastest way to select (for pasting in other place):   * text between `'` quotes   * expand the selection to include the parenthesis   * text between parenthesis   * text between `<` and `>`


How to build a new OS on top of a Linux OS

I'd like to build my own operating system (really just the Ubuntu distro as I know the task is difficult) But what I mean by this is I wish to build atop of the Ubuntu operating system as like Apple has done with OS X building it atop of UNIX. I would like to do the same thing with a distribution of Ubuntu Linux except my business would be in control of everything, instead of Canonical Ltd. This question is different from just an Ubuntu Live CD because I don't want to create an almost entirely different OS then Ubuntu. In fact that is why I say that "I'd like to build my own operating system".


Linux shell - unexpected error

I'm new to the linux & command world. I have two directories, one called `pasta` (which contains 3 files) and another one called `pasta2` (with nothing inside). I'm trying to move all 3 files from `pasta` to `pasta2` with the command find. But i get the error bellow. Any suggestion? Command:               find pasta -type f -exec mv pasta2 {} \;      and i get this output:               mv: cannot overwrite non-directory `pasta/tmp3' with directory `pasta2'     mv: cannot overwrite non-directory `pasta/tmp1' with directory `pasta2'     mv: cannot overwrite non-directory `pasta/tmp2' with directory `pasta2'


Pipe assigns variable

For simplicity I would like to do ` echo cart | assign spo; echo $spo ` Output: cart Does such an appliance exist such as assign? I am aware of all the ways to do this using substitution.


Remove duplicates values within a field

How to remove duplicate (or more) values within a selected field in a file, keeping only one copy? Exemple Input file:               A    1,2,3,45,1,8,2,3     B    5,6,6,6,6,6,2,3,7      Expected output:               A    1,2,3,45,8     B    5,6,2,3,7


Problems connecting to IRC server from VPS

So I'm running a CentOS 6 VPS that I've got irssi installed on. I'd like to run irssi as a permanent connection to an IRC server so I can log in from anywhere and not lose my conversations. Irssi installed fine, and everything looks fine as far as I can tell (no expert). But when I try connecting to the IRC server, it just fails to get a connection every time. There's no firewall blocking as far as I know, and I've tried using iptables to open up the port without success. Any ideas on how I can sort this?


I'm trying to install my public key manually w/ scp

I'm following a tutorial and it's going along well. I used ssh to connect fine. Then I created a private and public key. Which leads me to my first question it says that the keys have been saved to > Your identification has been saved in /home/localuser/.ssh/id_dsa. > > Your public key has been saved in /home/localuser/.ssh/id_dsa.pub. But when I look in that folder I don't see the _.ssh_ folder. Is this done for security reasons and it's supposed to be hidden? Next the tutorial instructs to manually copy the public key to the remote machine using this command: > scp ~/.ssh/id_dsa.pub username@mywebpage.com:.ssh/authorized_keys When I run that command I get this response. > ssh: connect to host mywebpage.com port 22: Connection refused lost > connection So, like I do when I first connected by ssh, I add _-p 2222_ at the end of _scp_ command. I then get this response: > 2222: No such file or directory I've also tried uppercase _-P 2222_ What am I doing wrong? PS I'm using Linux Mint 15 and Cinnamon **EDIT** OK. Adding `-p 2222` right after `ssh` worked. However I've ran into another issue. It then transferred the file. However I had to create the directory myself before it would transfer. Now it's supposed to ask my for my passphrase instead of my password. It didn't do this so then the tutorial said to run these commands. `chmod 700 ~/.ssh` & `chmod 600 ~/.ssh/authorized_keys`. But when I login it still asks for my password and not my passphrase. Why is it not working? **EDIT: I ran`ssh` with `-v` these are the mentions of `public key`:**               debug1: Authentications that can continue: publickey,password,keyboard-interactive     debug1: Next authentication method: publickey     debug1: Offering DSA public key: /home/localusername/.ssh/id_dsa     debug1: Authentications that can continue: publickey,password,keyboard-interactive     debug1: Trying private key: /home/localusername/.ssh/id_rsa     debug1: Trying private key: /home/localusername/.ssh/id_ecdsa     debug1: Next authentication method: keyboard-interactive      I'll note this is prior to logging in.


Unable to delete files to trash in a binded filesystem

I'm trying to set up shared home directory for two Linux installations and thus I'm using bind-mounts. My user is named `dbz` and his home directory is `/home/dbz`. I also have shared directory `/home/shared` where I store my shared files (this folder is also owned by user `dbz`). I mount another directories from this shared directory into my home directory using binding:               mount -B /home/shared/work /home/dbz/work      This solution solves my needs and the only issue I have and don't know how to resolve is - when I'm trying to delete a file or directory from mounted directory I cannot delete it to trash, only permanent deletion is possible. For example:   * deleting file `/home/shared/work/test.txt`: OK, because deleting right from the directory where the file `test.txt` resides;     * deleting file `/home/dbz/work/test.txt`: CAN'T, because... by the way, because what? do bind-mounts have some restrictions on file deletion? Finally an issue submitted to bugzilla.kernel.org


paste command: setting (multiple) delimiters

In Linux, I have the following problem with `paste` from (GNU coreutils) 8.13: Trying to set another delimiter than the default (TAB) results in either just printing the first character of the defined delimiter or perfectly ignoring it. **Question** : _How does one define (multiple) delimiters when using_ `paste`? Simply using, e.g. _abc-123_ as delimiter would be nice. With "multiple" I mean e.g. 2 TABS instead of one. * * * The patterns enclosing the delimiter(s) I've tried so far were   * `\--delimiters="\delimiter"`   * `\--delimiters='\delimiter'`   * `\--delimiters=$"\delimiter"`   * `\--delimiters=$'\delimiter'` All with the same result: Only the first character is accepted or perfectly ignored. I've also tried the short version `-d"\"` and multiple instances &ndahs; nothing. Also:   * `\--delimiters="\\\"` -> Error message What works perfectly, though not what I want:   * `\--delimiters="\n"` -> newline   * `\--delimiters="\0"` -> nothing inbetween   * `\--delimiters="\t"`-> `TAB`, the default. Great.


ssh ubuntu to android : No route to host

I am trying to log into my android phone (running sshdroid), using my laptop (ubuntu 12.04). I am on a university sub-network (on wifi), and so is my phone. I tried the following command:               ssh root@my_phone_ip -p 2222      But the laptop fires back a               ssh: connect to host 172.20.27.169 port 2222: No route to host      I cannot even ping to my phone, it gives a destination host unreachable error. I looked for the route information on my laptop which is               root@abadmin-Vostro-3500:~# route     Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface          default         eduspot-berlioz 0.0.0.0         UG    0      0        0 wlan0          link-local      *               255.255.0.0     U     1000   0        0 wlan0          172.16.185.0    *               255.255.255.0   U     0      0        0 vmnet1          172.20.0.0      *               255.255.0.0     U     2      0        0 wlan0          192.168.248.0   *               255.255.255.0   U     0      0        0 vmnet8      To check what packets were going through I have tried a tcpdump -i wlan0, but I could not find any interesting packets. I'm inserting the dump here for further info.               root@abadmin-Vostro-3500:~# tcpdump -i wlan0      tcpdump: verbose output suppressed, use -v or -vv for full protocol decode     listening on wlan0, link-type EN10MB (Ethernet), capture size 65535 bytes     19:45:12.354445 IP6 fe80::1416:f700:ff98:a65 > ff02::1:ff3a:6694: ICMP6, neighbor solicitation, who has fe80::51e2:6e29:ff3a:6694, length 32     19:45:12.355303 IP abadmin-Vostro-3500.local.54924 > eduspot-berlioz.crous- grenoble.fr.domain: 44239+ PTR?       4.9.6.6.a.3.f.f.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.f.f.ip6.arpa. (90)     19:45:12.364296 IP eduspot-berlioz.crous-grenoble.fr.domain > abadmin-Vostro-3500.local.54924: 44239 NXDomain 0/0/0 (90)     19:45:12.364742 IP abadmin-Vostro-3500.local.53789 > eduspot-berlioz.crous-grenoble.fr.domain: 29641+ PTR? 5.6.a.0.8.9.f.f.0.0.7.f.6.1.4.1.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa. (90)     19:45:12.368422 IP eduspot-berlioz.crous-grenoble.fr.domain > abadmin-Vostro-3500.local.53789: 29641 NXDomain 0/0/0 (90)     19:45:12.368740 IP abadmin-Vostro-3500.local.2590 > eduspot-berlioz.crous-grenoble.fr.domain: 39336+ PTR? 4.9.6.6.a.3.f.f.9.2.e.6.2.e.1.5.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa. (90)     19:45:12.373988 IP eduspot-berlioz.crous-grenoble.fr.domain > abadmin-Vostro-3500.local.2590: 39336 NXDomain 0/0/0 (90)     19:45:12.374372 IP abadmin-Vostro-3500.local.5879 > eduspot-berlioz.crous-grenoble.fr.domain: 3348+ PTR? 254.255.20.172.in-addr.arpa. (45)     19:45:12.389099 IP eduspot-berlioz.crous-grenoble.fr.domain > abadmin-Vostro-3500.local.5879: 3348* 1/0/0 PTR eduspot-berlioz.crous-grenoble.fr. (92)     19:45:12.389455 IP abadmin-Vostro-3500.local.30761 > eduspot-berlioz.crous-grenoble.fr.domain: 14063+ PTR? 186.27.20.172.in-addr.arpa. (44)     19:45:12.393315 IP eduspot-berlioz.crous-grenoble.fr.domain > abadmin-Vostro-3500.local.30761: 14063 NXDomain 0/0/0 (44)     ^C  19:45:12.411446 IP 172.20.18.214.netbios-ns > 172.20.255.255.netbios-ns: NBT UDP   PACKET(137): QUERY; REQUEST; BROADCAST          12 packets captured     525 packets received by filter     483 packets dropped by kernel      iptables output:               Chain INPUT (policy ACCEPT) target prot opt source destination      ACCEPT 47 -- 0.0.0.0/0 0.0.0.0/0      Chain FORWARD (policy ACCEPT) target prot opt source destination      Chain OUTPUT (policy ACCEPT) target prot opt source destination'       Please help me log into my phone.. its been frustrating me for 2 days now. Thanks ahead of time


netstat command doesnt work anymore on the new dedicated server

I was using the following command on my previous dedicated server with the same version of the FreeBSD installation:               # uname -a     FreeBSD 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Thu Sep 26 22:50:31 UTC 2013     root@bake.isc.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64      The command is following:               netstat -ntu -f inet      Output:               netstat: illegal option -- t      Why doesn't it work anymore? I dont have an access to my previous dedicated server so I can't use the `man` to check the differences...


Is there some way I can start a (repeating) ping while the network is unreachable?

My ping command (on Debian 6 or 7) will repeatedly attempt to ping a server even while the network is down, **if** the network was up when it was started. Is there some way to start ping while the network is down and get this same behavior? Here's an example. If I start a repeating ping while the network is up, and while the ping is running, the network goes down, the ping continues to repeat. If the network comes back up, it will continue pinging:               me@here:~$ ping -n 8.8.8.8     PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.     64 bytes from 8.8.8.8: icmp_req=1 ttl=46 time=117 ms     ...     64 bytes from 8.8.8.8: icmp_req=6 ttl=46 time=116 ms     ping: sendmsg: Network is unreachable     ...     ping: sendmsg: Network is unreachable     64 bytes from 8.8.8.8: icmp_req=108 ttl=46 time=694 ms     ...      However, if the network is down when I run ping:               me@here:~$ ping -n 8.8.8.8     connect: Network is unreachable     me@here:~$      This is the same unreachable network problem, but ping doesn't keep trying until the network is up again, like it had before.


Burn fedora to DVD, but hash is incorrect

I downloaded Fedora-20-x86_64-DVD.iso from mirro site, and I checked the Sha256 with HashMyFiles, they are the same. But when I burned it to DVD, and checked the hash of DVD with Hash Codes, they are DIFFERENT! (I burned 3 DVDs, they are the same different from website) Next I booted this DVD, test this media, and it PASSED! ### Questions   * Is that OK? The hash of this DVD is incorrect, but it can pass the test.   * What if I install with this DVD?    * Will it make problems with my computer?


No syntax highlighting when editing crontab

I am trying to figure out why I don't have syntax highlighting when editing my crontab. I have both `$EDITOR` and `$VISUAL` set to `/usr/bin/vim`:               > echo $EDITOR     /usr/bin/vim     > echo $VISUAL     /usr/bin/vim      If I save the crontab to a file and edit it with vim syntax highlighting is enabled.               > crontab -l > saved_cronab     > /usr/bin/vim saved_crontab      And if I use `:syntax on` while editing the crotab nothing changes How can I enable highlighting when editing crontab with `crontab -e`?


Need help to combine 3 split lines of bash script into one single line

The following is what I found after googling:               dpkg --list 'linux-image-*' \         | perl -ane 'BEGIN { $r = `uname -r` or die; chomp $r } print $F[1], "\n" if $F[0] eq "ii" && $F[1] !~ /\Q$r\E\b/' \         | xargs -r aptitude purge -y      Could someone combine the above 3 lines into one? I find it easier to copy and paste a single line into a sudo command than three lines, one at a time. Thanks in advance for your help. _For Hauke Laging_ : I have edited this original post to include the error message when I tried to copy the three split lines at once following the sudo command:               username@hostname:~$ sudo -i     [sudo] password for username:      root@hostname:~# dpkg --list 'linux-image-*' \     >      Desired=Unknown/Install/Remove/Purge/Hold     | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend     |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)     ||/ Name           Version      Architecture Description     +++-==============-============-============-=================================     un  linux-image-2. <none>                    (no description available)     un  linux-image-2. <none>                    (no description available)     un  linux-image-2. <none>                    (no description available)     un  linux-image-2. <none>                    (no description available)     ii  linux-image-3. 3.14.4-1~bpo amd64        Linux 3.14 for 64-bit PCs     ii  linux-image-3. 3.2.57-3+deb amd64        Linux 3.2 for 64-bit PCs     ii  linux-image-am 3.14+57~bpo7 amd64        Linux for 64-bit PCs (meta-packag     root@hostname:~#     | perl -ane 'BEGIN { $r = `uname -r` or die; chomp $r } print $F[1], "\n" if $F[0] eq "ii" && $F[1] !~ /\Q$r\E\b/' \     -bash: syntax error near unexpected token `|'     root@hostname:~#      root@hostname:~#     | xargs -r aptitude purge -y