PBS equivalent of 'top' command: avoid running 'qstat' repeatedly

When I run several jobs on a head node, I like to monitor the progress using the command `top`. However, when I'm using PBS to run several jobs on a cluster, `top` will of course not show these jobs, and I have resorted to using 'qstat'. However the `qstat` command needs to be run repeatedly in order to continue monitoring the jobs. `top` updates in real-time, which means I can have the terminal window open on the side and glance at it occasionally while doing other work. Is there a way to monitor in real-time (as the `top` command would do) the jobs on a cluster that I've submitted using the PBS command `qsub`? I was surprised to see so little, after extensive searching on Google.


Are there distros with ptrace_scope set to zero by default?

I wanted to use `ptrace` on a recent version of Ubuntu to inspect the memory of any other process running under the same OS user. However, I quickly stumbled upon > Operation not permitted After a quick web search I found that: > In Ubuntu 10.10 and later, users cannot ptrace processes that are not a > descendant of the debugger. The behavior is controllable through the > /proc/sys/kernel/yama/ptrace_scope sysctl, available via Yama. I know that I can set this value to 0 and then do what I want. However, I was wondering if there exist any Linux distros which have `ptrace_scope` set to zero by default?


What's the difference between `/usr/share/emacs/site-lisp/` directory and `/usr/share/emacs23/site-lisp/` directory?

I use Emacs 23 on my system. I received a file from a colleague (who has a different Linux distro) to add to the `/usr/share/emacs/site-lisp/` directory. As I worked to do this, I noticed another, similarly-named, directory: `/usr/share/emacs23/site-lisp/`. When viewing their contents, I notice that they are not identical. Is this common with all Emacs configurations on all distros? Are there distinct purposes for when I should add into one over the other? Which one? How do I know? In short, what is the difference between these 2 directories?


How to change  the interpret of a variable in `zsh`?

I set a variable `TEMPP='-I ../dir1 -I ../dir2'` then I run `gcc -M $TEMPP somefile.c` It seems not to include `../dir1` and `../dir2` in the search list of the include file, and if there is a space at the beginning of the variable, like `TEMPP=' -I ../dir1 -I ../dir2'` it reports an error: `gcc: -I ../common1 -I ../encrypt: No such file or directory` so it seems the variable was treated as a file. Maybe it will let me separate the directory to avoid this promblem, but those included `dirs` are generated by another command, and the amount is not constant. So how can I let a variable in a command be treated as literal seem like a manual input in command line, not an integral string or a file name? OK...I find this situation only happened in the `zsh`, but in bash it works well... may be in `zsh` the expansion of variable is special. So if anyone can tell me how can this work well in zsh I will appreciate, or I can only do this in bash.


Why does the column command not align columns properly?

In another question I asked on how to hide all .pyc files when using ls, Ignacio suggested the following: ![ls | grep -v '.pyc$' | column](http://i.stack.imgur.com/JuNAV.png) This, as I mentioned above, doesn't work precisely, since the output is occasionally misaligned:               ceasarbautista@hse140:~/Desktop/Statistics/statistics/markov$ ls     README          __init__.pyc        markov.py       matrix2graph.pyc    pathfinder.pyc      priority_dict.pyc   spanning.py     __init__.py     graph.py        matrix2graph.py     pathfinder.py       priority_dict.py    space.py        vector.py     ceasarbautista@hse140:~/Desktop/Statistics/statistics/markov$ ls | grep -v '\.pyc$' | column     README      graph.py        matrix2graph.py priority_dict.py    spanning.py     __init__.py markov.py   pathfinder.py   space.py        vector.py      While I got a satisfactory answer, I'm curious: why does column do this (and can it be fixed to print correctly)?


How can I get recentf-mode to work with emacs server/client?

I like using `recentf` mode in Emacs which produces a list of files I have recently opened. This list is persistent between sessions, so I can get to files I used a fairly long time ago. However, I recently started using Emacsclient to connect to an Emacs server which is automatically turned on when I log it. Overall, this was a big improvement. However, `recentf` mode started missing _most_ of the files I opened whenever I restarted my computer. It remembers _some_ of them, and I cannot see a pattern in which files get recorded. How can I fix this behavior? How can I get it to record _all_ the files I visit and remember them between sessions?


How can I convert tab delimited data to comma delimited data?

I'm requesting a list of ec2 snapshots via amazon's ec2 command line tool:               ec2-describe-snapshots -H --hide-tags > snapshots.csv      The data looks something like this:               SnapshotId      VolumeId        StartTime   OwnerId         VolumeSize  Description     snap-00b66464   vol-b99a38d0    2012-01-05  5098939         160         my backup      How can I intercept the data before redirecting it to `snapshots.csv` and do the following things:   * replace "tabs" with commas   * encapsulate values with quotations   * if a value is all numbers, prefix it with an `=` so that excel will treat it as text - for example `OwnerId` should be `"=5098939`" (this one is not necessary if it cannot be done inline and would instead require a script file or function) desired output:               "SnapshotId","VolumeId","StartTime","OwnerId","VolumeSize","Description"     "snap-00b66464","vol-b99a38d0","2012-01-05","=5098939","=160","my backup"


Confusion about linking boost library while compilation

For a client I needed to add boost 1.54 to the system. So I downloaded the latest version (1.55) and built it within a special directory: /usr/local/lib/boost1.55/. This works. Then I had to adapt the Makefile in this way. > LIBS = $(SUBLIBS) -L/usr/lib/x86_64-linux-gnu -LC:/deps/miniupnpc > -lminiupnpc -lqrencode -lrt -LC:/deps/boost/stage/lib > -Lc:/deps/db/build_unix -Lc:/deps/ssl -LC:/deps/libqrencode/.libs -lssl > -lcrypto -ldb_cxx -L/usr/local/lib/boost1.55/boost_system-mgw46-mt-sd-1_54 > -L/usr/local/lib/boost1.55/boost_filesystem-mgw46-mt-sd-1_54 > -L/usr/local/lib/boost1.55/boost_program_options-mgw46-mt-sd-1_54 > -L/usr/local/lib/boost1.55/boost_thread-mgw46-mt-sd-1_54 -lQtDBus -lQtGui > -lQtCore -lpthread -lboost_system -lboost_filesystem -lboost_program_options > -lboost_thread In the unmodified Makefile, the boost linkings looked like this: > -lboost_thread-mgw46-mt-sd-1_54 But this didn't work. I wasn't able to compile it because it was not found. So I added (as you can see above) > -L/usr/local/lib/boost1.55/boost_thread-mgw46-mt-sd-1_54 and > -lboost_thread Otherwise it wouldn't compile either. After successful compilation, I executed ldd on the binary and it shows me: > libboost_system.so.1.53.0 => /usr/lib/x86_64-linux- > gnu/libboost_system.so.1.53.0 (0x00007f416c169000) > libboost_filesystem.so.1.53.0 => /usr/lib/x86_64-linux- > gnu/libboost_filesystem.so.1.53.0 (0x00007f416bf52000) > libboost_program_options.so.1.53.0 => /usr/lib/x86_64-linux- > gnu/libboost_program_options.so.1.53.0 (0x00007f416bce4000) > libboost_thread.so.1.53.0 => /usr/lib/x86_64-linux- > gnu/libboost_thread.so.1.53.0 (0x00007f416bace000) 1.53 is the version installed by package manager. I don't understand why it links to this version. If I wouldn't have installed 1.55, it would not compiled, but now it doesn't link to this version. Any explanation for that? Actually my target is to not use dynamic linked libraries and I didn't figured out yet how to do that, but I still want to know why the above doesn't work as expected.


Ubuntu: /proc/pid/comm file missing

On my development box, under `/proc/[pid]/` there is a file called `comm` containing the name of the executable for that process. I use this to validate the process to which I am sending a signal. On our live server it does not exist. Both machines are running Ubuntu 12.04.3 LTS (albeit the live server is virtualised). On the live machine the executable exists in `cmdline` but of course with command line arguments which have to be parsed out. Why does one instance have `comm` and not the other?


xargs with stdin/stdout redirection

I would like to run:               ./a.out < x.dat > x.ans      for each * _.dat_ file in the directory _A_. Sure, it could be done by bash/python/whatsoever script, but I like to write sexy one-liner. All I could reach is (still without any stdout):               ls A/*.dat | xargs -I file -a file ./a.out      But _-a_ in xargs doesn't understand replace-str 'file'. Thank you for help.


Can't login into webmin on a VPS

I bought a VPS server, and I have installed webmin on it.   When I want to login to webmin via:                http://88.198.196.118:10000/      it will redirect me to:                https://static.88-198-196-118.clients.your-server.de:10000/      I tried to login with my SSH username and password (which I use to connect my server with SSH using putty) but I can't do it. How can I log in to webmin?


Endlessly stuck in SSH login loop?

I've got a weird issue. Every time I hit `Ctrl`+`D` or use `logout` or `exit`, I see               Connection to remote.host.com closed      and then I am immediately logged back in:               Last login: Thu Oct 6 21:04:20 2011 from xyz     user@remote.host.com ~ $       Why is this happening and how can I make it stop?


rpmbuild: How can I 'Require' one package *or* another

So, I'm trying to fix a spec file right now for rpmbuild. On Suse, it looks like the X11 library development package is named "xorg-x11-libX11-devel" while on CentOS it seems to be named "libX11-devel". In an ideal universe, I could just use some magical binary operator to require one or the other. Something like:               BuildRequires:  xorg-x11-libX11-devel || libX11-devel      Does something like that exist, or do I need to script some sort of zainy thing to get this to work?


How can I prevent ffmpeg intermmittent faulure with `AVC: nal size` error?

I am trying to open the NASA HDTV video stream from ustream.tv directly in `vlc`. The problem that I have is that it only works sometimes. The command I am using is below:               ffmpeg -i "rtmp://ustreamlivefs.fplive.net/ustream2live-live/stream_live_1_1_6540154 swfUrl=http://www.ustream.tv/flash/viewer.swf live=1" -c copy -bsf h264_mp4toannexb -y -f mpegts pipe: | vlc -      When this works, it works very well and for as long as I leave the stream running. Frequently, however, it results in failure at start-up and gives output like this:               [h264 @ 0x2273760] AVC: nal size 21135391     [h264 @ 0x2273760] no frame!     Failed to open bitstream filter h264_mp4toannexb for stream 0 with codec copy: Invalid argument     [mpegts @ 0x227b360] H.264 bitstream malformed, no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_mp4toannexb)     av_interleaved_write_frame(): Invalid argument     [0x7fb5140014e8] main stream error: cannot pre fill buffer      A bit of background on the command: the ultimate target is not `vlc` but distribution via DLNA for viewing on a TV - hence the need to convert to the `mpegts` container format. The DLNA transfer is being effected with `mediatomb`. This configuration suffers the same intermittent failure problem as the above example. I am using ffmpeg version 1.1.3 on Arch Linux 64-bit. I have tried searching for answers to this but I have been unable to find anything useful - everything I've seen is similar but different. Can I modify the command to make it more reliable and, if so, how?


Can I choose which of my dual screens a youtube video will maximize to?

Watching a youtube video, I click on "maximize to full screen" (the flash button). It maximizes to the wrong screen. How can I choose which screen will display the vid?


Disk usage summary per user

Is there a way to get the disk usage per user under a given path? `du` doesn't seem to have an option to aggregate disk usage per user, and `df` only seems to report how much disk is left on the drive. Can this be done with one command or in a few lines on the shell? Any pointers would be greatly appreciated. In case it helps, I use `zsh`. **Note:** Quotas are not enabled on our filesystem.


Let pam module use hostname -s

Our `hostname` command gives back the servername.domain.   This is in conflict with our authentication mechanism with our Active Directory.   Is it possible to let the pam module use `hostname -s` (the short name?)


Hardware Ethernet IP Limitation

In Linux Environment How many number of IP address I can assign to a Hardware ethernet interface ? Is there any limitation ? what is the maximum no. of virtual ethernet interface I can assign to a hardware ethernet interface ?


Search and replace full line in recursive files

I'm using:               grep -n -H -o -R -e textword .      List all file recursively under directory '.' with string 'textword' and show the file, line and only portion matching. I need to remove lines that matched the text using a Linux command.


Script to recursively check permissions and owners of a directory and write shell script to recreate them

I'm trying to write a shell script to preserve and rewrite all permissions/groups in a large directory with several subdirectories in the event they get changed or are not properly created or if mirroring the users/permissions for this directory on a different machine. **Something like:**               chown adam:brown /var/blarg     chmod 770 /var/blarg     chown adam:brown /var/blarg/toast.file     chmod 777 /var/blarg/toast.file          ...etc      Doing this by hand will take a long time. I was wondering is there an existing command/script to accomplish this task?


Imagemagick used to generate PPM's in Linux, PPM's are unreadable

I need to generate PPM's as raw data sources for one program. I have a bunch of png's as Input, which I'm going to convert ppm's. When I try a tool like `mogrify` it generates files, but these are unreadable to any image viewer programs such as GIMP:               mogrify -format ppm *.png      I have installed `netpbm` package. I tried to open some other random PPM's from other places, any image viewer can open and read those files, the problem exists with my own generated files. The files created with `mogrify` seem to have the right size for their resolution and contains bits. In hex file viewer working file header looks like: > P6 640 480 25 Mine generated with Imagemagick: > P7 WIDTH 640 HEIGHT 480 DEPTH 3 MAXVAL 255 TUPLTYPE RGB ENDHD Probably I need to give Imagemagick some other parameters to make correct file format, but what? Or is there another tool which can easily convert png's to ppm's?


pm-utils: No network in suspend scripts?

I'd like to put a script in `/etc/pm/suspend.d/` that needs network access (for a very short time) before allowing the system to suspend. However, even with scripts named "001_something" in `/etc/pm/suspend.d/` and `/usr/lib/pm- utils/sleep.d/` I do not get any network access. It seems this is disabled before the scripts are run. Why is networking disabled? How can I enable it? Also, I am unable to make use of the pm-suspend.log in `/var/log`. It seems the file for the suspend part is overwritten as soon as the system is resumed? The following has been observed in `daemon.log`:               Feb 7 22:09:04 zenbook NetworkManager[3606]: <info> sleep requested (sleeping: no enabled: yes)·     Feb 7 22:09:04 zenbook NetworkManager[3606]: <info> sleeping or disabling...·     Feb 7 22:09:04 zenbook NetworkManager[3606]: <info> (wlan0): now unmanaged·     Feb 7 22:09:04 zenbook NetworkManager[3606]: <info> (wlan0): device state change: activated -> unmanaged (reason 'sleeping') [100 10 37]·     Feb 7 22:09:04 zenbook NetworkManager[3606]: <info> (wlan0): deactivating device (reason 'sleeping') [37]·      I am using Debian Testing with Gnome 3. EDIT: The problem is not related to pm-utils. As far as I know, NetworkManager disables the network (in nm-manager.c:do_sleep_wake). I don't know how to solve this, yet. See NetworkManager: disabled network when sending system to sleep


Confusing use of && and || operators

I was skimming through an `/etc/rc.d/init.d/sendmail` file (I know this is hardly ever used, but I'm studying for an exam), and I've become a bit confused about the `&&` and the `||` operators. I've read where they can be used in statements such as:               if [ test1 ] && [ test2 ]; then          echo "both tests are true"     elif [ test1 ] || [ test2 ]; then          echo "one test is true"     fi      However, this script shows single line statements such as:               [ -z "$SMQUEUE" ] && SMQUEUE="QUEUE"     [ -f /usr/sbin/sendmail ] || exit 0      These seem to be using the `&&` and `||` operators to elicit responses based on tests, but I haven't been able to dig up documenation regarding this particular use of these operators. Can anyone explain what these do in this particular context?


How to listen to all ports (UDP and TCP) or make them all appear open in Debian

I got an external Debian server. The problem is that my university campus doesn't allow connections to go outside when the port is different than TCP port 22, 80, 443, or UDP port 123. I tested them manually. On my Debian server I would like to listen to all my UDP and TCP ports so I can clearly figure out which TCP and UDP ports my university let through their firewall. Nmap is wonderful on the client side to test that, but what should I do on the server side?


How to find a file in the filesystem from the command line?

I'm fairly new to Linux, and I've now found myself in a situation where I'd like to find where a file (with a partially-known filename) is in the file system. I'd like to know how to do this from the command line, rather than using a GUI utility. In Windows, I'd run the following:               cd /d C:\     dir *filename* /s      What's the Linux equivalent?


Is there a tool to get the lines in one file that are not in another?

Is there any tool that can get lines which file A contains, but file B doesn't? I could make a little simple script with, e.g, perl, but if something like that already exists, I'll save my time from now on.


How to ensure users can’t login to the system except with FTP?

How can I ensure that users can't login to the system except with FTP?


How to distinguish input from different keyboards?

I want to write an application in Python that you can use with your default keyboard and a specially designed one for the application. I will design it simply by using a small numerical keyboard with stickers to give actions to the different keys. Both keyboards will be attached by USB. However, when these keys are pressed, just their regular signals (numbers, operators and enters), will be send to Python and it will not be able to distinguish between the signals from the main keyboard and the special keyboard. Because Python has (as far as I could find) no method for making this distinguishment, I want to do it on the OS itself. I will be programming it for the Raspberry Pi, so it will be Linux. So, the main question: How can I remap the keys of a specific keyboard to other keycodes. I thought about using the F-keys which I won't use for other purposes; or just some characters that are not present on any keyboard (supposing that there are such). Is this possible in Linux/Unix? And if so, how can I do it?


How do I find out a server's drive mappings for raw devices?

I don't have a lot of knowledge on Linux so pleas forgive me if this is a simple question. I manage a server with Oracle RAC 11g running on Redhat 5.2. There are a number of raw drives on the server but I cannot see how they are being mapped. I have had a look at the fstab and even the udev (raw rules configuration, even thought its depreciated). But I cannot see where the various mappings from the partitions presented `/dev/sd[xy][123]` would map to the various `/dev/raw/raw[12345]` etc. So is there any way I can work out which partitions are assigned to the mappings and the size of the partitions?


Interpreting tiobench results

I'm running `tiobench` on my raid1 and it gives me the following results.   1. Why is there `#####` shown instead of throughput?   2. Why does seq.reading with 8 threads use 2836% CPU? My results:               $tiobench     No size specified, using 2000 MB     Run #1: /usr/bin/tiotest -t 8 -f 250 -r 500 -b 4096 -d . -TTT          Unit information     ================     File size = megabytes     Blk Size  = bytes     Rate      = megabytes per second     CPU%      = percentage of CPU used during the test     Latency   = milliseconds     Lat%      = percent of requests that took longer than X seconds     CPU Eff   = Rate divided by CPU% - throughput per cpu load          Sequential Reads                                   File  Blk   Num                   Avg      Maximum      Lat%     Lat%    CPU     Identifier                    Size  Size  Thr   Rate  (CPU%)  Latency    Latency      >2s      >10s    Eff     ---------------------------- ------ ----- ---  ------ ------ --------- -----------  -------- -------- -----     2.6.32-37-server              2000  4096    1  ###### 93.62%     0.001        0.02   0.00000  0.00000  6897     2.6.32-37-server              2000  4096    2  ###### 384.4%     0.001        0.03   0.00000  0.00000  2778     2.6.32-37-server              2000  4096    4  ###### 1552.%     0.001        0.07   0.00000  0.00000   980     2.6.32-37-server              2000  4096    8  ###### 2836.%     0.002       10.15   0.00000  0.00000   533          Random Reads                                   File  Blk   Num                   Avg      Maximum      Lat%     Lat%    CPU     Identifier                    Size  Size  Thr   Rate  (CPU%)  Latency    Latency      >2s      >10s    Eff     ---------------------------- ------ ----- ---  ------ ------ --------- -----------  -------- -------- -----     2.6.32-37-server              2000  4096    1  ######     0%     0.001        0.01   0.00000  0.00000     0     2.6.32-37-server              2000  4096    2  ######     0%     0.001        0.00   0.00000  0.00000     0     2.6.32-37-server              2000  4096    4  ######     0%     0.001        0.00   0.00000  0.00000     0     2.6.32-37-server              2000  4096    8  ######     0%     0.001        0.00   0.00000  0.00000     0          Sequential Writes                                   File  Blk   Num                   Avg      Maximum      Lat%     Lat%    CPU     Identifier                    Size  Size  Thr   Rate  (CPU%)  Latency    Latency      >2s      >10s    Eff     ---------------------------- ------ ----- ---  ------ ------ --------- -----------  -------- -------- -----     2.6.32-37-server              2000  4096    1   87.39 6.816%     0.030     2509.77   0.00059  0.00000  1282     2.6.32-37-server              2000  4096    2   89.32 17.86%     0.057     2478.84   0.00039  0.00000   500     2.6.32-37-server              2000  4096    4   86.98 36.70%     0.113     2353.49   0.00020  0.00000   237     2.6.32-37-server              2000  4096    8   86.46 82.35%     0.214     6847.69   0.00078  0.00000   105          Random Writes                                   File  Blk   Num                   Avg      Maximum      Lat%     Lat%    CPU     Identifier                    Size  Size  Thr   Rate  (CPU%)  Latency    Latency      >2s      >10s    Eff     ---------------------------- ------ ----- ---  ------ ------ --------- -----------  -------- -------- -----     2.6.32-37-server              2000  4096    1    1.75 0.335%     0.001        0.02   0.00000  0.00000   521     2.6.32-37-server              2000  4096    2    1.73 0.221%     0.002        0.03   0.00000  0.00000   781     2.6.32-37-server              2000  4096    4    1.71 0.877%     0.002        0.02   0.00000  0.00000   195     2.6.32-37-server              2000  4096    8    1.74 2.671%     0.002        0.03   0.00000  0.00000    65


Find files with certain extensions

How can I use `find` to find all files that have a `.xls` or `.csv` extension? I have seen a `-regex` option but I don't know how to use it.


How do i know the process ID of the parent process?

I have a script with loop like               while read host     do     ./script &     done      I want to know the process id of the current process which is starting the ./script in background and use it in script.


Using Radeon on muxless system with multiple X servers

I'm using HP ProBook 4740s laptop with muxless hybrid graphics:               root@mekras: lspci | grep VGA     00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)     01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Thames [Radeon HD 7550M/7570M/7650M]      With this article I can successfully use Radeon in desired apps. But only on the first started X server (i. e. under first user logged in). For this server I have providers:               mekras@mekras: xrandr --listproviders     Providers: number : 2     Provider 0: id: 0x7f cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 4 outputs: 5 associated providers: 0 name:Intel     Provider 1: id: 0x56 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 6 outputs: 1 associated providers: 0 name:radeon      But for all additional X servers (additional logins) I have other list of               gamer@mekras: xrandr --listproviders     Providers: number : 2     Provider 0: id: 0x48 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 4 outputs: 5 associated providers: 1 name:Intel                                  Provider 1: id: 0xcf cap: 0x2, Sink Output crtcs: 6 outputs: 1 associated providers: 1 name:modesetting      So Radeon is not available as a render offload device. My question is: how can I use Radeon on additional X servers? **Update:** xorg.1.log contains messages: "setversion 1.4 failed" and after that "fglrx" module not loaded. Here someone writes that "«setversion 1.4 failed» means that something was still holding on to the DRM device so X couldn't take it;" Is that means that two X servers can not use same DRM device?


Coloring the output of conky-cli in dwm

I've recently installed `conky-cli` and got it running on the upper bar in `dwm` with this simple command:               conky | while read -r; do xsetroot -name "$REPLY"; done &      And I wanted to get colored output with conky, thought this could be done with `sed` like:               conky | sed .. | while ..      But don't know how to get the output from the pipe with sed and convert it to a color.


How extreme-coupling in UNIX-like OSs can be acceptable?

As we know a very basic software engineering principal is loose coupling. But we know that programs in UNIX-like OSs are extremely coupled. How this can be explained/justified? I mean from extremely coupled, a lot of dependencies between programs, even when you want install a simple application you have to consider a lot of dependencies (as you see in app manager), some time even you are unable to update a program because it will break some dependent programs. Indeed stand- alone softwares are rare in beauty world of Linux (in compare with other OSs).


Booting linux from SD Card on a Leopard board (Ti DM365)

I have a Leopard board with Ti DM365 processor. Problem is that I tried to flash the bootloader (uboot) to nand and landed up corrupting the NAND. Now I can't use the NAND to bring up the board. So I decided to use the SD Card. I did the required partitioning on the SD Card for bootloader, kernel and rootfs. Now, when I restart the board, it says > uncompressing the kernel... etc., but when it tries to look for the rootfs the prompt says > can't find NAND I think (I'm a complete newbie in this field) that the kernel looks into the NAND for the "rootfs" instead of the SD Card, and that's why it is giving that sort of error. So now I have to configure the kernel in such a way that it should look into the SD Card for the "rootfs" instead of looking into the NAND (which is corrupted in my case). Can any one help me doing this? Please forgive me if the information is not enough and please ask for more info if needed. As I am a newbie, I don't know what other information I can give.


Unexpected output after switch to root

Does somebody know, why I get `-ne` (probably param from `echo` from section of setting `PROMPT_COMMAND` line 23) after I switch to root? Here is my `/etc/bashrc`. Bash 3.2.51, OS X 10.9                    ![Screenshot](http://i.stack.imgur.com/b1F7U.png)


What is the meaning of this error: example: Is a directory

I'm trying out fuse with this tutorial. When I try to run the example using the command below, I get this error:               memsql@memsql-virtual-machine:~$ ~/fuse-2.9.3/example> ./hello /tmp/fuse -d     bash: /home/memsql/fuse-2.9.3/example: Is a directory      What is the meaning of this error? I'm following the tutorial exactly. How do I fix it?


How to include the name in the to: address of the person you are sending mail to in mailx(UNIX-HP)

I am trying to use the `mailx` program to send an e-mail. I want the name of the person to be included in the **toaddress@domain.com** like the normal one on Microsoft Outlook or gmail account e.g `"Thomas<tmuller@gmail.com>"`               ls -l $HOME | mailx -r "fromaddress@domain.com" -s "The content of my home directory"    toaddress@domain.com


how to set block size using blockdev command

Anyone can provide me any test case for the below command: `blockdev --setbsz BYTES` to set/change the block size. I have tried like below but no luck.               $ blockdev --setbsz 2048 /dev/sda5     blockdev: 2048: No such file or directory


Inspect packets coming over Linux-based bridge, and run scripts when certain conditions are met

I'm attempting to do some research regarding replay attacks on physically insecure devices. I have a Raspberry Pi device set up as a bridge to passively monitor Ethernet activity from a device to the network, in order to determine the protocols and syntaxes used for these devices to communicate with one another and generating PCAPs of known-good responses. The next step will be for the device to inspect the packets coming over the bridge and, if they match a set of criteria, using a utility akin to `tcpreplay` to replay the known-valid responses from the PCAP files in order to successfully execute a replay attack. Otherwise, the packets should be allowed through the bridge just the same as any others. Is there a utility that exists for this task in particular?


Problem Windows 8.1 Ubuntu 14.04 dual boot

I installed Ubuntu 14.04 on a computer that has Windows 8.1 preinstalled, following the next link http://itsfoss.com/install-ubuntu-1404-dual-boot-mode- windows-8-81-uefi/ Now I can not dual boot. This are the options that my GRUB shows.   * Ubuntu   * Ubuntu advanced mode   * Windows Boot Manager (on /dev/sda2)   * System setup When I chose Windows Boot Manager (on `/dev/sda2`), a black screen appears, and it does not load. This is what it is shown when I execute `sudo lsblk -fm` command: http://pastebin.com/bvSJ3FY8 Does anyone know why when I choose Windows Boot Manager (on /dev/sda2) the OS does not load? Thanks


Eject USB drives / eject command

I know that the **eject** command can be used to eject almost any hardware component attached, but can it be used to eject USB drives? Is it possible to eject USB drives and external HDD's with the **eject** command?


How to bind emacs abort to key

This is from a .el file loaded in my .emacs file. What do you think?               ;;; Sun keyboard bindings          ;; the below line does not work:     ;; when <cancel> is pressed, the minibuffer echoes "Quit"     ;; but that is the only thing it does          ;; (global-set-key [cancel] 'keyboard-quit)          ;; Note: I got the 'keyboard-quit from C-h c and then C-g     ;; (C-g is the normal way for me to abort)          ;; Those work, so it has probably something to do     ;; with the peculiarities of 'keyboard-quit, rather than     ;; the actual keybinding (or?)          (global-set-key [SunProps] 'describe-variable)     (global-set-key [SunFront] 'next-buffer)     (global-set-key [SunOpen] 'list-buffers)     (global-set-key [XF86Copy] 'clipboard-kill-ring-save)     (global-set-key [XF86Paste] 'x-clipboard-yank)     (global-set-key [XF86Cut] 'clipboard-kill-region)


Bash script for copying text currently entered to prompt

I'm trying to minimize using of mouse. Copying text in terminal is the mostly inconvenient activity for mouse avoiding. Now, `tmux` helping me to obtain this purpose. However, I regularly needs to copy text currently entered to bash prompt. _Currently entered text_ means that I typed some symbols in prompt, but didn't press `Enter`. `tmux` way for this purpose needs for too much keyboard shortcuts. I'd like some script, that copying current text from prompt to clipboard. I want to add this script to `~/.bashrc` and assign keyboard shortcut to. How to write this script?


Is it possible to run vlc as root?

I installed VLC player using this old video. I don't know how to access other users, but root itself only, so I don't know if the video is outdated or works at all, anyway can I install VLC on root and run it from root as well?


Problem with wheezy theme

I am a totally newcomer to Debian wheezy, and I can't install the Asian_Catharsis.tar.lzma theme from gnome-look.org; I've also copied it to ~/.themes yet no effects I earn. Also, I've changed my theme to "Gnome Classic" and every time I try to use 'Gdebi' to install 'gnome-art_0.2-12_all.deb' It returns the error : 'Error: Dependency is not Satisfiable: libgnome2-ruby'. Can you help me fix the issues or introduce me an alternative way to easily download and install themes?


Making Fluxbox look pretty

I'm trying to setup Fluxbox to look nice on my machine as I familiar with it and find it functional. One thing stoping me from moving to it fulltime, while seemingly trivial, is that it looks _ugly_. I have a 1680x1050 screen and fluxbox does not seem to have even basic anti-alliasing. Menus and corners of windows look jagged and, well, not nice. What can I do to make Fluxbox look nicer? e.g. include anti-alliasing, maybe get transparency working....


What is a good X terminal not from a major window environment?

I'm looking for a terminal program I can use with a minimal fluxbox environment I am setting up. Ideally, I am looking for a terminal program that supports tabs and true transparency. So far it seems that the only terminal programs that come close to meeting those requirements come from Gnome or KDE or XFCE. I would rather not use a terminal program from one of these windowing environments as I don't want all the other libraries. Are there any independent x terminal programs, not from a major windowing environment that support true transparency and tabs?


Create service from command

I have following command which I try to setup to run on startup:               su -l hive -c "nohup hive --service metastore > /var/log/hive/hive.out 2> /var/log/hive/hive.log   &"      I was thinking about creating service from this command, but I cannot achieve working code. Mine `start` function form init.d scripts looks like following:               DAEMON="hive-metastore"     DESC="hive metastore service"     EXEC_PATH="/usr/lib/hive/bin/hive"     SVC_USER="hive"     DAEMON_FLAGS="datanode"     PIDFILE="/var/run/hive/hive.pid"     LOCKDIR="/var/lock/subsys"     LOCKFILE="$LOCKDIR/hive"          install -d -m 0755 -o hive -g hive /var/run/hive 1>/dev/null 2>&1 || :     [ -d "$LOCKDIR" ] || install -d -m 0755 $LOCKDIR 1>/dev/null 2>&1 || :     start() {       [ -x $EXEC_PATH ] || exit $ERROR_PROGRAM_NOT_INSTALLED       log_success_msg "Starting ${DESC}: "            su -s /bin/bash $TARGET_USER -c " $EXEC_PATH --service metastore > /var/log/hive/hive.out 2> /var/log/hive/hive.log &"            # Some processes are slow to start       sleep $SLEEP_TIME       checkstatusofproc       RETVAL=$?            [ $RETVAL -eq $RETVAL_SUCCESS ] && touch $LOCKFILE       return $RETVAL     }


dag.repo overwritten

I accidentally overwrote dag.repo by trying to add this               [dag]     name=DAG RPM Repository     baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag     gpgcheck=1     enabled=1        does anyone have the backup file for dag.repo which is found in /etc/yum.repos.d for centOS 5.8 or where can I download it?


Ctrl+F2 no longer opens the app launcher in Gnome 2

In KDE I press `Alt`+`F2` and the app launcher opens. In Gnome, however, I press `Ctrl`+`F2`, it doesn't work. When I first installed Mint 12, it was working, but I think it stopped working when I installed KDE. I'm using Gnome 2.


A shell script that never dies

I want to write a shell script that never dies i.e, Shell script will repeatedly check whether Database is alive or not for every five seconds. The problem is At times the shell script stops abnormally / killed by any one. I want a script that will call itself even if it stopped / killed Is there any way to do that ???


Why can't ACLs block users from having access to their own home directory?

CentOS 6.x In the process of studying ACLs, I came across this blurb in my training documentation: > However with ACLs, you can't deny access for a user to his home directory While I can't think of any reason why I would want to do that, I'm curious why administrators are explicitly blocked from even having the possibility of doing this. Is this something that's hard-coded into `setfacl` or is something else blocking this from happening?


Why is the Sun NFS (Network File System) the choice of filesystem for many distributed filesystems out there?

Apparently some of my peers were talking about it today, and I was wondering what was so special about this file system that makes it the choice behind a lot of distributed file systems, as opposed to many others that exist.


What's the difference between udev and hald?

I'm just beginning to dive into the internals of Linux, and I was wondering what the difference is between udev and the hal daemon. From what I gather, both seem to be responsible for managing hot pluggable devices... is hald used by udev to listen, or are they two separate things?


Do we need to chmod a shell script before it can be rsh

I tried to rsh a shell script from OpenVms to a Red Hat linux. It seems that it is not executed. I created the shell script in OpenVms and Ftp it to the linux. I then ls -la the folder in linux:               -rw-r--r--    1 buedev   buedev        382 Jul 20 11:03 files.sh      It seems that even the owner don't have the right to execute. And if we need to chmod it, how can we do it remotely in OpenVms?


Where is ACL data technically stored?

I'm studying ACLs and am confused on where this information technically resides. Is this just technically just meta data from inodes?


Run a Command and then Parameter Substitution in one line

bash# hostname     host1.example.com      I only want host1. So:               SHORT_HOST=$(/bin/hostname)     SHORT_HOST=${SHORT_HOST%%.*}      Can I turn this into a one liner? - or - what is the best way to make $SHORT_HOST readonly, but still get the short hostname?


nginx ./configure can't find openssl

I'm trying to install nginx and no matter what I do, nginx can't seem to find my openssl path. It looks like it's searching for files that don't exist in any of the openssl directories. Below is my make output. I've tried to specify various paths for nginx to look in for openssl.               [root@server nginx-0.8.54]# make     make -f objs/Makefile     make[1]: Entering directory `/root/nginx-0.8.54'     cd /usr/local/ssl \             && make clean \             && ./config --prefix=/usr/local/ssl/.openssl no-shared  no-threads \             && make \             && make install LIBDIR=lib     make[2]: Entering directory `/usr/local/ssl'     make[2]: *** No rule to make target `clean'.  Stop.     make[2]: Leaving directory `/usr/local/ssl'     make[1]: *** [/usr/local/ssl/.openssl/include/openssl/ssl.h] Error 2     make[1]: Leaving directory `/root/nginx-0.8.54'     make: *** [build] Error 2      Anyone have any thoughts on this?


iptables drop length and TTL condition doesn't work

With `iptables` utility on Linux host need to create mini firewall. I need to drop all incoming connections with package length greater than 722 AND TTL greater than 22. Need exactly AND. Drop only if both conditions are TRUE.               sudo iptables -N LOGDROP     sudo iptables -A OUTPUT -m ttl --ttl-gt 22 -j LOGDROP     sudo iptables -A INPUT -m ttl --ttl-gt 22 -j LOGDROP     sudo iptables -A LOGDROP -m length --length 722:65535 -j DROP      IP-adress of host is `10.6.7.9` with firewall. I did 4 test from this host, trying to ping another host:               ping -s 10000 -t 250 10.6.7.10 //fail (TTL AND LENGHT are wrong)     ping -s 100 -t 200 10.6.7.10 //success (TTL is wrong)     ping -s 10 -t 10 10.6.7.10 //success (Both are right)     ping -s 10000 -t 10 10.6.7.10 // fail, BUT SHOULD BE TRUE.      Why last ping doesn't work ,and how to fix it? Thanks for any help.


Find modifies the Access Time

I have to find those files which have been modified before one day. There are lots of files which are modified before one day. I am doing `find ./ -type f -mtime -1`. But, I observed that my disk util went to 100%. It was probably because of the access time modification for each file. Is there any way to find files without modification of the access time?


GET flash memory type: SLC or MLC

Just for my knowledge, I would like to know whether the type of flash memory used in my pendrive is SLC or MLC. Is there a way to find it out? I googled but found nothing.


Can linux be configured as a server or workstation in DCS and how?

I am a student of Instrumentation and Control. Considering the versatility and stability of Linux, I was wondering if Linux can be configured to act as a **Distributed Control System**? Also if yes, which distro would be appropriate? I have basic knowledge of Linux shell scripting so I would prefer the distro to be relatively user- friendly. _Note : Having experience with Ubuntu, I'd like to set-up the server there._ **Updates in reply to answers :** My hardware : i5 2nd gen, 8GB ram, 500GB HDD.   System : Ubuntu 12.04 Desktop edition 64bit.   Required job (proposed) : Running 5 or more sensors(as a start), driven by a micro-controller(s). I need to set up a server, but without re-installing or changing the system. A second user as a workstation if it can be set-up so. Virtualization is welcome but don't know how. I have till March '13 to learn OpenCL and parallel programming to use my graphics card (NVidia GeForce 525M 1GB) (although this part of plan is still under heavy consideration).      It would be useful and appriciated to get links to good books, tutorials and reports of similar undertaking.


Kernel not detecting multicore cpu

Kernel Version 3.3.4-5.fc17.x86_64 CPU info:               sashan@dhcp-au-122 ~  $ cat /proc/cpuinfo      processor   : 0     vendor_id   : GenuineIntel     cpu family  : 6     model       : 42     model name  : Intel(R) Core(TM) i7-2640M CPU @ 2.80GHz     stepping    : 7     microcode   : 0x28     cpu MHz     : 2793.577     cache size  : 4096 KB     physical id : 0     siblings    : 1     core id     : 0     cpu cores   : 1     apicid      : 0     initial apicid  : 0     fpu     : yes     fpu_exception   : yes     cpuid level : 13     wp      : yes     flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc up arch_perfmon pebs bts nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid     bogomips    : 5587.15     clflush size    : 64     cache_alignment : 64     address sizes   : 36 bits physical, 48 bits virtual     power management:      Notice that it says 1 core and that it is an i7 which has 2 (http://ark.intel.com/products/53464/Intel-Core-i7-2640M-Processor-4M-Cache- up-to-3_50-GHz)


How to make a src.rpm unpack the source to whatever directory I want?

I'm trying to make an rpm that will unpack the source to a custom directory, such as /asdf. When I run it, it always errors out saying "cannot create %sourcedir /usr/src/redhat/SOURCES". Is there something I can put in my .spec file that will make it unpack the source (which is just a .tar.gz file inside the src.rpm) to a custom directory when I do the command "rpm -i xyz.src.rpm"?


How to open VPN connection inside other VPN connection under Linux/Ubuntu

Is it possible to have two VPN connections on top of each other under Ubuntu? Scenario:   1. My organization is quite large and has its own large network.   2. Each group inside the organization has its own subnetwork.   3. All subnets go through a router. The subnets may have public or private IP addresses, but in any case the central router will not route any PPTP or other useful traffic useful for building a VPN to them.   4. The network of our group is, again, behind a switch/router. The switch has a public static IP address, the computers in our subnet have private IP addresses. I cannot reach the switch/router with a VPN connection from _outside_ of our organization's network.   5. The organization offers VPN access to the organization network through a dedicated access node.   6. Our switch/router has "VPN passthough" to a computer system having a VPN server on it.   7. I have a system with a VPN server for PPTP running in our network. If I am inside the organization network, I can connect to it and establish a VPN connection. So what I want to do is:   1. Connect my home computer to the internet via DSL. This is easy. From here, I cannot access any computer in the organization network and I cannot "see" our group's switch (since the organization's router does not route or forward VPN connections).   2. I want to open a VPN connection to the organization network. This is again easy and possible. From here, I can see our group's switch, but not anything inside our group'S network behind it.   3. Open a VPN connection to the switch/router, which is then forwarded to the system with the VPN server on it. This second VPN connection should be "nested" inside the first one. It would allow me to connect to applications inside our group's network, such as a database and network shares. I don't know how to get this to work. Things that I've tried and which did not work:   1. Try to open a VPN connection to our group's switch/router's public IP address directly. The connection never even arrives at the switch, i.e., is not routed by the organization's router.   2. I tried to have the first VPN connection inside my Linux/Ubuntu system, start another system instance in a Virtual Box and inside the virtualized system open a VPN connection to our network. I thought that this should work, but it did not. Is there any way to create a VPN connection that, instead of using a physical DSL connection, uses an existing VPN connection? Or is there another much easier solution? I personally think VPN is the way to go, since I need to access several network services (database, shares, maybe even printer), but I am not sure.


Gracenote database

I use GRIP to convert compact discs to a format that can be copied to an IPOD using AMAROK. By default, GRIP connects to freedb to get disc and track information. I've been told that the Gracenote database has more correct information for the discs I've been converting. Can that one be queried the same way?


Syncing two computers with unison and ssh

I have two machines, one is a laptop and the other is a desktop computer located in my room at the university behind a firewall. Is there a way I can use `unison` to synchronize folders between these two machine? I can do this by mounting the remote file system localy but I was hoping for something more elegant. **Edit:**   When I'm tyring to sync localy to a mounter folder I get an error: > Operation not permitted I can write to the folder directly (e.g. creating a file and saving it with emacs)


Is Pidgin integrated with Gnome Shell?

Does Pidgin integrate well with Gnome Shell, compared to Empathy? I'm using Linux Mint 12 right now. Would I be better off installing Empathy?


Does vsftpd support plain FTP?

I have been able to set up a SFTP server using `vsftpd` on Ubuntu 14.04. However, I want to experiment with plain (unencrypted) FTP to see the unencrypted packets using `wireshark`. To set up the SFTP server I followed this guide - it is composed of two sections: the first is for plain FTP, the second for SFTP. I managed to get SFTP working, but not plain FTP. Filezilla returns an error, when I try to connect using plain FTP:               Response:       SSH-2.0-OpenSSH_6.2p2 Ubuntu-6ubuntu0.4     Error:  Cannot establish FTP connection to an SFTP server. Please select proper protocol.     Error:  Critical error     Error:  Could not connect to server      It returns this message, although I have removed and purged `vsftpd` and reinstalled it, then made configuration of the first section only. Does `vsftpd` support plain FTP and how do I apply it?


my IP is deallocated by itself after a time later

I use ssh to connect a remote Linux device and assign IP address manually by `ifconfig eth0 192.168.0.2` (I know ifconfig is depreciated and I should use ip instead). More or less each half an hour or so, the IP is deallocated and cause interruption to my remote connection. It happens even I assign the IP address by `ip addr add 192.168.0.2/24 dev eth0`. I wonder if it is any setting related issue that deallocate an IP after a time later or it could be something to do with the hardware interface? I don't have any setting about `eth0` on `/etc/network/interfaces`               #auto eth0     #iface eth0 inet dhcp      EDIT: I use Ubuntu 12.04 and it does not have the network manager. It has WICD that handles the WiFi interface.


Intel/ati hybrid graphics on debain

I am willing to step out of my comfort zone and start trying to test Debian (probably testing or unstable,as I want to try rolling release distros). My question is, how do I get AMD/Intel hybrid graphics to run on it? Of course I would want proprietary drivers.


Can you pipe to a .bash_profile function?

I received a great function for highlighting files in Apple's finder using the command-line. It's basically a wrapper for osascript. I got it from Mac OS X: How to change the color label of files from the Terminal and it looks like this,               # Set Finder label color     label(){       if [ $# -lt 2 ]; then         echo "USAGE: label [0-7] file1 [file2] ..."         echo "Sets the Finder label (color) for files"         echo "Default colors:"         echo " 0  No color"         echo " 1  Orange"         echo " 2  Red"         echo " 3  Yellow"         echo " 4  Blue"         echo " 5  Purple"         echo " 6  Green"         echo " 7  Gray"       else         osascript - "$@" << EOF         on run argv             set labelIndex to (item 1 of argv as number)             repeat with i from 2 to (count of argv)               tell application "Finder"                   set theFile to POSIX file (item i of argv) as alias                   set label index of theFile to labelIndex               end tell             end repeat         end run     EOF       fi     }      I put it in via `vim .bash_profile`, ran `source .bash_profile` and was able to run the function with `label 2 /Users/brett/Desktop/test.txt`. Perfect. But what if I'm updating all our old PHP mysql_query( statements to PDO and I want to visually highlight the files I need to edit? I would normally run,               find /Users/brett/Development/repos/my-repo/ -name "*.php" -print0 | xargs -0 grep -Iil 'mysql_query(' | xargs -I '{}' -n 1 label 2 {}      But it returns,               xargs: label: No such file or directory      I read that I should try running `export -f label`, but that doesn't seem to help either. Does anyone know how I can pipe paths/files from `grep` through `xargs` to a .bash_profile function?


can't get hello world shell script to run in FreeBSD

Server is running FreeBSD 9.2. Using vim, I wrote the following script called `hello`:               #!/bin/sh     echo "hello world"      Then I set it as executable:               >chmod 755 hello      Then I tried to run it from the command line (while in the same folder where the script was saved):               >hello      I got this error message:               hello: Command not found.      Is there something different I have to do to make an executable script in BSD?


Viewing very wide files

I need to view some 5,200 byte wide files. Is there any tool to make this practical without modifying the file? Ideally, I'd like to specify which columns I'm viewing.


Printing lines from one file if part of them appears in another. Both files are millions of lines long

I have two files, let's call them `123.txt` and `789.txt`. `123.txt` is 2.5M lines long, and `789.txt` is 65M lines long. Is there any way to use `grep` or similar to keep any lines from `789.txt` that contain lines from `123.txt?` There will be a max of one duplicate per line in `789.txt`, and the duplicate text will be at the beginning of the line. I'm totally stuck on this, and couldn't find any info online, so I don't really have anything to start with. It will be running on a server, so I don't mind it taking a while (which I know it will) I have two files, let's call them `123.txt` and `789.txt`. `123.txt` is 2.5M lines long, and `789.txt` is 65M lines long. Is there any way to use `grep` or similar to remove any lines from `789.txt` that contain lines from `123.txt?` There will be a max of one duplicate per line in `789.txt`, and the duplicate text will be at the beginning of the line. I'm totally stuck on this, and couldn't find any info online, so I don't really have anything to start with. It will be running on a server, so I don't mind it taking a while (which I know it will)   * 123.txt:              hxxp://www.a.com     hxxp://www.b.com     hxxp://www.c.com        * 789.txt:              hxxp://www.a.com/kgjdk-jgjg/     hxxp://www.b.com/gsjahk123/     hxxp://www.c.com/abc.txt     hxxp://www.d.com/sahgsj/        * Desired output:              hxxp://www.a.com/kgjdk-jgjg/     hxxp://www.b.com/gsjahk123/     hxxp://www.c.com/abc.txt


Are FIFO, pipe & Unix domain socket the same thing in Linux kernel?

I heard that FIFOs are named pipes. And they have exactly the same semantics. On the other hand, I think Unix domain socket is quite similar to pipe (although I've never made use of it). So I wonder if they all refer to the same implementation in Linux kernel. Any idea?


Possible sftp connection behind a router that is impossible to open any public ports except some standart ports like http?

I want to ask about the problem that I have with my office computer. I cannot reach the router so I cannot redirect any incoming requests to my PC. I have to get a huge file from another computer on the ethernet and the connection at the office; especially upload speed; is great therefore I want to serve a sftp server within my computer. How can I redirect the incoming requests to my computer for the ssh port?


How can I move firewall settings from one Debian Squeeze web server to another?

I configured a Debian Squeeze virtual machine in VMWare on my laptop. I configured it with a very restrictive set of firewall rules using Firestarter. I then uploaded a copy of its disk image to use as a virtual private server on the internet. On the internet version, I rather rashly removed my firewall settings via the following command:               apt-get purge firestarter      I’ve since realised I want to restore the firewall rules to their old state, which is still on the original virtual machine on my laptop. My question is: how can I copy the firewall settings from the virtual machine on my laptop to the one on the internet? I tried copying /sbin/iptables from the original virtual machine to the new one, but that hasn’t had any effect (according to the output of `iptables -L`).


Bash remote autocompletion : change the 'starting' directory

I'm regularly downloading files from a remote server, always from the same directory. So I wrote a custom function that I put in my `bashrc`:               download_from_myserver () {         for file in "$@"         do             rsync myserver:/home/pierre/downloads/"$file" .         done     }      Right now, the autocompletion works by default with files in the current directory. I would like to change the autocompletion so that bash automatically connects to the server via `ssh` and autocompletes with files that are in `myserver:/home/pierre/downloads/`. In case I'm not being clear, here's an example: let's say I have `my_file.txt` in the remote directory, I want to be able to do this: `download_from_my_server my_fi``TAB`   `download_from_my_server my_file.txt` How would I do this ? Notes : I'm already using a password-less connection, rsync and scp autocomplete work well, that's not the issue. I'm using Ubuntu on both machines if that's important.


How to run xfce-terminal with different commands per tab and keep using the tabs after the commands have returned?

To keep the overview I like to place multiple commands always in the same order and start them automatically together (gradle, git, database, scala- REPL, jboss...) -H (hold) seems to mean that the terminal isn't closed after termination, but how do I terminate such a process willfully? Not at all? In such a way that I can continue to use the terminal.  I'm using xubuntu with with xfce4-terminal and bash. Is there a better GUI- solution to startup multiple commands, with the ability to continue working in that window/tab? **Update:** If you don't know these commands: Jboss and gradle are continously producing output, which you don't want to have intermixed in the same terminal. And sometimes they need to be interrupted with ^C, and restarted. I don't like to reopen an xfce4-term and navigate to the directory I need to act in. Database and scala-REPL are interactive so there is no sense in starting them in the background. My current startup-script just navigates to the desired directories, and opens all tabs in the right order to find them always at the same position, naming every tab for its purpose:               xfce4-terminal -T eclipse   --working-directory=/home/stefan/oximity -e "/opt/eclipse/eclipse" \         --tab -T arandr --working-directory=/home/stefan/oximity -e "arandr /home/stefan/.screenlayout/oximity.sh" \         --tab -T bash       --working-directory=/home/stefan/oximity \         --tab -T gradle     --working-directory=/home/stefan/oximity/med \         --tab -T git        --working-directory=/home/stefan/oximity/med \         --tab -T mysql      --working-directory=/opt/mini/mysql \         --tab -T jboss      --working-directory=/opt/mini/jboss \         --tab -T jboss-log  --working-directory=/opt/mini/jboss/standalone/log \         --tab -T scala-REPL --working-directory=/home/stefan/proj/mini/forum -e /opt/scala/bin/scala      Eclipse and arandr are detached from the shell and run in their own window, so there the -e (execute) param works. I think for the scala-REPL it works since it is the last command in the list.


Can't indent heredoc to match nesting's indent

If there's a "First World Problems" for scripting, this would be it. Mainly asking because I feel like I should know how to get around it if I need to. I have the following code in a script I'm updating:               if [ $diffLines -eq 1 ]; then             dateLastChanged=$(stat --format '%y' /.bbdata | awk '{print $1" "$2}' | sed 's/\.[0-9]*//g')                  mailx -r "Systems and Operations <sysadmin@[redacted].edu>" -s "Warning Stale BB Data" jadavis6@[redacted].edu <<EOI             Last Change: $dateLastChanged                  This is an automated warning of stale data for the UNC-G Blackboard Snapshot process.             EOI          else             echo "$diffLines have changed"     fi      I don't mind the `sed` stuff, or at least can fix that later, my main problem is that I have to add an email notification with this now (that's the change I'm making) I can do it fine with heredoc. I'm using it both as personal preference and it's used in a lot of other scripts so I like to stay with our coding conventions for ease of universal comprehension, even if a lot of it is arbitrary. The script sends email without issues, but the mailx command is nested within an if statement so I appear to be left with two choices:   1. Put `EOI` on a new line and break indentation patterns or   2. Keep with indentation but use something like an echo statement to get mailx to suck up my email. I'm open to alternatives to heredoc, but if there's a way to get around this it's my preferred syntax.


Why does "$i | sed" not work?

I have this code:               if [ $i | sed -e "s/^.*\(.\)$/\1/" = "/" ]     then         echo "folder"     else         echo "file"     fi      where `$i` is something like this               app4/      The code above should get the last char of the string and check if it is a slash (`/`), but it tells me: > ./str: line 12: =app4/: File or directory doesn't exist How can I solve this?


Watch USB connections vendor id, product id, revision

I'd like to simply watch all devices added and removed from my system and view their USB vendor ID, product ID, and revision and other relevant information. How can I do this in Linux? Is there a logfile that I can `tail -f` or does this require something else?


How can I tell when a file was modified?

I am running some simulation on a high performance computing cluster (HPC). When I check when the file was changed with `ls -t` I get the wrong result. I know this becouse I have run a small job that print a different file from the one that was pressent during when the server claims it was last changed. Is there any other way? Thanks Example:               ls -lut     total 328     -rw-r--r-- 1 avityo ofarago  89070 Nov 23 21:17 mem.xyz     -rwxr-xr-x 1 avityo ofarago 218752 Nov 23 21:17 mem     -rw-r--r-- 1 avityo ofarago    404 Nov 23 21:17 propFile.dat     -rw-r--r-- 1 avityo ofarago    271 Nov 23 14:01 parOut.txt      after I run `cat parOut.txt` (which is the main file that I follow):               ls -lut     total 328     -rw-r--r-- 1 avityo ofarago    271 Nov 24 11:47 parOut.txt     -rw-r--r-- 1 avityo ofarago  89070 Nov 23 21:17 mem.xyz     -rwxr-xr-x 1 avityo ofarago 218752 Nov 23 21:17 mem     -rw-r--r-- 1 avityo ofarago    404 Nov 23 21:17 propFile.dat      The files themself are stored on some sort of central file system server that I don't know anything about


what's wrong with embedding php scripts inside bash ones?

I was trying to use `php` inside bash script, but I came across several problems. My first try failed with error about `bash` not being able to find end of here-document. The minimal version that still triggered the error is as follows ( **UPD** Q: Why bash can't see end of here-document marker?):               $ type 1.sh     #!/bin/bash -eu     cat <(cat <<SCRIPT     {     SCRIPT)     $ ./1.sh     ./1.sh: line 7: warning: here-document at line 5 delimited by end-of-file (wanted `SCRIPT')     {      **UPD** I've created separate questions for the rest of the post. "Well, I can avoid using braces then," I decided. But it turned out the first symbol is cut off for some reason ( **UPD** Q: Who and for what reason cuts off first symbol of the scripts? Has it something to do with a BOM?):               $ type 2.sh     #!/bin/bash -eu     php <(cat <<'SCRIPT'     <?php var_dump($_SERVER['argv']);     SCRIPT)     $ ./2.sh     ?php var_dump($_SERVER['argv']);      Then I tried to find out who is at fault ( **UPD** Q: How to open process substituted file from php?):               $ type 3.sh     #!/bin/bash -eu     php -r 'var_dump(file_get_contents($_SERVER["argv"][1]));' -- <(cat <<'SCRIPT'     <?php var_dump($_SERVER['argv']);     SCRIPT)     $ ./3.sh     PHP Warning:  file_get_contents(/dev/fd/63): failed to open stream: No such file or directory in Command line code on line 1          Warning: file_get_contents(/dev/fd/63): failed to open stream: No such file or directory in Command line code on line 1     bool(false)      The first symbol is probably cut off by php:               $ type 4.sh     #!/bin/bash -eu     php <(cat <<SCRIPT     12     SCRIPT)     $ ./4.sh     2     $ type 5.sh     #!/bin/bash -eu     cat <(cat <<SCRIPT     12     SCRIPT)     $ ./5.sh     12      Well, I've come up with simpler solution:               $ type 6.sh     #!/bin/bash -eu     cat | php -- 1 <<'SCRIPT'     <?php var_dump($_SERVER['argv']);     SCRIPT     $ ./6.sh     array(2) {       [0]=>       string(1) "-"       [1]=>       string(1) "1"     }      But what's up with all that madness? I run the tests on `Debian` (`php-5.4.14`, `bash-4.1.5`) and `Arch Linux` (`php-5.4.12`, `bash-4.2.42`). **UPD** I've explicitly stated all the questions, see above.


grep substring between quotes

Let's say I have a string like this:               title="2010-09-11 11:22:45Z"      How can I `grep` the date itself and disregard the quotes/title/`Z`? The file can contain more strings like:               randomstring     title="2010-09-11 11:22:45Z"     title="disregard me"      So I only want to `grep` timestamps with a single `grep` command.


Difference between alias in zsh and alias in bash

I have searched around but could not find anything conclusive. Is there a difference between the alias command in zsh and the alias command in bash? If not, does it mean I can share a set of aliases between the two shells and expect them to work as I intended?


Rogue Java process brings my computer to a halt

In reference to my earlier post: Is there a log of past threads that are now closed? I gave the process a `kill -STOP` signal and started examining the details. I can't seem to figure out why it is acting up. The problem lies with IcedTea, which is (from what I understand) something to do with Java applets on the web. Below is the contents of `/proc/13784/cmdline`:                /usr/lib64/jvm/jre//bin/java     -Xbootclasspath/a:/usr/share/icedtea-web/netx.jar:/usr/share/icedtea-web/plugin.jar:/usr/share/java/js.jar     -classpath     /usr/lib64/jvm/jre//lib/rt.jar     sun.applet.PluginMain     /tmp/icedteaplugin-max/13636-icedteanp-plugin-to-appletviewer     /tmp/icedteaplugin-max/13636-icedteanp-appletviewer-to-plugin      I've never poked around the `/proc` directories. Which file would be the most telling of my issue here? This process uses 90%+ of my processor speed and brings my core temperature to 75C (sometimes causing a shutdown). **EDIT** This process uses 170%+ of my CPU according to `htop`


Managing multiple configurations (/etc) - With a VCS?

I have a machine that needs to have two configurations that I need to maintain (the machine is occasionally moved between two environments and has different roles in each environment). Note: This is not an enterprise environment, it is a home environment. I am considering a VCS (I like `git`), probably using `etckeeper`. However I realise that my toolbox is limited and that my VCS hammer might cause this problem to be identified as a nail when it could be identified better as something else. Is this the correct way to go about the solution?


Bringing up an interface does not add default gateway to the routing table in Ubuntu

I have this in my interfaces file:               auto eth1     iface eth1 inet static             address 20.135.251.218             netmask 255.255.255.252             up route add default gw 20.135.251.217 dev eth1 metric 1      If I run `ifconfig eth1 down`, the default gateway is removed from the routing table. But when I do `ifconfig eth1 up`, the default gateway is not added to the routing table. I have two default gateways with different metric, so only the other gateway appears in the routing table. I have set gc_timeout as `10`. I'm trying implemet a solution mentioned in the answer to this question. how can I automatically add the default gateway when I bring up the interface?


Gnome Terminal won't autocomplete

My gnome-terminal on a ubuntu 10.10 machine is not working the way it should work. No autocomplete is working. `ctrl + l` won't clear the screen, bash prompt is simply a `$` and nothing else. I got this machine passed on from someone else. I just created a new user for myself and hoped that I would get a fresh start. I checked and there is no `/etc/profile` or `/etc/bashrc`. There was a folder named `.profile.d` that I renamed to something else. Stil the problem persists. There are no configuration files inside my home directory either (.bashrc, .bash_profile, .bash_aliases) I could use any help for troubleshooting this problem


Ubuntu no connection after reboot

I cannot connect to my system after a reboot. It's a virtual Ubuntu machine only accessible by SSH. There is a gmrl rescue system installed and I got access to the disk. The only thing I can find in the syslog is:               kernel: [3569702.133267] init: vsftpd main process (686) killed by TERM signal     kernel: [3569702.134099] init: tty4 main process (718) killed by TERM signal     kernel: [3569702.134631] init: tty5 main process (723) killed by TERM signal     kernel: [3569702.135125] init: tty2 main process (730) killed by TERM signal     kernel: [3569702.135832] init: tty3 main process (731) killed by TERM signal     kernel: [3569702.136441] init: cron main process (737) killed by TERM signal     kernel: [3569702.136962] init: irqbalance main process (764) killed by TERM signal     kernel: [3569702.142435] init: tty6 main process (734) killed by TERM signal     kernel: [3569702.143693] init: tty1 main process (1268) killed by TERM signal     kernel: [3569702.201036] init: plymouth-upstart-bridge main process (30578) terminated with status 1     kernel: Kernel logging (proc) stopped.     rsyslogd: [origin software="rsyslogd" swVersion="5.8.6" x-pid="599" x-info="http://www.rsyslog.com"] exiting on signal 15.      Where should I go from here?


SSH can't use internet when multiple interfaces present in route

I'm trying to make SSH tunnel connection on any possible interface (which has internet connection). I'm currently using `ppp0` and `eth0` interfaces. `ppp0` always has internet and reinitialized if connection is lost. `eth0`'s IP is assigned via DHCP and never has internet connection. If I reboot the PC, a default route via `eth0` is added to routing table. If that occurs, I can `ping` to Google but can't connect to remote SSH server. If I unplug `eth0` cable, everything works as expected. If I replug the cable, everything still works correctly. As a workaround, I wrote a script which deletes all default routes using device `eth0`. So why is `ping`, `telnet`, `apt-get` etc. can use internet but SSH can't?


SLES 10 - repositories?

Can somebody help with adding a repo for SuSE Linux Enteprise Edition 10 SP3? First - can't find any "official" repos. Found a few repos for openSUSE and few other - but every time I try them I get this error (using YaST2):               Unable to create installation source            'http://download.opensuse.org/repositories/openSUSE%3a/Tools/SLE_10/'.           Unknown source type for http://download.opensuse.org/repositories/openSUSE%3a/Tools/SLE_10/      I also get the same with other repos...


eval used with piped command

I have file.txt with command stored in one line (this command is valid when running in console) and I want to execute it in one line with sh like               cat file.txt | eval      what is missing? any protips? and what if I have file with many commands (one for each line) and I want to execute only one command (one whole line)? my first idea is:               head -n5 | tail -n1 | eval


Synchronizing subdirectory with root directory

I have files like this on my linux web server:   * folder1/ <- main, this is where users of my page are led to   * folder1/testing/ <- copy of folder1(without folder1/testing/) to modify and optimize without disturbing the main version. How do I synchronize folder1/ with the contents of folder1/testing/, so that folder1/ looks like folder1/testing/?


Copy modified files from one server to other

Scenario: 2 Servers (*.12 and *.13) CakePHP "application" on both of them.               *.12 is "Production" Server     *.13 is "Development" Server      Now i want to copy all files modified the last 2 days from test server to production server WITHOUT the directory ./tmp i can find them on production server with:               find ./ -type d -name tmp -prune -o  -mtime -2 -exec ls {} \;      On both servers i have only ssh access.


Command line convert webp to jpg?

I'm using ubuntu 12.04. I've installed `libwebp2` & `libwebp-dev` So far, no example found on the net of converting webp to jpg. Some webp files can easily converted by using imagemagick with command               convert file.webp file.jpg      but lots of webp files cannot be converted and give error:               convert: no decode delegate for this image format `file.webp' @ error/constitute.c/ReadImage/532.     convert: missing an image filename `file.jpg' @ error/convert.c/ConvertImageCommand/3011.      --------added This is the file: http://www.filedropper.com/file_144


Use boot parameter to perform certain actions after boot

I'm asking myself if I can use Grub 2 to tell the Operating System which actions to perform after boot. **Background:**   I have a HTPC with Debian Wheezy installed. Sometimes I want to use the System as a regular desktop but sometimes I'd just like to have XBMC started. I tried out a dual boot with OpenElec which wasn't very convenient because I was not able to mount my RAID-1 in OpenElec. My next attempt would be to use a second minimal Debian installation with XBMC. With this solution I could still choose between regular desktop and HTPC purpose in Grub. But now I thought this could be a waste of time and disk space, as I have Debian already installed. It would be easier if there was some kind of boot parameter I could use to tell my regular Debian installation   * "Boot to desktop" or    * "Boot to XBMC" Then I would just need a second entry in Grub to handle this boot parameter. Is this somehow possible?


Problem starting a service running Debian

I want to run a UPNP renderer as a service on a Raspberry Pi using Raspian, a Debian based distro. Actually, everything runs fine but one thing : I can't manage to start the service at boot time at the right time. To me, it looks that it starts too early before the wifi connection has been established. As a result, the renderer can't be seen on the network. If I manually stop the service and restart it, it works fine. As root, I run the following command to create the service : `update-rc.d gmediarender defaults` but links are created like S02gmediarender and the wifi manager is S03wicd so after unregistering gmediarender, I tried : `update-rc.d gmediarender defaults 99` but the result is just the same. Originally, my script was :               #!/bin/sh          ### BEGIN INIT INFO     # Provides: gmediarender     # Required-Start: $remote_fs $syslog     # Required-Stop: $remote_fs $syslog     # Default-Start: 2 3 4 5     # Default-Stop: 0 1 6     # Short-Description: Start GMediaRender at boot time     # Description: Start GMediaRender at boot time.     ### END INIT INFO          USER=root     HOME=/root     export USER HOME     case "$1" in         start)             echo "Starting GMediaRender"             start-stop-daemon -x /usr/local/bin/gmediarender -c pi:audio -S -- -f "Raspberry" -d             ;;         stop)             echo "Stopping GMediaRender"             start-stop-daemon -x /usr/local/bin/gmediarender -K             ;;         *)             echo "Usage: /etc/init.d/gmediarender {start|stop}"             exit 1             ;;     esac          exit 0      i tried to remove the header part but it didn't help. Thanks for your help :-) After adding the $network dependency, I issued the update-rc.d command with (and then without) the -n option :               pi@raspberrypi ~ $ sudo update-rc.d -n gmediarender defaults 99     update-rc.d: using dependency based boot sequencing     insserv: enable service ../init.d/gmediarender -> /etc/init.d/../rc0.d/K01gmediarender     insserv: enable service ../init.d/gmediarender -> /etc/init.d/../rc1.d/K01gmediarender     insserv: enable service ../init.d/gmediarender -> /etc/init.d/../rc2.d/S02gmediarender     insserv: enable service ../init.d/gmediarender -> /etc/init.d/../rc3.d/S02gmediarender     insserv: enable service ../init.d/gmediarender -> /etc/init.d/../rc4.d/S02gmediarender     insserv: enable service ../init.d/gmediarender -> /etc/init.d/../rc5.d/S02gmediarender     insserv: enable service ../init.d/gmediarender -> /etc/init.d/../rc6.d/K01gmediarender     insserv: dryrun, not creating .depend.boot, .depend.start, and .depend.stop     pi@raspberrypi ~ $       Here's my rc2.d disrectory : I wonder if network-manager and wicd are not redundant and may interfere and cause trouble ?               pi@raspberrypi /etc/rc2.d $ ll     total 4     lrwxrwxrwx 1 root root  17 oct.  28 23:43 K01lightdm -> ../init.d/lightdm     lrwxrwxrwx 1 root root  20 mars  16 19:20 K06nfs-common -> ../init.d/nfs-common     lrwxrwxrwx 1 root root  17 mars  16 19:20 K06rpcbind -> ../init.d/rpcbind     -rw-r--r-- 1 root root 677 févr.  8 01:26 README     lrwxrwxrwx 1 root root  18 oct.  28 22:56 S01bootlogs -> ../init.d/bootlogs     lrwxrwxrwx 1 root root  17 oct.  28 23:27 S01ifplugd -> ../init.d/ifplugd     lrwxrwxrwx 1 root root  14 oct.  28 22:56 S01motd -> ../init.d/motd     lrwxrwxrwx 1 root root  17 oct.  28 23:27 S01rsyslog -> ../init.d/rsyslog     lrwxrwxrwx 1 root root  14 mars  16 17:50 S01sudo -> ../init.d/sudo     lrwxrwxrwx 1 root root  22 oct.  28 23:27 S01triggerhappy -> ../init.d/triggerhappy     lrwxrwxrwx 1 root root  14 oct.  28 23:27 S02cron -> ../init.d/cron     lrwxrwxrwx 1 root root  14 oct.  28 23:27 S02dbus -> ../init.d/dbus     lrwxrwxrwx 1 root root  24 oct.  28 23:28 S02dphys-swapfile -> ../init.d/dphys-swapfile     lrwxrwxrwx 1 root root  22 mars  30 21:38 S02gmediarender -> ../init.d/gmediarender     lrwxrwxrwx 1 root root  13 oct.  28 23:27 S02ntp -> ../init.d/ntp     lrwxrwxrwx 1 root root  15 mars  16 18:00 S02rsync -> ../init.d/rsync     lrwxrwxrwx 1 root root  13 oct.  28 23:59 S02ssh -> ../init.d/ssh     lrwxrwxrwx 1 root root  22 mars  16 21:25 S03avahi-daemon -> ../init.d/avahi-daemon     lrwxrwxrwx 1 root root  19 mars  16 18:47 S03bluetooth -> ../init.d/bluetooth     lrwxrwxrwx 1 root root  25 mars  16 18:48 S03network-manager -> ../init.d/network-manager     lrwxrwxrwx 1 root root  14 mars  23 15:09 S03wicd -> ../init.d/wicd     lrwxrwxrwx 1 root root  20 mars  16 19:20 S04pulseaudio -> ../init.d/pulseaudio     lrwxrwxrwx 1 root root  18 mars  16 19:20 S05rc.local -> ../init.d/rc.local     lrwxrwxrwx 1 root root  19 mars  16 19:20 S05rmnologin -> ../init.d/rmnologin     pi@raspberrypi /etc/rc2.d $       A new try : I tried to rename `/etc/rc2.d/S02gmediarender` as `/etc/rc2.d/S06gmediarender` Same problem : after reboot, the service isn't visible on the network. **Finally:** I went in another direction : getting the problem simpler as I suspected that wicd and network-manager were probably interfering with each other. So I got rid of the two of them and configured `/etc/network/interfaces` so the RPI simply connect to my wifi access point. The KISS effect : Keep it simple, stupid ;-) Without the wifi managers overhead and after a reboot, the GMediaRenderer is now available on my network.


lsof: show files open as read-write

When I try to remount a partition as `read-only`, I get an error `/foo is busy`. I can list all files open from `/foo` with               lsof /foo      but that does not show me whether files are open `read-only` or `read-write`. Is there any way to list only files which are open as `read-write` ?


Upstart: launching something only once

Fact: If you use `start on <event>` for a job, your job might be run every time `<event>` occurs. The upstart cookbook mentions two methods to run a job only once. The first is logical to me, and involves creating a dummy run-forever job that is started on `<event>`. Since that dummy job is run-forever, and single- instance, it will get started only once and you can use `start on started <dummy-job>` in your actual job. The second method looks a lot simpler: `start on startup and <event>`. **The purpose of this question is to understand why this second method works**. This has to do with understanding how `on start` handles events compounded by `and`. I.e., since `<event>` occurs multiple times, why is it that the compounded event is triggered only once? Could it be that a compounded event is re-triggered only after **both** `startup` and `<event>` are re-triggered? **I'm looking for a confirmation of this.**


Why doesn't the process substitution <() work with ssh -F

I have some vagrant virtual machines. To log into them I issue the `vagrant ssh` command. I want to log into them using regular `ssh` command. The `vagrant ssh-config` outputs the suitable config file               $ vagrant ssh-config     Host default       HostName 127.0.0.1       User vagrant       Port 2201       UserKnownHostsFile /dev/null       StrictHostKeyChecking no       PasswordAuthentication no       IdentityFile /home/cbliard/.vagrant.d/insecure_private_key       IdentitiesOnly yes       LogLevel FATAL      When outputing this config in a file and using with `ssh -F`, everything works fine:               $ vagrant ssh-config > /tmp/config     $ ssh -F /tmp/config default     => logged successfully      When using process substitution operator `<(cmd)` to prevent the creation of the temporary config file, it fails:               $ ssh -F <(vagrant ssh-config) default     Can't open user config file /proc/self/fd/11: No such file or directory      Same error happens when using `<(cat /tmp/config)`               $ ssh -F <(cat /tmp/config) default     Can't open user config file /proc/self/fd/11: No such file or directory      I am using zsh and I observe the same behavior with bash. What am I doing wrong here?


Is "temp" a reserved system name?

I was doing homework on a remote server, and I realized that I had my header and cpp files swapped. So, I wanted to change the names. I began by renaming my header file 'temp'. Then, weird things started happening. First, header file, named "temp", disappeared. The old header, named someFile.cpp, became empty. Also, my brackets started showing up as weird lowercase å characters. Is this an issue with VI? My machine? Is there is a way to correct the situation? **Edit:** My machine was running Mac OS X, the remote machine was running some other Unix or Linux variant. I think it was Red Hat or Debian. I used mv to rename the file.


List all the matched files starting from an index

In zsh, there is the `[m,n]` glob qualifier which works as follows: > [beg[,end]] > > specifies which of the matched filenames should be included in the returned > list. The syntax is the same as for array subscripts. beg and the optional > end may be mathematical expressions. As in parameter subscripting they may > be negative to make them count from the last match backward. E.g.: > ‘*(-OL[1,3])’ gives a list of the names of the three largest files. So for example, if I type:               print *([2,10])       it will return the elements 2 to 10 matched by `*`. My question is: How can I ask zsh to return the matched elements starting from element X to the end of the list? For example say I have 2500 files in one folder, BUT I don't know this number, and I would like to match all files **starting from** file 160. I have tried: 1) `print -l *([160])` -> only matches file # 160.  2) `print -l *([160,])` -> No matches found 3) `print -l *~*([1,160])` -> No matches found


High load average, low CPU usage - why?

We're seeing huge performance problems on a web application and we're trying to find the bottleneck. I am not a sysadmin so there is some stuff I don't quite get. Some basic investigation shows the CPU to be idle, lots of memory to be available, no swapping, no I/O, but a high average load. The software stack on this server looks like this: . Solaris 10 . Java 1.6 . WebLogic 10.3.5 (8 domains) The applications running on this server talk with an Oracle database on a different server. This server has 32GB of RAM and 10 CPUs (I think). Running prstat -Z gives something like this:                  PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP       3836 ducm0101 2119M 2074M cpu348  58    0   8:41:56 0.5% java/225      24196 ducm0101 1974M 1910M sleep   59    0   4:04:33 0.4% java/209       6765 ducm0102 1580M 1513M cpu330   1    0   1:21:48 0.1% java/291      16922 ducm0102 2115M 1961M sleep   58    0   6:37:08 0.0% java/193      18048 root     3048K 2440K sleep   59    0   0:06:02 0.0% sa_comm/4      26619 ducm0101 2588M 2368M sleep   59    0   8:21:17 0.0% java/231      19904 ducm0104 1713M 1390M sleep   59    0   1:15:29 0.0% java/151      27809 ducm0102 1547M 1426M sleep   59    0   0:38:19 0.0% java/186       2409 root       15M   11M sleep   59    0   0:00:00 0.0% pkgserv/3      27204 root       58M   54M sleep   59    0   9:11:38 0.0% stat_daemon/1      27256 root       12M 8312K sleep   59    0   7:16:40 0.0% kux_vmstat/1      29367 root      297M  286M sleep   59    0  11:02:13 0.0% dsmc/2      22128 root       13M 6768K sleep   59    0   0:10:51 0.0% sendmail/1      22133 smmsp      13M 1144K sleep   59    0   0:01:22 0.0% sendmail/1      22003 root     5896K  240K sleep   59    0   0:00:01 0.0% automountd/2      22074 root     4776K 1992K sleep   59    0   0:00:19 0.0% sshd/1      22005 root     6184K 2728K sleep   59    0   0:00:31 0.0% automountd/2      27201 root     6248K  344K sleep   59    0   0:00:01 0.0% mount_stat/1      20964 root     2912K  160K sleep   59    0   0:00:01 0.0% ttymon/1      20947 root     1784K  864K sleep   59    0   0:02:22 0.0% utmpd/1      20900 root     3048K  608K sleep   59    0   0:00:03 0.0% ttymon/1      20979 root       77M   18M sleep   59    0   0:14:13 0.0% inetd/4      20849 daemon   2856K  864K sleep   59    0   0:00:03 0.0% lockd/2      17794 root       80M 1232K sleep   59    0   0:06:19 0.0% svc.startd/12      17645 root     3080K  728K sleep   59    0   0:00:12 0.0% init/1      17849 root       13M 6800K sleep   59    0   0:13:04 0.0% svc.configd/15      20213 root       84M   81M sleep   59    0   0:47:17 0.0% nscd/46      20871 root     2568K  600K sleep   59    0   0:00:04 0.0% sac/1       3683 ducm0101 1904K 1640K sleep   56    0   0:00:00 0.0% startWebLogic.s/1      23937 ducm0101 1904K 1640K sleep   59    0   0:00:00 0.0% startWebLogic.s/1      20766 daemon   5328K 1536K sleep   59    0   0:00:36 0.0% nfsmapid/3      20141 daemon   5968K 3520K sleep   59    0   0:01:14 0.0% kcfd/4      20093 ducm0101 2000K  376K sleep   59    0   0:00:01 0.0% pfksh/1      20797 daemon   3256K  240K sleep   59    0   0:00:01 0.0% statd/1       6181 root     4864K 2872K sleep   59    0   0:01:34 0.0% syslogd/17       7220 ducm0104 1268M 1101M sleep   59    0   0:36:35 0.0% java/138      27597 ducm0102 1904K 1640K sleep   59    0   0:00:00 0.0% startWebLogic.s/1      27867 root       37M 4568K sleep   59    0   0:13:56 0.0% kcawd/7      12685 ducm0101 4080K  208K sleep   59    0   0:00:01 0.0% vncconfig/1     ZONEID    NPROC  SWAP   RSS MEMORY      TIME  CPU ZONE         42      135   22G   19G    59%  87:27:59 1.2% dsuniucm01          Total: 135 processes, 3167 lwps, load averages: 54.48, 62.50, 63.11      I understand that CPU is mostly idle, but the load average is high, which is quite strange to me. Memory doesn't seem to be a problem. Running vmstat 15 gives something like this:                kthr      memory            page            disk          faults      cpu      r b w   swap  free  re  mf pi po fr de sr s0 s1 s4 sd   in   sy   cs us sy id      0 0 0 32531400 105702272 317 1052 126 0 0 0 0 13 13 -0 8 9602 107680 10964 1 1 98      0 0 0 15053368 95930224 411 2323 0 0 0 0 0 0  0  0  0 23207 47679 29958 3 2 95      0 0 0 14498568 95801960 3072 3583 0 2 2 0 0 3 3  0 21 22648 66367 28587 4 4 92      0 0 0 14343008 95656752 3080 2857 0 0 0 0 0 3 3  0 18 22338 44374 29085 3 4 94      0 0 0 14646016 95485472 1726 3306 0 0 0 0 0 0 0  0  0 24702 47499 33034 3 3 94      I understand that the CPU is mostly idle, no processes are waiting in the queue to be executed, little swapping is happening. Running iostat 15 gives this:                  tty        sd0           sd1           sd4           ssd0           cpu      tin tout kps tps serv  kps tps serv  kps tps serv  kps tps serv   us sy wt id        0  676 324  13    8  322  13    8    0   0    0  159   8    0    1  1  0 98        1 1385   0   0    0    0   0    0    0   0    0    0   0    0    3  4  0 94        0  584  89   6   24   89   6   25    0   0    0  332  19    0    2  1  0 97        0  296   0   0    0    0   0    0    0   0    0    0   0    0    2  2  0 97        1 1290  43   5   24   43   5   22    0   0    0  297  20    1    3  3  0 94      Running netstat -i 15 gives the following:                   input   aggr26    output       input  (Total)    output     packets errs  packets errs  colls  packets errs  packets errs  colls     1500233798 0     1489316495 0     0      3608008314 0     3586173708 0     0     10646   0     10234   0     0      26206   0     25382   0     0     11227   0     10670   0     0      28562   0     27448   0     0     10353   0     9998    0     0      29117   0     28418   0     0     11443   0     12003   0     0      30385   0     31494   0     0      Running swap -l gives this:               swapfile             dev  swaplo blocks   free     /dev/swap           4294967295,4294967295     16 4194288 1000656      Running swap -s gives this:               total: 102575560k bytes allocated + 11141528k reserved = 113717088k used, 6692864k available      What am I missing? Thanks a lot for your help!


solaris + vxprint + mirror for rootvol & rootdisk7vol not exist

I run the vxprint -g rootdg on my Solaris machine (HW- NETRA T2000) As we see here - rootvol & rootdisk7vol has missing lines (swapvol is OK) How to fix the rootvol & rootdisk7vol in order to bring the missing lines as we see then in swapvol ?                 vxprint -g rootdg       TY NAME         ASSOC        KSTATE   LENGTH   PLOFFS   STATE    TUTIL0  PUTIL0       dg rootdg       rootdg       -        -        -        -        -       -            dm rootdisk     c0t1d0s2     -        286617216 -       -        -       -       dm rootmirror   c0t3d0s2     -        286617216 -       -        -       -            v  rootdisk7vol gen          ENABLED  122112   -        ACTIVE   -       -       pl rootdisk7vol-01 rootdisk7vol ENABLED 122112 -        ACTIVE   -       -       sd rootdisk-03  rootdisk7vol-01 ENABLED 122112 0        -        -       -                 v  rootvol      root         ENABLED  253016064 -       ACTIVE   -       -       pl rootvol-01   rootvol      ENABLED  253016064 -       ACTIVE   -       -       sd rootdisk-02  rootvol-01   ENABLED  253016064 0       -        -       -                 v  swapvol      swap         ENABLED  33479040 -        ACTIVE   -       -       pl swapvol-01   swapvol      ENABLED  33479040 -        ACTIVE   -       -       sd rootdisk-01  swapvol-01   ENABLED  33479040 0        -        -       -       pl swapvol-02   swapvol      ENABLED  33479040 -        ACTIVE   -       -       sd rootmirror-01 swapvol-02  ENABLED  33479040 0        -


How to stop network mount for a specific logical interface definition?

I am running Debian with two logical interface definitions in `/etc/network/interfaces`.               iface switched inet dhcp     iface crossover inet static      In `/etc/fastab` I have a CIFS mount definition, which gets mounted automatically when the network comes up. This is fine for the `switched` network but not ok for the `crossover` network. I can add the `noauto` option in the `fstab` file but with will stop any automatic network mount, even for the `switched` network. How to enable the CIFS mount for the `switched` network while disabling it for the `crossover` network?


Make Nautilus navigate to the first file beginning with the typed letter

When I hit `N` in Nautilus under a folder, it behaves like I am searching files which contains `N`. Can I make it so that it only leads me to the first file whose name starts with `N`, like Windows Explorer?


sendmail not working

I have a website where mails are sent. Those mails from website (contact mail, booking mail) are being sent well. But when I go to shell with ssh and give `sendmail myemail@mail.com` it is not sending. the error log in `/var/log/mail` says:               did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA      some time ago, i had a problem with permission, i changed without knowing the permission of `/etc/` folder, then later i did `chmod 755 /etc/` then everything seemed to work properly. but now, i am getting this error. server os is openSuse. what can I do?


OpenOffice overlapping text in inputs

When I start Writer, for example font type input looks as below ![font type input](http://i.stack.imgur.com/UMY70.png) Then I change type to any other and instead replaced, text is overlapped. ![font type input after changing type](http://i.stack.imgur.com/HAuM5.png) The problem occurred on all inputs and in all programs (Calc, Impress etc.) I have Fedora 20 with Gnome 3. How can I fix it?


Using regex in ls and mv

I have a directory structure like this               ├── UK     │   ├── BuyBand_go_UK.png     │   ├── BuyBand_go_UK.svg     │   ├── BuyBand_K.png     │   ├── BuyBand_K.svg     │   ├── BuyBago_UK.png     │   ├── BuyBago_UK.svg     │   ├── BuyBand_ch_Logo_UK.png     │   └── BuyBand_ch_Logo_UK.svg     └── US         ├── BuyBand_go_US.png         ├── BuyBand_go_US.svg         ├── BuyBand_S.png         ├── BuyBand_S.svg         ├── BuyBago_UK.png         ├── BuyBago_UK.svg         ├── BuyBand_ch_Logo_US.png         └── BuyBand_ch_Logo_US.svg      How can I move all files in bot `UK` and `US` directory in parent directory in one command? This is what I've tried:                  mv (US|UK)/* .