Conflict? dpkg, apt, apt-get, aptitude, and synaptic

So, I ssh into a (very) remote Ubuntu 10.4 server to do some admin and web dev+design. And I was looking through the various package manager options. There's a **lot.** The big ones are dpkg, apt, apt-get, aptitude, and synaptic. I don’t remember where I got the idea, but I seem to remember that each of these is basically building on top of its predecessors, so I kind of assumed that if I do some stuff in one tool, then do some more stuff in another tool, it wouldn’t cause any conflicts. (And I haven’t noticed any so far.) But then I saw some dotfiles/dot-directories in my home directory and started to think more about it. Are these just storing configuration information for each tool’s “front end”? Or are they all tracking package management activities separately? Separate would be bad. ☺ Is this safe?


How to set the TMOUT in Putty

I'm working in Linux. My connection to PuTTY times out very quickly and I need to have it remain active as long as I wish. I set the `TMOUT` in my Linux `.profile` but that has not seemed to make any difference. How do I set `TMOUT` or whatever for PuTTY?


Reinstalling all Debian packages

I killed by mistake a dpkg process running in the background and I would like to reinstall all packages to be sure everything is allright. First, I tried to get a list of all packages and reinstall them               dpkg --get-selections | grep -v deinstall | awk '{print $1}' > list.log     apt-get install --reinstall $(cat list.log)      But there are messages like :               E: Couldn't configure pre-depend debconf:i386 for console-setup:i386, probably a dependency cycle.      I tried `apt-get -f install`, without success. As a last resort, I reinstalled all programs which failed the checksums :               dpkg -l | grep ^ii | awk '{ print $2 }' | xargs debsums -s -a      What should I do to reinstall everything ? **Edit :** Problem solved. The issue was something else (see the comments). I understand it's something to avoid with Debian though.


how to get network QoS statistics in linux kernel?

Is there a way to get the bandwidth, delay, jitter collision, error rate and loss rate of a certain link through the interface on a local machine? let's say my machine is connected to a network via two interfaces, one wireless and the other ethernet. I want to compare the quality of these two links through these measurements. Is there any way to get these measurements in the Linux kernel? (v. 3.5.0)


Is there any other way to restrict USB storage?

I have been using `/etc/modprobe.d/blacklist.conf` to restrict USB storage but all employees are given root permissions, so they are removing restriction very easily. What I'm looking for is is there any other way to restrict USB storage usage (which is more hard to undo)? I'm using ubuntu12.04 LTS.


&> redirection not working correctly

Please see the following shell transcript:               $ ls     input.txt  test-amp-gt.sh  test-both-2.sh  test-both.sh  test-gt.sh          $ cat input.txt     input file          $ cat test-gt.sh     #! /bin/sh     cat input.txt > /dev/null && echo "DEBUG >"          $ ./test-gt.sh     DEBUG >          $ cat test-amp-gt.sh     #! /bin/sh     cat input.txt &> /dev/null && echo "DEBUG &>"          $ ./test-amp-gt.sh     DEBUG &>     $ input file     ^C     $               $ cat test-both.sh     #! /bin/sh     cat input.txt > /dev/null && echo "DEBUG >"     echo "***"     cat input.txt &> /dev/null && echo "DEBUG &>"          $ ./test-both.sh     DEBUG >     ***     DEBUG &>     $ input file     ^C     $          $ cat test-both-2.sh     #! /bin/sh     cat input.txt &> /dev/null && echo "DEBUG &>"     echo "***"     cat input.txt > /dev/null && echo "DEBUG >"          $ ./test-both-2.sh     DEBUG &>     ***     input file     DEBUG >     $      It was not clear to me as to why the redirect &> to /dev/null is apparently not working properly when the plain > is working fine. That is, in running test-amp-gt.sh, the contents of the text file should not have been output but they are. test-both-2.sh shows an even more curious behaviour of the &> -- the text should not have been output at all, but not only is it being output, but it is output _after_ the output of the echo command on the next line! Why is this?


Socksify like program for Fedora?

I need a program that allows me to pass an application through a socks server, even if the program does not have native socks support. Under Ubuntu I can use socksify for this. What can I use under Fedora?      Thank you!


System beep not working in TigerVNC

I just upgraded my Gentoo Linux computer (where I'm running Xvnc from TigerVNC 1.0.90 (1.1 beta 1) compiled myself against xorg-server 1.9.5), and I'm no longer getting any bell sounds, just silence. (In particular, when I hit Ctrl-G in Emacs.) This used to work before the upgrades. (I upgraded quite a lot of things, unfortunately, so I'm not really sure which one caused it.) I double-checked my viewer settings, and "Beep when requested" is checked. I do get beeps when they're generated by a program on my local computer, so it must be the server that isn't sending beep requests. How can I fix this?


Command substitution in Shell Script

511@ubuntu:~/Unix$ cat pass          hellounix     file1          #!/usr/bin     echo "Enter File Name"     read file     if [ -f $file ]      then         echo "File Found with a Name $file\n"         echo "File Content as below\n"         count=0         val=0         while read line             do             val=$("$line" | wc -c)             echo "$line -->Containd $val Charecter"                     count=$((count+1))             done < $file         echo "Total Line in File : $count"     else          echo "File Not Found check other file using running script"     fi      Output :               511@ubuntu:~/Unix$ sh digitmismatch.sh     Enter File Name     pass     File Found with a Name pass          File Content as below          digitmismatch.sh: 1: digitmismatch.sh: hellounix: **not found**     hellounix -->Containd 0 Charecter     digitmismatch.sh: 1: digitmismatch.sh: file1: **not found**     file1 -->Containd 0 Charecter     Total Line in File : 2     ==============================================================      Can anyone help me find out why the value of `wc -c` is not assigned to the variable `val`. If possible please share some good links for the same.


How can I automatically restart gnome-shell coming out of suspend mode?

So, due to an issue with gnome-power-manager, gnome-shell, and my nvidia card, I'm left in the awkward position of coming out of suspension/sleep with my graphics broken. This problem resolves itself if I'm able to use the Alt + F2 command line to restart gnome-shell. However, sometimes, I'm unable to actually access that menu, and I have to do it blindly with the broken graphics. Rather than switching to the power-eating nouveau drivers, I thought I'd just try to replicate the functionality of               r      or               restart      in the Alt + F2 menu in a script and have it execute upon recovering from suspend. Any advice/ideas? I don't really know where to start. (Alternately, if you've got another workaround/solution..?) edit: these guys are discussing the same problem: https://bbs.archlinux.org/viewtopic.php?pid=932527


How to use a defined local IP instead of external one

I have a Gentoo Linux server. Server is connected to two networks: internal and external.               Internal network ip: 192.168.1.200     External network ip: 192.168.0.2      If I'm trying to make request from server to itself, it uses external network IP. Connecting to nginx using Wget gives me this log record:               server ~ # tail -n 1 /var/log/nginx/error_log     192.168.0.2 - - [27/Aug/2014:19:04:42 +0300] "GET / HTTP/1.1" 200 5 "-" "Wget/1.14 (linux-gnu)"      Despite that I connecting directly to 192.168.1.200:               server ~ # wget http://192.168.1.200/      Routing table (metric is higher on external network, but seems ignored): **ip route show**               server ~ # ip route     192.168.0.0/30 dev wan  scope link  metric 20      192.168.1.0/24 dev lan  scope link  metric 10       **ip route get** :               server ~ # ip route get 192.168.1.200     local 192.168.1.200 dev lo  src 192.168.1.200          cache <local>       How can I get this machine to connect using 192.168.1.200 to itself, instead of 192.168.0.2?


Some keys on keyboard map to numbers instead

I'm running Leenux 5.1 from a USB stick using unetbootin. It works ok, except my keyboard is messed up -- pressing `k` results in a `2` instead (the `2` key also types a `2`). How could this happen?


Prompt for sudo password and programmatically elevate privilege in bash script?

I'm currently working on a bash script that installs and sets up various programs on a stock Linux system (currently, Ubuntu). Because it installs programs and copies a number of files to various folders that require elevated privileges, I've already done the standard "I need elevated privileges"-and- exit. However, I would like, if possible, to be able to prompt the user for their sudo password and elevate the script's privileges automatically if the user doesn't run the script command with sudo (such as launching it from the GUI file manager), without the user having to restart the script. As this is designed to run on stock Linux installs, any option that modifies the system won't work for my purposes. All options need to be contained to the script itself. Is this possible within Bash? If so, what's the best (secure, yet concise) way to do this?


Checking & Installing files in yum

I'm a beginner picking up RHEL... To check if some packages are present , i will type :               yum check <packages_name>      And then install by typing               yum install <packages_name>      Is there a way/cmd to check the files & install only those that are present ?


More sophisticated file command for deep inspection?

Sometimes it seems that the standard `file` command (5.04 on my Ubuntu system) is not sophisticated enough (or I am just using it wrong, which could well be). For example when I run it on an `.exe` file, and I am quite positive that it contains some archive, I would expect output like this:               $ improved-file foo.exe     foo.exe: PE32 executable for MS Windows (GUI) Intel 80386 32-bit              .zip archive included (just use unzip to extract)      Other issues:   * It doesn't detect concatenations of different formats   * It doesn't detect common file formats, e.g. .epub, which is just a .zip container with some standardized .xml files etc. inside (`file` displays 'data') An example of such a .exe file containing an archive - I guessed some archive- formats and tried the corresponding unpack-commands with a trial'n'error approach - which worked in the end - but I would rather prefer a more auto- inspection oriented workflow.


change entire directory tree to lower-case names

I'm working on a website conversion. The files as they were linked and served from the web server were case insensitive. But, I've made a dump of the site on my linux system and I'm writing scripts to migrate data. The problem is that I'm running into case sensitivity problems between link strings in the pages and the actual word case on the file system. For instance, a page might have a link like `<a href='/subfolder/PageName.asp'>` while the actual file is `/subfolder/pagename.asp`. Likewise with images -- `<img src='spacer_sm.gif'>` might be `Spacer_Sm.gif`. So my thought is to change all directory and filenames to their lower-case equivalents for the site download. How do I do this (and might there be a better way?) Even if there are unix commands that have case-insensitve switches, I'm using php, so not all of the filesystem commands there have options for case sensitivity.


Disable loading of Touchpad

I am currently trying to fix an Advent 4211 Netbook (a rebranded MSI Wind) - and whenever I use the touchpad the mouse (even an external USB mouse) stops working - when I run xev it does not register any mouse events. I wanted to prevent the system from loading a driver for the touchpad or disable it all together - is there a way to do this? I just want to be able to 'touch' the touchpad without breaking my external mouse as well. The running distro is open suse 11.04 lxde.


Sleep until next occurrence of specific time

I need a series of commands or a single command that sleeps until the next occurrence of a specific time like "4:00" occurs. How would I do that? The `at` command or a cronjob is not a option because I must not leave the script I'm currently in. The specific case I am talking about is a script running in screen. It is very important that I do not stop the execution of the script by the script itself because there are store many important variables which are needed at some point of the script. The script is not always supposed to be executed in a regular matter. It just needs to be executed at a specific time. It would be very benificial if the script would have to create any files or any other tasks such as cronjobs or other screens. This is simply a question of design. I just had an awsome idea:               difference=$(($(date -d "4:00" +%s) - $(date +%s)))          if [ $difference -lt 0 ]     then         sleep $((86400 + difference))     else         sleep $difference     fi      Do you have any better ideas? _More information will be added if requested!_


Scripting `rm` and `rm -i`

I want to create a script that whenever there are more than three files being removed, it invokes `rm -i` by default. I know it will go in initialization files but can't seem to get it working. So far:               if [$file -ge 3]; then       rm -i        exit 0      else       rm     exit 1


Running program as root without using sudo with normal user account

Is there a way to force to run program as root (with normal user) when there's no sudo on the machine (and can't be added)?


Debian linux installation cannot play sound

I am trying to get my Linux installation to play musix. I have debian linux. The contents of /etc/debian_version are: 6.0.2 I cannot seem to get any sound to play from my speakers and after looking through forum postings, I have hit a brick wall. lspci | grep Audio gives the following:               02:00.0 PCI bridge: Creative Labs [SB X-Fi Xtreme Audio] CA0110-IBG PCI to PCIe Bridge     03:00.0 Audio device: Creative Labs [SB X-Fi Xtreme Audio] CA0110-IBG     0a:00.1 Audio device: ATI Technologies Inc Cypress HDMI Audio [Radeon HD 5800 Series]      When I attempt to run the speaker-test command I the following error:               Playback open error: -16,Device or resource busy      So I look for the process which might be blocking the soundcard: lsof | grep snd (command taken from some forum). Once the process has been killed, I get the following error:               Write error: -5,Input/output error     xrun_recovery failed: -5,Input/output error     Transfer failed: Operation not permitted      I dont know what else to do. Can anyone guide me in the correct direction? Much appreciated


What's the easiest way to make a list of most common words in a list?

Say I have a bunch of textfiles containing fiction, non-fiction, newspaper articles, &c (random examples of text in a given language.) I want a frequency list of the given words, most common word first. I could write some C code to do this, but if there's a faster way to do this, I'd like to know it. (When I say faster, I mean coding time, not run time.)


Split an existing prompt command line in a few lines

I understand I can type `\` `enter` at the end of a `bash` command line to continue that command in another line. But how can I split a **prompt** command line — that has already been fully typed — into two? For example, how can I break this line right before `then` without having to cut the remainder off and type it all over again?               $ if true; then ls; fi


How to put isolinux on an sd card

Hey I need to put the isolinux bootloader on an sd card but how do I properly do that?


Using USB 3 controller with Linux 2.6.x

I have a laptop that has an USB controller and an SD card which I believe connected to USB3. I need to do some development on a Linux version 2.6 which doesn't support USB3. Can I use USB 3 controller in USB 2 mode? I am not interested in supporting USB 3 on my linux, just be able to read/write to my SD card (or any Flash drive) using my Linux system. I am using Linux in a virtual environment.


Rsync --bwlimit not working

I am currently using rsync to transfert large file from a host to another. I would like to limit the debit for this transfert. After reading the man page I found the option --bwlimit which is expecting a KB/s value. I want to limit the transfert to arround 100Mbit/s So I used the following settings :               rsync --progress -v --bwlimit=10000 --temp-dir=/tmp srv:/tmp/* /tmp/      But this doesn't seems to be respected according to the output of rsync :               file.sql.gz        570851702 100%   33.90MB/s    0:00:16 (xfer#5, to-check=34/39)     file.sql.gz         11195140 100%    7.45MB/s    0:00:01 (xfer#6, to-check=33/39)     file.sql.gz         51439169 100%   19.41MB/s    0:00:02 (xfer#7, to-check=32/39)     file.sql.gz            34022 100%    1.55MB/s    0:00:00 (xfer#8, to-check=31/39)     file.sql.gz          2305698 100%    6.96MB/s    0:00:00 (xfer#9, to-check=30/39)     file.sql.gz          2152942 100%    2.73MB/s    0:00:00 (xfer#10, to-check=29/39)     file.sql.gz         86655633 100%   19.33MB/s    0:00:04 (xfer#11, to-check=28/39)     file.sql.gz       3614476032  40%   34.82MB/s    0:02:28      If I'm not wrong : 19.33MB/s ~= 154Mbit/s So what is wrong here ? PS : rsync version 3.0.6 protocol version 30 Thanks for your help !


No make target "uImage" with Buildroot 2013.05

After enabling Linux Kernel option and setting the Kernel binary format to uImage, I always get the following error: make[1]: _*_ No rule to make target `uImage'. Stop. My buildroot configuration is almost the default one. Any idea why it doesn't work anymore? (in an older revision it worked without errors)


Elegantly get list of descendant processes

I would like to get a list of all the processes that descend (e.g. children, grand-children, etc) from $pid. This is the simplest way I've come up with: `pstree -p $pid | tr "\n" " " |sed "s/[^0-9]/ /g" |sed "s/\s\s*/ /g"` Is there any command, or any simpler way to get the full list of _all_ descendant processes? Thanks!


How to reset password on an encrypted fs?

I've got a laptop which I haven't used since the last summer vacation: I did put Debian 7 on it and used Debian's feature to fully encrypt the disk, besides a tiny bootloader (or a tiny partition) I guess (not too sure which encryption this is nor how to find out). I _do_ know the password of the encrypted filesystem so the system boots, but I'm stuck the login prompt: I did forgot my password(s). Seen that I know the password of the encrypted filesystem, I take it I can boot from a Live CD (or even maybe from the Debian install CD?) and somehow "mount" the encrypted partition. If that's the case, can someone explain me how to do this? (knowing that I've never mounted an encrypted partition / filesystem manually)


Help writing bash function as one-line alias

How do I write this as an alias?               p() {         DIR=~/projects/$@         pushd "$DIR"     }      This is as far as I got, but it's piping stdin to pushd instead of xargs:               alias p="xargs printf ~/projects/%s | pushd"      It's probably better as a function, but I feel like I would learn something by knowing how to write it on one line and get the piping correct. Thanks!


Timer in bash script not accurate when using it with longer times

#!/bin/bash          # get user input     ZENITY1=$(zenity --entry --text '  1m:    60s\n  5m:   300s\n10m:   600s\n15m:   900s\n20m: 1200s\n25m: 1500s\n30m: 1800s\n35m: 2100s\n40m: 2400s\n45m: 2700s\n50m: 3000s\n55m: 3300s\n   1h: 3600s' --entry-text "Input only int in seconds!" --title "Timer")          # put starting date in variable     STARTTIME=$(date)          # audit/check user input     WAITINGTIME=$(echo $ZENITY1 | egrep "[0-9]{1,}" -o)     if [ "$WAITINGTIME" == "" ]; then exit 1; fi          # main stopwatch     for i in `seq $WAITINGTIME -1 1`; do echo $i | osd_cat -A left -p top -i 100 -c black -d 1; done          # time expired message     zenity --info --text="Time expired@\n$(date)\n\nStarted@\n$STARTTIME"      So this is the script that I have on my desktop. If I need to warn somebody for e.x.: "please warn me after 15 minutes". But if I use it in a longer time, e.x.: 12 hours it's not very accurate! it could get ~10 minutes difference to the real time... :\ Why is it?


IO and other shell commands when a program is not started by a terminal

I have several launchers on my desktop for various programs, and there is a "run in a terminal" setting for those launchers. When I check that setting, the program runs from a terminal, and logs its output there. I suppose that it could read `stdin` from the terminal too. However: what happens to IO when the program is not ran by a terminal? **Also, what happens when I execute system (shell) commands from a program like that?** Is there a "background" shell that runs those programs? Or does every program get its shell through which it interfaces with the rest of the system?


Apache install on Debian: configuring CGI

I installed CGI via the package manager and enabled the mod, but two hours later I still cant get it to work. My `/etc/apache2/sites-available/default` is:               <VirtualHost *:80>         ServerAdmin webmaster@localhost              DocumentRoot /var/www         <Directory />             Options FollowSymLinks             AllowOverride None         </Directory>         <Directory /var/www/>             Options Indexes FollowSymLinks MultiViews             AllowOverride None             Order allow,deny             allow from all         </Directory>              <IfModule mod_alias.c>             ScriptAlias /cgi-bin/ /var/www/cgi-bin/                  <Directory /var/www/cgi-bin/>                 AllowOverride None                 Options ExecCGI -MultiViews +SymLinksIfOwnerMatch                 Order allow,deny                 Allow from all             </Directory>         </IfModule>              ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/          <Directory "/usr/lib/cgi-bin">             AllowOverride None             Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch             Order allow,deny             Allow from all         </Directory>              ErrorLog ${APACHE_LOG_DIR}/error.log              # Possible values include: debug, info, notice, warn, error, crit,         # alert, emerg.         LogLevel warn              CustomLog ${APACHE_LOG_DIR}/access.log combined          </VirtualHost> CGI is enabled. When I browse to `mydomain.com/cgi-bin/` it goes to `/usr/lib/cgi` (I believe) instead.               root@zeus:~# a2enmod cgi     Module cgi already enabled     root@zeus:~# apt-get install php5-cgi     Reading package lists... Done     Building dependency tree     Reading state information... Done     php5-cgi is already the newest version.     0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.     root@zeus:~# sudo service apache2 restart     [....] Restarting web server: apache2[Wed Apr 23 20:20:28 2014] [warn] The ScriptAlias directive in /etc/apache2/sites-enabled/000-default at line 29 will probably never match because it overlaps an earlier ScriptAlias.     apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName     ... waiting [Wed Apr 23 20:20:29 2014] [warn] The ScriptAlias directive in /etc/apache2/sites-enabled/000-default at line 29 will probably never match because it overlaps an earlier ScriptAlias.     apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName     . ok


How many packages does RHEL 6 provide?

I'd like to know how many binary and source packages Red Hat provides with their current RHEL 6.4 Release.


What audited server programs are shipped in a default OpenBSD install?

OpenBSD has a process by which they audit programs by doing a "comprehensive file-by-file analysis of every critical software component". Which OpenBSD programs have been audited? Is there a list? I know `httpd`, `ftpd`, and `sshd` have been audited, but I can't find a comprehensive list


How to install GTK3 in Centos 6.2

I have Centos 6.2 and I want to install GTK3 to be able to install gitg. I looked up on Google, and couldn't find anything useful. The thing is people suggest I need to install GTK3 by manually compiling it. But there is a big list of dependencies (and these dependencies also have dependencies I need to mess with, which is a PITA). Any better suggestions/ideas?


Install a .deb completely 'by hand'

So, I recently acquired a brand new Nokia N900 phone off of an online auction site for a fairly reasonable price. The N900 is a Linux phone, and it came out a long time ago, but it's only just now within my budget. I've spent the past day struggling with it. Its version of `apt` is particularly frustrating. The point I'm at now is, I can't get `dpkg` to properly configure a package because of how some guy at Nokia decided the phone shouldn't have any files whatsoever in `/usr/share/doc`. Apparently. And the `\--configure` of this particular package demands that a file be put into `/usr/share/doc` and then "optified", which is a Nokia Linux term I don't really understand, but seems mainly to have to do with treating `/opt/maemo` as if it were the root directory when it comes to certain types of files. Needless to say, this documentation can not be "optified"... I don't really care why, I just want to be able to:   * Decompress the `.deb` file myself.   * Look at the script that tells `dpkg` where to put things.   * _Modify the script and/or move those files around myself._   * Do whatever else is necessary so that the right files are in the right place, _myself_.   * _Inform the list of packages that this package has been 'installed'._   * Get on with my life, knowing a lot more about `.deb`s than I currently do.


Why is my X11 app's save dialogue suddenly defaulting to "Recently Saved" in Places sidebar?

I make a lot of text files using a basic text editor (in the F15 with Xfce DE I use Leaf). Recently the save dialogue is defaulting the "Places" sidebar to "Recently Used" where before it was always my home directory. This adds an extra step to my routines, because you can't save to "Places". And for the same reason the change is obvious, real, and aggravating.


Impossible to log out from OpenSuSE's KDE menu

I'm running OpenSuSE 12.1 with the KDE desktop on a test machine. The "logout" menu entry in the KDE menu does not seem to do anything. I am not aware of changing any KDE settings that might be relevant. How can I find out the cause of this behaviour, and how can I remedy it?


Simple feed aggregation server

I’m looking for a program that runs as daemon, downloads Atom and RSS feeds at least every minute, and provides a paginated Atom feed of all entries of all feeds through a simple HTTP server. It should also retain deleted entries. A useful extra would be to be able to label feeds, as in Google Reader, so that each label gets its own aggregate feed. If you don’t know of such a program or know that it probably doesn’t exist, please let me know if you think there are any principle hurdles, because if not, I would queue it up as a project of my own. The use cases are similar to that of services like Google Reader. I follow a larger number of RSS and Atom feeds and want to avoid having to regularly synchronize the list between multiple computers and my smartphone. On my smartphone, I also want to save traffic. In addition to those use cases, I need a high update rate, so I can react in a timely fashion, and to catch entries that are quickly deleted again, and I don’t want to have to leave one of my computers running non-stop either.


Cleaning log files under linux

I am using a kvm ubuntu 10.04 virtual machine to test some features of a kernel module. I grep through the `/var/log` files to observe the kernel messages about that module. To start from a clean state, I remove log files containing older messages by executing `rm -rf /var/log/*` and then rebooting the virtual machine. However, after I reboot, the new log files still contain those old log messages. It takes about 5-6 cycles of deleting files and rebooting virtual machine to finally get rid of those log file messages. Why is this happening? Is there an easier way to cleanup log files?


Create Zip for each subfolder but containing only matched files

I am trying to figure out how to create a zip file for each subfolder containing only files that match my criteria. For instance I have:               Folder1     Folder2     Folder3      Each folder contains the same set of files but the filenames in each are slightly different, but the extensions are always the same. I would like to zip the .shp, .shx, .qpj, .prj and .dbf in each folder. Each folder would be its own zip file. I would rather not store the actual folder name other than as the name of the zip file. I have tried:               find . -type d | xargs -I {} zip -r {}.zip {}      This creates each zip file but would zip every file not just the ones with the extensions I would like, it also stores the folder name in the zip.               find . -type d | xargs -I {} zip -r {}.zip {}'/'*.shp {}'/'*.shx {}'/'*.dbf {}'/'*.prj {}'/'*.qpj       The above does nothing other than gives errors that there is nothing to do. Hopefully my poor attempts give a better idea of what I'm trying to do. Any help appreciated.


Is there any way to test out PS1 Bash Prompts before committing them?

I'd like to mess with my Bash prompt, but I'd like to do so in a way that doesn't corrupt my already extant one. I could just comment it out, but is there a way to test it either with an online tool or a CLI tool?


Unzipping certain archives works on Windows but not on Linux

I've asked a few people and just thought about asking it here. We get sent files from an international company for design work in a zip format. Well when I run a script to unzip the files in the terminal, I receive a zip error **only** in Linux. We can test, unzip, browse, and modify the files with 7zip and winzip all day. When 7zip or Winzip is ran they do not indicate any security, too. Terminal error:               compressed WinNT security missing (-7 bytes)      I've searched everywhere and find no solution or correction on this. One collegue suggested, > "using a different language version of Unzip could potentially change the > Unicode required to extract the file. Think of it like a password, without > the right code, you can't get in." **Why in the Ubuntu terminal will unzip display an error?**


Free space: 0 bytes and files full of data shown as empty

I don't know what's going on. The last evening I left my computer with about 700MB of free space on the system partition and today there is no free space on disk, moreover a lot of files containing data is, according to system, 0 bytes, but actually files are full of right data like text (and they have the icon of blank document). After deleting some files I can see no changes - still no free space. These files were deleted permanently and were not used during deleting. Yesterday I did command `sync` once and for the first time ever. Today I also did following as root: `sync; sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches'`. It looks like it's something wrong with partition or actually file system. There was no rebooting the system for a long time and this is in my case the last thing I would like to do now. Moreover, I noticed that I've got no command history in terminal - the file `.bash_history` is empty. Is this because of dropping cache or my disk is broken down? If the first, what else was cleared among noticeable things like the bash history? Yesterday I used to make the disk working hard due to some actions like file serching and things alike but after that untill the evening everything was fine. One more annoying thing I noticed was working process called `update-apt- xapian-index-dbus` which is still in background but it's sleeping now (I couldn't kill it, it comes back everytime I try so). I see no other errors - the system is still working and it's stable. I'd like to know what is happening with my system... Do you have any suggestion? How to diagnose it? How to display real free space and sizes of files? Is a reboot necessary? Edit: One thing else is that key strokes like Shift+Del are not working. And I was trying to find files created during the night, but `find / -ctime=0` shows then also older files, same for `-mtime`. I frgot to mention that I use Ubuntu. **EDIT: I just found the file called `.xsession-errors` and it's about 650MB, so maybe it's the space I lost (it maches), it's accessed and modified today one hour ago, but I can't say (and check) when it's created. How about this? Next to that file is `.xsession-errors.old` modified in the day of last reboot and it's under 0,5MB. Did I just find my "free space"? And command `sync` can be a cause of problem with partition? I read so somewhere, but really can it?** Edit: I opened the file `.xsession-errors` and what can I see inside is some true errors with description about displaying windows and thousands of lines with `Illegal character <2e> in hex string` and millions lines with `Write error: Unknow error`. I guess it was writing till free space on disk was available. The character is not always <2e> but it repeats the most often.


Linux: Current correct/recommended use of games-group?

What is currently considered the correct/recommended/best-practice use of the games-group...   * As a "device group" for game-ports and joy-sticks, unassociated with the games-user (except for being one of the many groups the game-user probably would have to belong to) and with a (very) different GID than UID of the games-user...   * Or as a "pair" together with the games-user – preferably with matching UID and GID – where the group lists users allowed to execute programs belonging to the games-user. This to limit what user is allowed to enjoy themselves. Are there alternatives? Other names you've seen or think would work for a group for game-ports and joy-stick devices; for a group of users allowed to play; and/or user for running games as? (e.g. 'rec' for recreational) Do you think this could be a good idea or does it break tradition too much? I'm toying with the idea of building/customizing my own distro, so I'm not encumbered with how other distros do it or what's most common... I'm more asking for what you've seen, what you've tried and what you think would work best. I'm also interested for such experiences from users of other Unices too, after all most of them don't break down their devices quite as much as Linux does... Do they still have a games-group? How and for what is it used?


How can I check if a file is being downloaded?

I have a Raspberry Pi which I want to use to automate downloads to a network drive. I would like to restart the machine on a regular basis using `cron` (I've heard they're not the most stable of things) but obviously, I would prefer not to restart it half way through an incomplete download. I'll probably be downloading using several different methods but one of the ways I'll be using soon is get_iplayer and probably basic `wget` stuff too. Is there a way I can check if one is in progress? Any advice appreciated.


Is there a structured format of version info for OS-level executables?

I am looking for a structured format of version info for OS-level executables, such as in `/usr/bin` and `/usr/local/bin`. The problem we are having is the inconsistent architecture between our PROD and TEST environments and we are finding that many executables in our lower environments have had patches applied whereas PROD has not, which invalidates a lot of testing -- stuff works in TEST but doesn't in PROD because of such system discrepancies. So I would like to run a system assurance check to list all executables and get the version number but nothing else and then produce deltas. Some commands don't support the `-version` option but even those that do display very verbose, free-text format of a version narrative and the version number is buried somewhere within, with no way to extract it programmatically. Alternatively, I was thinking to run a file-level `cksum` for every executable as an option of last resort but I was hoping that there would be a way to extract version info relevant fields programmatically. Thanks


Run a script on multiple shells?

I have two servers one AIX with default shell ksh, the other RHEL with default shell bash. I have a script that is mounted on both that will run similar commands but for either AIX or Linux. This script does not work on the bash servers, is there a way to make this script run on both bash and ksh, or would the best option be to create two different scripts?               #!/usr/bin/ksh     export OS=`uname -s`     echo "OS is "$OS"."     case $OS in             "AIX")                     #run AIX commands;;             "Linux")                     #run Linux commands;;             "*")                     echo "Exiting. The OS type is not found.";;     esac     echo "Done."     exit 0      **UPDATE** The commands I need to run are for user accounts on each server. An example of unlocking an account. AIX /usr/bin/chuser account_locked=false $USERNAME Linux /usr/bin/passwd -u $USERNAME Through further investigation I have found that the the shells location in AIX are located at /usr/bin/sh, while Redhat's are located at /bin/sh. Can I define the shebang based on the results of "uname"?


I'm only allowing pubkey auth via ssh. How can I still log in with password?

vi /etc/ssh/sshd_config     egrep -i 'Pubkey|Password|Listen' /etc/ssh/sshd_config | grep -v '^#'         ListenAddress 0.0.0.0         PermitRootLogin without-password         PubkeyAuthentication yes         PasswordAuthentication no      on an OpenBSD 5.1 server. But I can still login with FileZilla, and FileZilla only knows my password AFAIK (or not?). How can I restrict any ssh/scp/sftp access to only accept key auth? UPDATE: clinet side is a Scientific Linux 6.3, afaik the key is not cached.


How to ensure a process has started reading a file before continuing?

I'm trying to write a command to test that data is written to a file. My first approach was:   1. Start reading in the background.   2. Write some data to the file.   3. Wait for the reader to find a result.   4. Repeat indefinitely to see if there's a timing issue. In script form:               while true     do         grep -q foo <(tail -n0 -f /var/log/syslog) &         logger foo && logger line && wait     done      (the `logger line` command is to avoid `last message repeated N times` lines in the file) This version will typically loop a once or twice before getting stuck at the `wait` command, so it looks like `tail` didn't have time to start reading before `logger foo` had written to the file. What is the best way to **_guarantee_ that `tail` is reading before continuing**? These workarounds are not ideal:   * Pause before `logger` (won't work in the case of slow file systems)                  sleep 1 && logger foo && logger line && wait        * Start a second reader, and assume that the first one has started reading by the time the second has been shown to. This looped a few thousand times before getting stuck:                  grep -q foo <(tail -n0 -f /var/log/syslog) &         grep -q bar <(tail -n0 -f /var/log/syslog) &         while kill -0 $!         do             logger bar             logger line         done         logger foo && logger line && wait


How can I uniquely identify which device is on USB `hub 6-0:1.0: port 2`? I receive messages in my `dmesg` every now and then and I want the system to tell me which device is connected to that port. **EDIT:** OK, I can figure out which hub it is, but how can I figure out which device is on port 2 (out of four).               udevadm info -q all -p /sys/bus/usb/devices/6-0:1.0     P: /devices/pci0000:00/0000:00:1d.0/usb6/6-0:1.0     E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb6/6-0:1.0     E: DEVTYPE=usb_interface     E: DRIVER=hub     E: INTERFACE=9/0/0     E: MODALIAS=usb:v1D6Bp0001d0302dc09dsc00dp00ic09isc00ip00     E: PRODUCT=1d6b/1/302     E: SUBSYSTEM=usb     E: TYPE=9/0/0     E: UDEV_LOG=3


The myths about malware in unix/linux

Is it possible for my Linux box to become infected with a malware? I haven't heard of it happening to anyone I know, and I've heard quite a few times that it isn't possible. Is that true? If so, whats up with Linux Anti-Virus (security) software?


Is Linux really malware safe? Or people just don't bother creating them for Linux?

> **Possible Duplicate:**   >  The myths about viruses in unix/linux I've never used Linux before and I heard that you don't need to worry about malware on Linux. So, as the title said, is Linux really malware safe? Or do people just not bother creating them for Linux because Linux is not popular for standard end-users ?


delay to get password prompt when ssh'ing to a public server

i have a server (debian 7) setup in my university with public ip. when I ssh into the system (from outside the campus), I get a weird delay of 5-10 seconds before I get the password prompt. Why is that? I run `ssh -v` to get verbose output:               debug1: Roaming not allowed by server     debug1: SSH2_MSG_SERVICE_REQUEST sent     debug1: SSH2_MSG_SERVICE_ACCEPT received          .... delay of 5-10 seconds here          debug1: Authentications that can continue: publickey,password     debug1: Next authentication method: publickey     debug1: Trying private key: /home/nass/.ssh/id_rsa     debug1: Trying private key: /home/nass/.ssh/id_dsa     debug1: Trying private key: /home/nass/.ssh/id_ecdsa     debug1: Next authentication method: password      then I get the password prompt fine. my `resolv.conf` looks like               domain <mydomain>.edu     nameserver <dns ip address>      firewall is controlled by `webmin` , and the config `/etc/webmin/firewall/iptables.save` looks like:               # Generated by iptables-save v1.4.14 on Mon Feb 10 17:41:38 2014     *filter     :FORWARD DROP [0:0]     :IP_TCP - [0:0]     :INPUT DROP [0:0]     :IP_UDP - [0:0]     :OUTPUT ACCEPT [0:0]     :IP_ICMP - [0:0]     -A INPUT -i lo -j ACCEPT     -A INPUT -m state --state ESTABLISHED -j ACCEPT     -A INPUT -m state --state RELATED -j ACCEPT     -A INPUT -p tcp -m tcp --tcp-flags ACK ACK -j ACCEPT     -A INPUT -s 127.0.0.1/32 -i eth0 -j DROP     -A INPUT -p icmp -i eth0 -j IP_ICMP     -A INPUT -p udp -m udp -i eth0 -j IP_UDP     -A INPUT -p tcp -m tcp -i eth0 -j IP_TCP     -A INPUT -m limit --limit 3/second --limit-burst 3 -j ULOG --ulog-prefix "FW_INPUT: " --ulog-nlgroup 1     -A IP_ICMP -p icmp -m icmp --icmp-type 0 -j ACCEPT     -A IP_ICMP -p icmp -m icmp --icmp-type 3 -j ACCEPT     -A IP_ICMP -p icmp -m icmp --icmp-type 4 -j ACCEPT     -A IP_ICMP -p icmp -m icmp --icmp-type 11 -j ACCEPT     -A IP_ICMP -p icmp -m icmp --icmp-type 12 -j ACCEPT     -A IP_ICMP -p icmp -m icmp --icmp-type 8 -j ACCEPT     -A IP_ICMP -p icmp -j RETURN     -A IP_TCP -p tcp -m tcp --dport 2049:2050 -j DROP     -A IP_TCP -p tcp -m tcp --dport 6000:6063 -j DROP     -A IP_TCP -p tcp -m tcp --dport 7000:7010 -j DROP     -A IP_TCP -p tcp -m tcp --dport 19001 -j ACCEPT     -A IP_TCP -p tcp -m tcp --dport 12321 -j ACCEPT     -A IP_TCP -p tcp -m tcp --dport 80 -j ACCEPT     -A IP_TCP -p tcp -m tcp --dport 443 -j ACCEPT     -A IP_TCP -p tcp -m tcp -j RETURN     COMMIT     # Completed on Mon Feb 10 17:41:38 2014     # Generated by iptables-save v1.4.14 on Mon Feb 10 17:41:38 2014     *mangle     :PREROUTING ACCEPT [2386474:238877913]     :INPUT ACCEPT [2251067:225473866]     :FORWARD ACCEPT [0:0]     :OUTPUT ACCEPT [1100410:5416839301]     :POSTROUTING ACCEPT [1100428:5416842284]     COMMIT     # Completed on Mon Feb 10 17:41:38 2014     # Generated by iptables-save v1.4.14 on Mon Feb 10 17:41:38 2014     *nat     :PREROUTING ACCEPT [211832:26633302]     :INPUT ACCEPT [444:26827]     :OUTPUT ACCEPT [1817:114098]     :POSTROUTING ACCEPT [1817:114098]     COMMIT     # Completed on Mon Feb 10 17:41:38 2014      Last but not least, a colleague who also has an account on the same system gets the prompt immediately!


What's hotplug?

Many questions are tagged : hot-plug . However , No wiki found in : Tag info I've read this: > Modularized USB drivers are loaded by the generic /sbin/hotplug support in > the ker- nel, which is also used for other hotplug devices such as CardBus > cards. Therefore , Could we say that hotplug is the responsible on loading/unloading modules automatically ?


How to call a method of configuring the result of which is active until the first reboot?

For example, you can configure a network interface and other settings from the command line of your terminal. But you can also save the settings to the file `/etc/network/interfaces` (Debian GNU/Linux) or appropriate of NetworkManager. Another example, if you want to add a permanent entry to the ARP table of FreeBSD, you should execute the command:               # arp -S 192.168.0.1 01:23:45:ab:cd:ef      or add to `rc.conf` the following:               static_arp_pairs="gw"     static_arp_gw="192.168.0.1 01:23:45:ab:cd:ef"      Similar examples are numerous. The result takes effect immediately when you use the first method. With the second method, you must restart your system completely or only appropriate service. Is there a name for the first method as a single word or abbreviation? As far as I remember there is a more precise term and I stumbled on it somewhere.


Hotplug Device Driver Priority

Is it possible to have more than one driver for one purpose (eg. USB) included in the Linux kernel? If so, then how does the kernel decide which one to load?


Stream Media Content from Linux to PS3

I have a Linux system (Debian testing) with some video files I would like to play on my Playstation 3 (an original, unmodified PS3). I can connect the PS3 to my home network using either WLAN at 54Mbps, or using a 100MBit LAN, which is tunneled over power sockets using a pair of Devolo powerline adapters, operating at a speed of about 4 MB/s. I know that DLNA would be the way to go, I've tried several DLNA servers for Linux (fuppes, mediatomb, minidlna, xbmc). None of those worked reliably. Either no media appears, or if, then the files randomly stop after some minutes, and it's not possible to fast forward or reverse the videos. **Now the questions:**   * I'm not sure what is the problem with DLNA. Is it that I need more bandwith, or is DLNA a bad protocol, or is the implementation of those servers buggy or incompatible with the PS3?   * Are there other methods to connect devices **remotely** to my PS3? I have heared it's possible to tunnel USB devices other Ethernet using IP, but I haven't found anything of value using Google. Currently I'm using an USB stick for media playback, but this solution feels somewhat clumsy! **UPDATE:** Important thing I forgot to mention -- if I replace the PS3 with my work Laptop (Windows XP SP3) and mount the video share over the same Devolo Ethernet connection using samba, then video playback works flawlessly. **UPDATE 2:** It's been some time since I posted this question, but I've finally managed to connect my PS3 to my computer by means of a real Ethernet cable. Guess what? The problem persists, video playback pauses every 10 or 15 seconds for one second. I'm 99.9% sure it's not a problem with the network connection.I'm using PMS right now, and the transcode buffer is always full at 400MB, with bitrates around 1 - 2 Mb/s. Any other ideas what may be the problem? **PROBLEM SOLVED:** See my answer.


Linux Centos 5.5 yum update command is not working

I have done lots of things to update.   1. `yum clean all`   2. `yum clean metadata`   3. `yum clean dbcache` then `yum update` outputs:               http://mirror.centos.org/centos/5.6/addons/i386/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found Trying other mirror.          Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons. Please verify its path and try again      I have also tried   * setting `enabled=0` in `/etc/yum.repos.d/CentOS-Media.repo`   * `yum -v update --disablerepo=contrib uname -a`   * `touch /.autorelabel`   * `yum -v update --disablerepo=contrib` but it didn't help.


Call 'ps' as a normal user in Linux

A brief introduction to my question: the command `ps` will print the information of system processes. But when I login as **root** and change the permission `x` of `ps`               chmod -x /bin/ps     chmod u+x /bin/ps     ls -l /bin/ps      -rwxr--r-- 1 root root ...... ps      Then I create a new shell script file `call_ps_via_root.sh`               #!/bin/bash     ps      and set the `x` permission               chmod +x /bin/call_ps_via_root.sh     ls -l /bin/call_ps_via_root.sh     -rwxr-xr-x 1 root root ...... call_ps_via_root.sh      After this, I login with a normal user **sammy** , and I type `ps`, it will print               Permission denied      and I type `/bin/call_ps_via_root.sh` It is still denied. How can I make it work by `call_ps_via_root.sh`?


Kernel 3.0.0-1 and NVIDIA driver boot problems

I can't boot kernel 3.0.0-1 on Asus G53S running Debian, it freezes when booting with:               NVRM loading NVIDIA Unix x86_64 kernel module 275.28      then it times out with:               udevd[350]: timeout: killing 'usb_id --export /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/video4linux/videob' [994]      and eventually restarts. This seems like a problem with NVIDIA proprietary driver, yet the message from dkms suggested it got configured fine when installing new kernel headers. Also why doesn't it just drop to shell if it cannot load the nvidia driver module? I'm stuck with an old 2.6.32 kernel and I was really hoping for some of the goodies coming with 3.0 (asus wmi driver especially). Both the kernel and NVIDIA driver are coming from repositories.


What Linux Distro contains support for Killer E2200 Ethernet chip?

I've been very interested in switching over to a Linux based system lately. I've decided I'm going to dual boot, but my primary machine will be the Linux system. I found that Ubuntu 12.04 didn't have any support for this Ethernet chip, and I found some solutions but none worked. And it was awfully difficult navigating through web pages on Wifi, maybe that chip doesn't work so well either on Ubuntu. Anyway, I'd like to know if there are any Linux distributions that already come with this needed support? EDIT: If it helps, I have an MSI GT70 onc-494us


Why does Linux print a lot of debugging messages on boot/shutdown?

Why does Linux print a lot of debugging messages during the boot and shutdown processes? The boot/shutdown processes usually have no error. Why not hide the debugging messages, and show them only when needed? Also, some distributions' boot/shutdown splash screens fail to completely hide debugging message. Is there any technical limitation with splash screens?


Why is sshd looking at a non-existent public key file?

In an effort to get SSH keys working I'm tailing the sshd authorization log and I see these lines:               debug1: test whether pkalg/pkblob are acceptable     debug1: temporarily_use_uid: 10144/10029 (e=0/0)     debug1: trying public key file /home/cklein/.ssh/authorized_keys     debug1: restore_uid: 0/0     debug1: temporarily_use_uid: 10144/10029 (e=0/0)     debug1: trying public key file /home/cklein/.ssh/authorized_keys2     debug1: restore_uid: 0/0     Failed publickey for cklein from 192.168.8.165 port 46583 ssh2      But if I check the `/home/cklein/.ssh/` directory it looks like this:               $ ls -al /home/cklein/.ssh/     total 16     drwx------. 2 cklein infoarch 4096 May  3 16:39 .     drwxr-x--x. 9 cklein infoarch 4096 May  3 16:39 ..     -rw-------. 1 cklein infoarch  605 May  3 16:39 authorized_keys     -rw-r--r--. 1 cklein infoarch  226 Apr  4 16:11 known_hosts      I used to have an `authorized_keys2` file in that directory, but removed it and have since restarted `sshd`. Why is it still expecting that file to exist? Also, do you have any guesses as to why the public key is getting rejected?


VPNC cisco + quick mode response rejected error

I installed a vpnc on my Linux red-hat machine version 6.3 Most of the cases vpnc work well ( connecting to gateway customers by vpnc ) But against some particular customers ( Cisco gateways ) , immediately after I activate the vpnc I get the following messages:                   vpnc: quick mode response rejected:  (ISAKMP_N_INVALID_PAYLOAD_TYPE)(1)      In this case Vpnc could not be connected Please advice what the problem here? ,                [root@TEST-LINUX-MACHINE /var/tmp]# vpnc      Enter password for user@216.134.162.39:                Connect Banner:     | Remote access to UGG company resources is restricted to AUTHORIZED USERS!     |      | Company resources may only be used for the purpose of performing work-related duties.     | The user is responsible for protecting the confidentiality and integrity of the      company resources.     | Violation may cause disciplinary action.     | By clicking on "Continue" the user agrees with the rules above.     |            RTNETLINK answers: File exists      **vpnc: quick mode response rejected:  (ISAKMP_N_INVALID_PAYLOAD_TYPE)(1)**      this means the concentrator did not like what we had to offer.           Possible reasons are:           * concentrator configured to require a firewall        this locks out even Cisco clients on any platform expect windows        which is an obvious security improvment. There is no workaround (yet).     * concentrator configured to require IP compression        this is not yet supported by vpnc.        Note: the Cisco Concentrator Documentation recommends against using        compression, expect on low-bandwith (read: ISDN) links, because it        uses much CPU-resources on the concentrator      I also try to do the follwoing                 Add the line "NAT Traversal Mode cisco-udp" in /etc/vpnc.conf      Or                  Add the line "Local Port 10000" in /etc/vpnc.conf      But they dosent help and I still get the bad messages ( chuld not be connected by the vpnc ) Please advice where is the problem ?


Is it secure to leave a root shell running in detached screen session?

I'm curious about the security of leaving a root shell running inside a detached screen session. I typically never do this. Aside from the potential of my non-root user account being compromised (password exposed, ssh key compromised, etc), are there other vectors of entry into a detached, password-protected screen session I should be worried about, or can a detached screen session be considered inert?


Why curl -O -C on mac fails to download

The following script works on Ubuntu, but not on Mac. Why? How to edit it so that it would work there too?               #!/bin/sh          v=1.1     test_file="Test10.java"     jar_file="dp4j-$v-jar-with-dependencies.jar"          curl -O "http://repo2.maven.org/maven2/com/dp4j/dp4j/$v/$jar_file"          # Start     cat > $test_file << __EOF__     class T10 {         private static void p(int i, Double d, String... s){}     }     public class Test10{         @com.dp4j.InjectReflection         public void t() {        T10.p(1,new Double(2),"hello", "reflection");         }     }     __EOF__     cat $test_file     cmd="javac -Averbose=true -cp $jar_file $test_file"     echo $cmd     $cmd      The output on the mac:               $ sudo ./TESTDRIVE       % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current                                      Dload  Upload   Total   Spent    Left  Speed     100  341k  100  341k    0     0  1516k      0 --:--:-- --:--:-- --:--:-- 3248k     class T10 {         private static void p(int i, Double d, String... s){}     }     public class Test10{         @com.dp4j.InjectReflection         public void t() {       T10.p(1,new Double(2),"hello", "reflection");         }     }     javac -Averbose=true -cp dp4j-1.1-jar-with-dependencies.jar Test10.java     error: error reading dp4j-1.1-jar-with-dependencies.jar; cannot read zip file     ...      $ md5 dp4j-1.1-jar-with-dependencies.jar MD5 (dp4j-1.1-jar-with- dependencies.jar) = eb04d0d357fd861ac414fde7d3530119


Apache and Tomcat integration

I am trying to integrate apache and tomcat. I thus want apache to forward requests to tomcat. I am using the mod_jk module for apache to achieve this. So far I am trying to get tomcat to auto-gen the configuration files for the mod_jk - I add the relevant to my server.xml               <Listener className="org.apache.jk.config.ApacheConfig" modJk="/usr/lib/apache2/modules/mod_jk.so" />      This does not however work. Please could someone that has done this recently give me some direction. I suspect that a lot of the documentation is for old versions of apache and tomcat.


How can I select a beginning...ending portion of a '/' delimited string (PS1 prompt in my case)

I am customizing my PS1 prompt, specifically the $PWD part which is delimited by `/`'s among several things I like having the current directory.   However if the directory is too long I'd like to have beginning...ending For example, instead of               otherstuff:~/apps/webs/2014/area1/groupa/current:other_stuff $       I'd like to have the first directories and the last two, i.e.               otherstuff:~/apps/webs/.../groups/current:other_stuff $       It should handle when they partially overlap, i.e.                  otherstuff:~/apps/webs/2014:other_stuff $      -> otherstuff:~/apps/webs/2014:other_stuff $       and when they are the same, i.e.                  otherstuff:~/apps/webs/:other_stuff $      -> otherstuff:~/apps/webs/:other_stuff $       I tried various substrings if $PWD using {}, () and {} but can't get the format right. Update - I used the information in guidos answer (accepted) to put together this:               parse_git_branch () {       git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'     }     PS1='\033[01;31m\]\t\033[00m\]:'     PS1=$PS1'\[\033[01;32m\]\u\033[00m\]:\033[01;34m\]'     PS1=$PS1'`pwd | sed "s#\(/[^/]\+/[^/]\+/\).*\(/[^/]\+/[^/]\+\)/\?#\1...\2#g"`'     PS1=$PS1'\033[00m\]:\033[01;33m\]$(parse_git_branch)\[\033[00m\]\n\$ '      which yields: ![enter image description here](http://i.stack.imgur.com/hvyre.png) A sad amount of the code is repeated `\033[00m\\]:`'s for the 3 white colon seperator !


LVM Snapshot without copy-on-write

I've been experimenting with LVM and how I can use it for managing data on my NFS server. With everything that I've read about snapshots, I am still unsure about how they perform in real life. Why does one need to allocate space in the snapshot if they are just a bunch of pointers to the original data? What is the point of the snapshot if modifying files on the origin also trigger modification on the snapshot via copy-on-write? I thought that the snapshot is supposed to be a "static" point in time of the original. My expectation is such:               $ ls origin-data     > file1 file2     $ snapshot origin-data to origin-data-snapshot     $ modify origin-data and add new stuff     $ ls origin-data     > file1-modified file2 file3 file4     $ ls origin-data-snapshot     > file1 file2     $ sizeof origin-data-snapshot     > 0 bytes because they're all just pointers to blocks in origin-data!      If I'm misunderstanding, please explain and also explain how snapshots could be used in the way I'm expecting (like git commits, static, non-changing, pointers to data in a point in time that don't care about changes made to the origin). Does it involve RO or RW snapshots? UPDATE: I've been experimenting with some test partitions and have a bit more understanding. While mounting both origin and it's snapshot, new files in origin obviously show up in something like `df -h` but not in the snapshot. Meanwhile, `lvdisplay` shows this percentage for "Allocated to snapshot" increasing. Using 10mb test files and 1gb test partitions, I see exactly how this percentage behaves in relation to my data, but why must this be so? Why does the new data show up on the snapshot and not origin? I would think the blocks behave like hard-links in that old data stays there because the snapshot points to it while new blocks are created next to them because origin points to the new and modified block. No?


How to know if an IRQ value is free to use

If we add a device that does not support PNP (Plug-an Play), the manufacturer will hopefully provide explicit directions on how to assign IRQ values for it. However, if we don't know what IRQ value to specify, what command line should be used to check if a IRQ value is free or not? `lsdev` displays info about devices:               $lsdev      Device            DMA   IRQ  I/O Ports     ------------------------------------------------     0000:00:02.0                   7000-703f     0000:00:1f.2                   7060-707f   7080-7087   7088-708f   7090-7093   7094-7097     0000:00:1f.3                   efa0-efbf     0000:01:00.0                     6000-607f     0000:04:00.0                     4000-40ff     0000:05:00.0                     3000-30ff     acpi                      9      ACPI                           1800-1803   1804-1805   1808-180b   1810-1815   1820-182f   1850-1850     ahci                     43      7060-707f     7080-7087     7088-708f     7090-7093     7094-7097     cascade             4             What about this cmd `lsdev`, is it enough for this task? For example, if we want to know if 1233 is free, we would run this command:               lsdev | awk '{print $3}'|grep 1233        **NOTE:** `$3` above is used because IRQ value printed in the 3rd column of `lsdev` output. Then if no output, it means that it is free for us to use?


Cannot run script using udev rules

Prescript: I have already searched for similar questions but am not able to find a useful answer. Background: I am using Fedora 64-bit. I want to execute a specific script /bin/usbattached.sh when a usb is attached. I am using Kingston Datatraveller usb stick whose Vendor Id is 0951 and Product Id is 1660 (as found from dmesg and other methods). I have found two udev rules.d directories on my machine, namely /etc/udev/rules.d and /lib/udev/rules.d Since I am not sure which directory to use, I have created my rule file in both of above mentioned directories. Below is my rule               ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0951", ATTRS{idProduct}=="1660", RUN+="/bin/usbattached.sh"      I have removed ACTION, changed RUN+= to RUN=, written it in new file as well as pre-existing rule files, all without luck. I use               udevadm control --reload-rules       and               systemctl restart udev.service        to restart udev. When I run udevadm test on my device, it shows that it does read my rules file but the script doesn't work. Any method to debug it will be highly appreciated. The script /bin/usbattached.sh sends a notification to the top-right corner of the screen, echo's a message on the screen and appends the current date/time to ~/op file, when run manually. Unfortunately, none of the above mentioned actions are being performed when the usb is attached. EDIT: Upon adding ´sleep 10´ to my usbattached.sh script, I notice the usb is mounted roughly after 18 seconds. This time changes almost linearly with changing the value from 10 as well. Looks like the script IS being run but I am not having any notification, neither there is a new line appended to the output file


Regex alternation/or operator (foo|bar) in GNU or BSD Sed

I cannot seem to make it work. GNU sed documentation says to escape the pipe, but that doesn't work, nor does using a straight pipe without the escape. Adding parens makes no difference.               $ echo 'cat     dog     pear     banana     cat     dog' | sed 's/cat|dog/Bear/g'     cat     dog     pear     banana     cat     dog          $ echo 'cat     dog     pear     banana     cat     dog' | sed 's/cat\|dog/Bear/g'     cat     dog     pear     banana     cat     dog


ATI gamma correction, fglrx_xgamma not installed

I want to change gamma settings after installing ATI driver. But I noticed that I have no `fglrx_xgamma` tool. I installed the drivers from the ATI website. How to correct gamma without the tool, or change it in the other way?


Encode with ffmpeg using avi to mp4

What command lines to use to convert from avi to mp4, but without destroying the framesize and making the file small as the original size or a little bit bigger, and same thing with mp4 to avi? Whenever I tried converting it became like 2 gb


GParted is Frozen

I've been trying to allocate more space for Windows... And to do that, I have to resize my Linux partition partition. So I booted up from my flash drive and started up `gParted`. Everything was working great until `gParted` started to resize my Linux partition. It's been stuck at `6.33GB of 86.5GB copied` for about half an hour now. The entire OS has stopped responding and the flash drive is flashing like it does when it's active. I have Linux Mint 11 on my flash drive. I'm not too particularly worried about losing my data. I have it all backed up, but it would be nice if this could be recovered. Any suggestions?


ffmpeg: error while running with libx264

Main code: ffmpeg -i 2269801.avi -threads 0 -vcodec libx264 -b 900k -acodec libfaac -ar 44100 -ab 96k -ac 2 earthgirlsareeasy1.mp4               [libx264 @ 0x16cdde10]broken ffmpeg default settings detected     [libx264 @ 0x16cdde10]use an encoding preset (e.g. -vpre medium)     [libx264 @ 0x16cdde10]preset usage: -vpre <speed> -vpre <profile>     [libx264 @ 0x16cdde10]speed presets are listed in x264 --help     [libx264 @ 0x16cdde10]profile is optional; x264 defaults to high     Output #0, mp4, to 'earthgirlsareeasy1.mp4':         Stream #0.0: Video: libx264, yuv420p, 720x336 [PAR 1:1 DAR 15:7], q=2-31, 900 kb/s, 90k tbn, 23.98 tbc         Stream #0.1: Audio: libfaac, 44100 Hz, 2 channels, s16, 96 kb/s         Metadata:           strn            : Audio Stream     Stream mapping:       Stream #0.0 -> #0.0       Stream #0.1 -> #0.1     Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as         bit_rate, rate, width or height      All lines http://pastie.org/private/0xmgwzhbu9kkplwi6a49qa Note: I am using centOS running 5.8


How can I save the Xterm configuration I set at runtime?

I configured my xterm using the `CTRL-MiddleClick` and `CTRL-RightClick`. Is there a way to export save these settings?


pull out a file named to ~

So I have downloaded a music album from aMule and it is located in the `.aMule/Incoming` directory. I tried to move it out with the following command:                mv albumName.rar ~      This left me with a file `~` in `.aMule/Incoming` which I could not rename because tilde is reserved for home directory. I know I can access it via Nautilus by showing hidden files. How can I pull it out in terminal? **Update** This is how it looks like now                  manuzhang@manuzhang-R458-R457:~/.aMule/Incoming$ ls -l        total 328        -rw-r--r-- 1 manuzhang manuzhang 297266 2012-03-19 12:07 ～        -rw-r--r-- 1 manuzhang manuzhang  34479 2011-10-11 19:51 [kat.ph]friends.season.1.with.english.subtitles.torrent


Dereference concatenated variable name

I can do this, but it requires making a string of the variable then dereferencing it. Is there any way to shorten it to a simpler statement?               #!/bin/bash          FRUITS="BANANA APPLE ORANGE"          BANANA_COLOUR="Yellow"     APPLE_COLOUR="Green or Red"     ORANGE_COLOUR="Blue"          for fruit in $( echo $FRUITS ); do         fruit_colour="${fruit}_COLOUR"         echo $fruit is ${!fruit_colour}     done      I have tried lots of things like `${!"${fruit}_COLOUR"}` or `\$${fruit}_COLOUR` and many other variants, but the only way that has worked is by using a string.


Slim exit as username ends in black screen

I recently installed Arch Linux on my notebook and it works fine. But there is still one small problem. Following to the SLiM manual I can use `exit` to exit to the shell. Unlike expected, I won't return to the shell, there is just a black screen where I cannot input anything. Also `ALT` + `F1`, `ALT` + `F2`, `ALT` + `F3` or `ALT` + `F4` makes no difference. Do I need to configure anything? Any suggestions?


Apple keyboard in openbox

I just upgraded from Fedora 15 to 16. I'm using Openbox as an alternative to Gnome 3. The problem is that I cannot find a way of using the multimedia keys properly in Openbox. Changing the keyboard layout and other (I think) Gnome-based keyboard shortcuts do not work as well, while in Gnome all they keyboard settings work perfectly. Before (in Fedora 15) I was ' _tricking_ ' Openbox by running and killing gnome's keyboard settings at startup.               timeout -sHUP 1s gnome-control-center region      This seemed to run some kind of service in the background that was letting me use all the keys in the keyboard and gnome-specific short cuts in Openbox. I know that I can set up some key bindings in Openbox ( _rc.xml_ ), the thing is that there are some keys (F13 to F18) in Apple's keyboard that are really useful when setting special. These special keys (and keyboard-layout-changing short cuts) can be seen in Gnome but cannot be seen by Openbox. Any clue on what kind of service Gnome is running that Openbox is not that it is able to 'see' all the keys in the Apple keyboard? Thanks for your time


What is difference between [ and [[ in BASH?

> **Possible Duplicate:**   >  using single or double bracket - bash When should I use a single bracket? `[` When should I use double brackets? `[[` Are both POSIX compliant?


[ vs [[ : which one to use in bash scripts?

The zsh man page, in its section on `test` (aka `[`), explicitly advises against using it at all, and urges readers to use `[[` whenever possible. The relevant section states: > The command attempts to implement POSIX and its extensions where these are > specified. Unfortunately there are intrinsic ambiguities in the syntax; in > particular there is no distinction between test operators and strings that > resemble them. The standard attempts to resolve these for small numbers of > arguments (up to four); for five or more arguments compatibility cannot be > relied on. Users are urged wherever possible to use the '`[[`' test syntax > which does not have these ambiguities. I think I've come across similar advice for bash, but as I scan over the bash man page I can't find any "official" recommendation there on which form (`[` or `[[`) to use. (Maybe I missed it?) > Is there any reason, _other than backward compatibility with "older shells"_ > , for using `[` in a bash script? Or to put it differently, does bash keep > `[` along with `[[` for reasons _other_ than backward compatibility?


What do square brackets mean without the "if" on the left?

As far as I know, square brackets are used to enclose an expression usually in if else statements. But I found square brackets being used without the "if" as follows:               [ -r /etc/profile.d/java.sh ] && . /etc/profile.d/java.sh      in the following script.               #!/bin/bash### BEGIN INIT INFO       # Provides:          jbossas7       # Required-Start:    $local_fs $remote_fs $network $syslog       # Required-Stop:     $local_fs $remote_fs $network $syslog       # Default-Start:     2 3 4 5       # Default-Stop:      0 1 6       # Short-Description: Start/Stop JBoss AS 7       ### END INIT INFO       # chkconfig: 35 92 1            ## Include some script files in order to set and export environmental variables       ## as well as add the appropriate executables to $PATH.       [ -r /etc/profile.d/java.sh ] && . /etc/profile.d/java.sh       [ -r /etc/profile.d/jboss.sh ] && . /etc/profile.d/jboss.sh            JBOSS_HOME=/sw/AS7            AS7_OPTS="$AS7_OPTS -Dorg.apache.tomcat.util.http.ServerCookie.ALLOW_HTTP_SEPARATORS_IN_V0=true"   ## See AS7-1625       AS7_OPTS="$AS7_OPTS -Djboss.bind.address.management=0.0.0.0"       AS7_OPTS="$AS7_OPTS -Djboss.bind.address=0.0.0.0"            case "$1" in           start)               echo "Starting JBoss AS 7..."               #sudo -u jboss sh ${JBOSS_HOME}/bin/standalone.sh $AS7_OPTS           ##  If running as user "jboss"               #start-stop-daemon --start --quiet --background --chuid jboss --exec ${JBOSS_HOME}/bin/standalone.sh $AS7_OPTS   ## Ubuntu               ${JBOSS_HOME}/bin/standalone.sh $AS7_OPTS &           ;;           stop)               echo "Stopping JBoss AS 7..."               #sudo -u jboss sh ${JBOSS_HOME}/bin/jboss-admin.sh --connect command=:shutdown            ##  If running as user "jboss"               #start-stop-daemon --start --quiet --background --chuid jboss --exec ${JBOSS_HOME}/bin/jboss-admin.sh -- --connect command=:shutdown     ## Ubuntu               ${JBOSS_HOME}/bin/jboss-cli.sh --connect command=:shutdown           ;;           *)               echo "Usage: /etc/init.d/jbossas7 {start|stop}"; exit 1;           ;;       esac            exit 0        What do square brackets do without the "if"? I mean, exactly, what do they mean when used in that context? This isn't a duplicate of that in which the OP used "if" which I don't have a problem with. In this question, brackets were used in a counter intuitive way. That question and this question may have the same answer but they are two different questions.


How to find the header file where a c function is defined?

Is there an easy way to find out which header file a C function declaration is in? `cd`ing into `/usr/include` and running (`grep -E 'system.*\\(' *.h -R`) works with some trial and error, but isn't there an easier way to do this?


Permission rights on automatic directories inside /media

I got a `permission denied` when I am trying to `cd` inside a directory. I could `chown` it for my user, however I'm wondering if the problem is elsewhere: The directory in question is an automatic directory added inside `/media` when I plug my usb external drive. I have read that the points inside `/media` are automatically removed, so I doubt about the usefulness of my `chown`. Is there a way to give access to the user to all the usb things I'm going to plug that will appear inside `/media` ? **Edit** : I rebooted, with the drive unplugged, logged in, then plugged the drive, and then it appears ready to be mounted in PcManFM. From what I have seen, when it's mounted, there's a point `/media/MyDrive_` owned by my user that has been created (`/media/MyDrive` without the trailing underscore is owned by root). It's when that point has been created, that the drive can no longer be accessed by another user. So now it's no longer a real problem for me, since the other user was just optionnal in my setup. But it would be nice to know how to get over it when switching between users. Should I unmount external drives any time I log out ? **Edit2** : I don't find the webpage, but I have read about a `storage` user group, can it be related to that ?


How to launch a set of program inside tmux or gnome-terminal within a script?

I wanted to launch a few commands simultaneously in tmux or gnome-terminal or xfterminal , every different tab with a single command running , and close that tab when that command finishes. Any other software is welcomed as well I wanted to issue a single script to do the job , e.g XX "cmd1" "cmd2" "cmd3"


Can't get directory listing of folder I have permissions to

I was having some permission problems and used the following command on directory Media:               chmod -R ugo+r Media      It didn't help so then I did:               chmod -R 775 Media      Now I get this error when I try to `cd`:                jeff@nacho:/DataVolume/shares$ cd Media     -bash: cd: Media: Permission denied      Even though when I do a directory listing everything looks fine:               drwxrwxr-x  8 root share 65536 Oct 15 22:38 Media     drwxrwxr-x 11 root share 65536 Oct 15 23:52 Public      Note: I can `cd` to Public with no problem. If I `su` then I can access the directory. What am I missing? Extra info:               jeff@nacho:/var/www/Admin/webapp/htdocs$ mount |grep -vE '^none'     /dev/md0 on / type ext3 (rw,noatime)     tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755,size=50M)     proc on /proc type proc (rw,noexec,nosuid,nodev)     sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)     procbususb on /proc/bus/usb type usbfs (rw)     udev on /dev type tmpfs (rw,mode=0755)     tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,size=50M)     devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)     tmpfs on /tmp type tmpfs (rw,size=50M)     /var/log on /var/log.hdd type none (rw,bind)     ramlog-tmpfs on /var/log type tmpfs (rw,size=20M)     /dev/sda4 on /DataVolume type ext4 (rw,noatime,nodelalloc)     /DataVolume/cache on /CacheVolume type none (rw,bind)     /DataVolume/shares on /shares type none (rw,bind)     /DataVolume/shares on /nfs type none (rw,bind)     rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)     nfsd on /proc/fs/nfsd type nfsd (rw)


Disk usage inside archives, like ncdu

I am a fond user of the ncdu utility to figure out how space is used within a directory. However, I have a use case where I am trying to choose which folders to backup and which folders not to backup, and the backups will be compressed (as a .tar.xz archive, but I suppose .tar.gz would yield the same result for what I have in mind). So, intuitively, I do not care that much about files that are large but will compress well (e.g., email archives), whereas I care more about files that are relatively small but will not compress at all (e.g., JPG pictures). I want to see files and folders sorted by their compressed size, not their actual uncompressed size. A natural solution would be to compress all files, and then have an `ncdu`-like tool that would operate _on the archive_ to tell me how folders take up space in the archive. Is there any such utility? I am OK with GUI programs (although I would prefer text-based ones), and I am OK with methods that would only work for a different compression algorithm as I imagine they would still yield useful results (e.g., replicate the hierarchy in a filesystem with built-in compression/deduplication).


Why is the theoretical RAM limit for RHEL 6 128 TB and how is this determined?

I'm studying for RHCSA and am confused by a statement I came across in some training material: > There is no practical maximum RAM, as theoretically, you could run 128 TB of > RAM on RHEL 6. But that's just theory. The maximum RAM supported by Red Hat > on RHEL 6 is 16 GB on 32-bit systems and 2 TB on 64-bit systems. Can someone please explain where the 128 TB theoretical limit is coming from? I'm confused on how the author knows the theoretical limit exists if RHEL 6 clearly defines other maximum limits. Is this just factoring in the theoretical limits of 64-bit architecture? Or is there some other reason here?


How to determine whether a linux filesystem belongs to a running system or not

I need to write a program that receives a block device as input, like /dev/sda1, and has to perform a set of operations depending on if the filesystem inside are currently running or not. We'll assume the input will always has a correct linux directory tree, the only I need to know is if there's a particular directory structure or file/s that can reliably determine whether the system inside is running. I mean whether the filesystem contains the root of a system that is powered on. It should work for any filesystem or linux kernel version. Thanks!


ssh returns message "X11 forwarding request failed on channel 1"

When I ssh into a remote server that's not running any type of X11 desktop environment I get the following message.               $ ssh user@server     X11 forwarding request failed          $ ssh user@server ls     X11 forwarding request failed on channel 1     file1     file2     ...      How can I get rid of these messages?


how to make dual monitors work as separate monitors and not duplicate? Linux mint 14

Need bit of help on this. I am using Linux mint 14 with xfce. I have 2 monitors. LG and Samsung. One is attached to digital input and one to VGA input cable. NVidia graphics card. The 2 monitors come up OK, and I see the Linux desktop on both of them just fine. The problem is that they are duplicate of each others. Kinda' useless. anything I do on one monitor appears exactly on the second monitor. So I like to change this so that I can have one as primary monitor, and the second one to use by dragging windows to it when I run out of space on my primary monitor. I set this very easily on windows. But hard to do on Linux. I researched this, and one is supposed to run a program called `nvidia- setting` to configure this. But when I do               sudo nvidia-setting      I get message saying                  You do not appear to be using the NVIDIA X driver.  Please edit your         X configuration file (just run `nvidia-xconfig` as root), and         restart the X server.      I have no idea what this means. I do not know how to edit configurations files. Edit them to do what? But even when I try the command above               >sudo nvidia-xconfig     sudo: nvidia-xconfig: command not found      I looked in the package manager, and searched and do not see this program. I searched also:               >aptitude search nvidia | grep -i config     i   nvidia-settings                 - Tool for configuring the NVIDIA graphics d     p   nvidia-settings:i386            - Tool for configuring the NVIDIA graphics d     p   nvidia-settings-experimental-30 - Tool of configuring the NVIDIA graphics dr     p   nvidia-settings-experimental-30 - Tool of configuring the NVIDIA graphics dr     p   nvidia-settings-experimental-31 - Tool for configuring the NVIDIA graphics d     p   nvidia-settings-experimental-31 - Tool for configuring the NVIDIA graphics d     p   nvidia-settings-updates         - Tool for configuring the NVIDIA graphics d     p   nvidia-settings-updates:i386    - Tool for configuring the NVIDIA graphics d     >      and               >apt search nvidia-xconfig     >      You can see that there is no such program out there in the Linux mint 14 xfce repository. This package is available for debian http://packages.debian.org/squeeze/nvidia-xconfig Any idea what to do now? Here are the specs:               lspci     05:00.0 VGA compatible controller: NVIDIA Corporation G98 [GeForce 8400 GS] (rev a1)      xrandr command output               >xrandr     Screen 0: minimum 320 x 200, current 1280 x 1024, maximum 8192 x 8192     DVI-I-1 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 510mm x 290mm        1920x1080      59.9 +   60.0          1680x1050      59.9          1680x945       60.0          1400x1050      59.9          1600x900       60.0          1280x1024      75.0*    60.0          1440x900       75.0     59.9          1280x960       60.0          1366x768       60.0          1360x768       60.0          1280x800       74.9     59.9          1152x864       75.0          1280x768       74.9     60.0          1024x768       75.1     70.1     60.0          1024x576       60.0          832x624        74.6          800x600        72.2     75.0     60.3     56.2          848x480        60.0          640x480        72.8     75.0     60.0          720x400        70.1       VGA-1 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 509mm x 286mm        1920x1080      60.0 +        1600x1200      60.0          1680x1050      60.0          1680x945       60.0          1400x1050      60.0          1600x900       60.0          1280x1024      75.0     60.0*         1440x900       75.0     59.9          1280x960       60.0          1366x768       60.0          1360x768       60.0          1280x800       74.9     59.8          1152x864       75.0          1280x768       74.9     59.9          1024x768       75.1     70.1     60.0          1024x576       60.0          832x624        74.6          800x600        72.2     75.0     60.3     56.2          848x480        60.0          640x480        72.8     75.0     66.7     60.0          720x400        70.1       >


How can I match this text in awk, printing line numbers for matches?

I have a text file thousands (roughly 148,000 lines long) that consists of a lot of sequences like this:               b 29.     b 52.     c 84.     c 83.     c 94.     c 93.     c 61.     b 38.     c 81.     c 92.     c 28.     c 37.     c 27.      ... and since the file is so large, I want to be able to search for patterns like this (non-functional one-liner): grep "b\ 34.\nc53.\nb\ 54.\na\ 45.\nd\ 44.\nd\ 63.\nd\ 64.\n" filename It seems like awk is a good choice. How can I do that, and print line numbers for matches too?


cinnamon doesn't start, bumblebee problem

I have Linux Mint 13 64 bit version with cinnamon, NVdia Geforce 320m, proprietary driver 304.54 if I'm not mistaken. I installed bumblebee following this guide:               sudo add-apt-repository ppa:bumblebee/stable     sudo apt-get update     sudo apt-get install bumblebee bumblebee-nvidia linux-headers-generic      Rebooted, and now I have 640x480 resolution, half-broken gnome 3 was loaded (there are no buttons to log out or reboot, no animations of course). When I try to run `nvidia-settings` I get:               You do not appear to be using the NVIDIA X driver.       Please edit your X configuration file (just run `nvidia-xconfig` as root),     and restart the X server.      What shall I do to fix this? I want my discrete graphics card and cinnamon back.


How can I create labels in VirtualBox like this video?

In this video, I saw a fold-able label in the VM list, how was that created? I'm running VBOX 4.2 OSE as well, but didn't spot where to configure it.               > SERVER  // can be folded       VM 1        VM 2          > Label 2       VM 1       VM 2


How to run a Python script in Makefile

I want to write a Makefile to find specific files and run a Python script on each file. The Python script accepts `sys.stdin` input.               find $(W)/$(OVE) -name "*.xml" -print | \     while read x ; do \       cat $x | /opt/exp/bin/python2.7 process_results.py > $(W)/$(OVE)/$(dirname $x)_$(basename $x).xml \     done      The output is `$(dirname $x)_$(basename $x).xml` file which is an empty _.xml file. When I run this command on command line, it works properly but in Makefile it doesn't work. Can you help me what is wrong with this command?


Use or convert .ttf font for console use in FreeBSD

I have a monospace .ttf font I really like (UbuntuBeta Mono). Is there any way I can use it (or convert first and then use, if needed) for the console in freeBSD? I know there is `usr/share/syscons/fonts`, but it looks like they might be a different format? Once I install the font, how do I tell the console to use it?


Ubuntu Server, set terminal font to a custom ttf font?

I would like to change the system (console) font of my ubuntu server to a custom (downloaded) font. Is this possible? I've tried to use:               dpkg-reconfigure console-setup      but the only allows me to choose from the default system fonts.


Emacs: make portion of buffer readonly

I sometimes edit files in `emacs` where portions of the file are documentation or something else that shouldn't be edited, and another portions are "play areas" where I'm free to edit and create new text. Question: can I make a _portion_ of an emacs buffer readonly? The simplest example would be making lines 1-100 readonly (for example). A more complex example (similar to emacs bookmarks) would be to make all text between `[readonly]` and `[/readonly]` uneditable. I googled this, but couldn't find anything useful.


How to pass arguments to bash shell script when executing that command with at?

I have a shell script that accepts an argument and uses that in the script. So to run the script I type `/path/to/script argument` The problem is when trying to setup that file to run using the `at` utility. I have tried `at -f /path/to/script argument 17:45` `at -f '/path/to/script argument' 17:45` but neither of these options work. First one receives a syntax error and the second says no such file Any suggestions?


Arch Linux doesn't seem to use vconsole.conf

I have insalled Arch Linux. During the installation, I set my vconsole.conf file to be like this:               KEYMAP=slovene     FONT=Lat2-Terminus16      But when I try to type my Slovenian letters after reboot, instead of the letter **č** I get **A''** and I also get some wierd symbols for letters like **ž** , **đ** , **š** as well as capital versions of the same. **Q1:** Why isn't my vconsole.conf applied? **Q2:** Is it possible that letters just cant be rendered?


Is it possible to change Inode count on an ext4 filesystem?

> **Possible Duplicate:**   >  How can I increase the number of inodes in an ext4 filesystem? I have a homemade NAS with Debian Wheezy 64bit. It has three disks - 2x2TB and 1.5TB, pooled together using RAID1/5 and LVM. The result is a LVM Logical Volume, about 3.16TB in size, formatted as ext4 and mounted as /home. However I just found out that roughly 50GB of this capacity is used by Inodes (exact count being 212 459 520, with 256B in size or to put it in another way - one Inode per every 16k of the partition size). While 50GB in 3.16TB is about 1.5% of the total capacity, it's still a lot of space. Since this is a storage NAS, mostly used for multimedia, I don't ever expect the /home partition to have 212 **million** files in it. So, my question is this - is it possible to lower/change the number of Inodes without actually re-creating the whole partition? While it might be possible to do it, I'd still prefer to find a way to do so instead of moving 2TB of data around and waiting for RAID to re-sync again.


Resize ext4 partition to create more inodes?

> **Possible Duplicate:**   >  How can I increase the number of inodes in an ext4 filesystem? An old headless no-X backup server I use has a small hard drive with three primary ext4 partitions: `/`, `/home` and `/swap`. The system is unable to run updates, as there are insufficient inodes available on the 1.5GB `/` partition. There is unused space available on `/home`. Would resizing the `/` partition from a live GParted environment solve this? Would more inodes be created by this process? This answer indicates that it is not possible to create more inodes after a filesystem has been created. I assume that this does not involve **resizing** the partition. This answer suggests recreating the filesystem to obtain more inodes.


bind key sequence to Escape, zsh

How would I map `jj` to `Esc` in zsh? I'm trying to recreate a key-mapping that I have setup in vim, where I have `jj` mapped to `ESC` so that whenever I double-press `j`, it sends the an `<Esc>` to vim--allowing me to enter normal mode with greater convenience. I've already tried `bindkey 'jj' ^[`, and I'm about to try `bindkey 'jj' ^[[`, but I doubt that it'll work. I also checked the list of commands provided by zsh in normal mode, but I didn't see anything that contained `normal` or `escape`. **NOTE**   The `^[` characters in my `~/.zshrc` file are actual hard coded escapes; not just the characters `^` and `[`.


autofs mounts not disconnecting after inactive

I have **autofs** installed on several linux servers that are connecting to central NFS server for the users /home directories. It works great when mounting the directories on login, but the mounts never seem to timeout. I've checked /etc/sysconfig/autofs and the default is indeed set to 300, so these should be timing out after 5 minutes. Restarting **autofs** does umount all of the directories, so I know it's capable. I've attempted using **lsof** randomly on the directories but no files appear open at any time. I've also mounted a random directory that I know is not active, but these never umount themselves. Some of these boxes have 10+ users that have logged in once, and the mounts never drop. I'm just trying to find out of there is a better method to finding out why. I don't see anything specific in any logs. Any suggestions are appreciated. Thanks! **UPDATE** I turned on debugging for **autofs** but it doesn't seem to reveal anything out of the ordinary. These logs were generated 7 minutes after the /home/user1 was initially mounted and after 6 minutes of inactivity. According to the 5 minute default, this should have been unmounted. I never saw a log come through that indicated an attempt was even made to umount.               Jan 11 12:52:00 linux automount[26505]: st_expire: state 1 path /home     Jan 11 12:52:00 linux automount[26505]: expire_proc: exp_proc = 3055176592 path /home     Jan 11 12:52:00 linux automount[26505]: expire_proc_indirect: expire /home/user1     Jan 11 12:52:00 linux automount[26505]: expire_proc_indirect: expire /home/user2     Jan 11 12:52:00 linux automount[26505]: expire_proc_indirect: expire /home/user3     Jan 11 12:52:00 linux automount[26505]: 3 remaining in /home     Jan 11 12:52:00 linux automount[26505]: expire_cleanup: got thid 3055176592 path /home stat 7     Jan 11 12:52:00 linux automount[26505]: expire_cleanup: sigchld: exp 3055176592 finished, switching from 2 to 1     Jan 11 12:52:00 linux automount[26505]: st_ready: st_ready(): state = 2 path /home      **Update 2** After talking to Red Hat support about this, the solution ended up being to just shorten the timeout value for home directories. I did that and looks well. Something apparently is traversing the mount point every 2 1/2 to 3 minutes and causing this to stay up. The solution was to add the timeout value to the /etc/auto.master file for that mapping:                /home     /etc/auto_home --timeout=120


sipe (plugin pidgin-gaim) unable to find libpurple headers

I downloaded : pidgin 2.10.6 and sipe 1.14.1 from sourceforge. I install pidgin with the following command in the folder of pidgin (2.10.6):               ./configure --prefix=/home/tony/soft/pidgin_sipe --disable-screensaver --disable-gtkspell --disable-vv --disable-meanwhile --disable-avahi --disable-nm --disable-tcl          make     make install      it works fine and i can launch pidgin with `/home/tony/soft/pidgin_sipe/bin/pidgin` then i tried to install the plugin sipe but in the folder of sipe (1.14.1) the command:               ./configure --prefix=/home/tony/soft/pidgin_sipe      returns :               checking for PURPLE... no      checking for TELEPATHY_GLIB... no     configure: error: at least one plugin must be selected          If you didn't use a --enable option then please check that you have     the headers for the packages "purple" or "telepathy-glib" installed.      I add in my environment variable `PATH` the folder `/home/tony/soft/pidgin_sipe/bin` and i export `PURPLE_LIBS="/home/tony/soft/pidgin_sipe/lib"` but the result is the same. And in the folder `/home/tony/soft/pidgin_sipe/include/libpurple` the headers are here :               account.h conversation.h debug.h .... upnp.h      Am I missing something or how can I tell to sipe where libpurple is.


How to remove LUKS encryption?

I tried removing LUKS encryption on my home directory using the following command:               cryptsetup luksRemoveKey /dev/mapper/luks-3fd5-235-26-2625-2456f-4353fgdgd      But it gives me an error saying: > Device /dev/mapper/luks-3fd5-235-26-2625-2456f-4353fgdgd is not a valid LUKS > device. Puzzled, I tried the following:               cryptsetup status luks-3fd5-235-26-2625-2456f-4353fgdgd      And it says:               /dev/mapper/luks-3fd5-235-26-2625-2456f-4353fgdgd is active and is in use.     type: LUKS1     cipher: ...      It seems the encrypted device is active, but not valid. What could be wrong here?


Find out what /dev/cuaU maps to?

I have an USB 3G modem (Huawei E353-u2) on pfSense 2.0.2 (which is based on FreeBSD 8.1-RELEASE-p13), it seems to create 2 /dev/cuaU devices:               /dev/cuaU0.0     /dev/cuaU0.3      1) Why are there 2 devices? Is one of them maybe the usb mass storage of the stick? 2) On the OS level (shell), how can I find out which of those 2 devices is the "real modem" / to what /dev/cuaUx.y is mapped? Thanks for any hint :-)


Set up network interface for automatic connection

I have an ethernet device P2P connected to the NIC in my system. When the remote device is rebooted or changes its IP address, the local network interface goes down and loses its IP address. How can I make the local interface automatically reconnect in such cases and remember its IP? I know how to set an interface up programmatically and set an IP, but I don't want to check in a loop, there should be a better way.


How to correctly concatenate strings in shells script?

I have a bash shell which I need to modify, and I have to set a variable in a script and then call another script. My variable, `EXTRA_JAVA_OPTIONS` must be               -javaagent:myagent.jar="-d 0 -i 1000 -l log2 -c log1"      So what I did is               export EXTRA_JAVA_OPTIONS="-javaagent:myagent.jar=\"-d 0 -i 1000 -l log2 -c log1 \""      Then I call my script and inside my script there is the following :               "$JAVACMD" "$EXTRA_JAVA_OPTIONS"      However, this won't produce the result I desire. Running bash -x I can see that               + /usr/java/jdk1.6.0_38/bin/java '-javaagent:myagent.jar="-d 0 -i 1000 -l log2 -c log1"'      If on the contrary I do:               "$JAVACMD" $EXTRA_JAVA_OPTIONS      I got a different version of the output, which is wrong too               + /usr/java/jdk1.6.0_38/bin/java '-javaagent:myagent.jar="-d' 0 -i 1000 -l log2 -c 'log1"'      How do I prevent `'` from appearing when printing my strings, or them to be added by the shell?


NetworkManager issues in Arch Linux

Have had WiFi working fine via wifi-menu on command line for a while, but would much prefer the gnome icon, so i switched to NetworkManager, and now nothing will connect. I enabled my dhcp daemon in the config file, but the issue seems to happen before that point... any network I try it just refuses to connect to. It sees networks, then fails to connect immediately on click.