title: I'm failing to set up a wireless Access Point (AP)

text: I'm trying to get this card to be an access point, and am failing. I tried various Ubuntu releases, and checked on both ARM and i386. The kernel version I used is 2.6.35, and there is no Network Manager. Here's the log entries on `/var/log/syslog` when I connect the device:               May 27 10:56:46 vab kernel: usb wakeup is here     May 27 10:56:46 vab kernel: ehci_fsl_bus_resume, Host 1     May 27 10:56:46 vab kernel: usb 2-1.2: new high speed USB device using fsl-ehci and address 8     May 27 10:56:47 vab kernel: usb 2-1.2: New USB device found, idVendor=0cf3, idProduct=9271     May 27 10:56:47 vab kernel: usb 2-1.2: New USB device strings: Mfr=16, Product=32, SerialNumber=48     May 27 10:56:47 vab kernel: usb 2-1.2: Product: WLAN      May 27 10:56:47 vab kernel: usb 2-1.2: Manufacturer: MVA1020     May 27 10:56:47 vab kernel: usb 2-1.2: SerialNumber: 12345     May 27 10:56:47 vab kernel: usb 2-1.2: ath9k_htc: Transferred FW: ar9271.fw, size: 51312     May 27 10:56:49 vab kernel: ath: EEPROM regdomain: 0x10     May 27 10:56:49 vab kernel: ath: EEPROM indicates we should expect a direct regpair map     May 27 10:56:49 vab kernel: ath: Country alpha2 being used: CO     May 27 10:56:49 vab kernel: ath: Regpair used: 0x10     May 27 10:56:49 vab kernel: Registered led device: ath9k-phy4::radio     May 27 10:56:49 vab kernel: Registered led device: ath9k-phy4::assoc     May 27 10:56:49 vab kernel: Registered led device: ath9k-phy4::tx     May 27 10:56:49 vab kernel: Registered led device: ath9k-phy4::rx     May 27 10:56:49 vab kernel: usb 2-1.2: ath9k_htc: USB layer initialized      **`hostapd`** config file:               $ cat config     interface=wlan0     driver=nl80211     ssid=test     channel=1      And running it:               $ sudo hostapd conf      Configuration file: conf     Failed to set interface wlan0 to master mode.     nl80211 driver initialization failed.     ELOOP: remaining socket: sock=5 eloop_data=0xa4a38 user_data=(nil) handler=0x3d2f8      Output of `iw list`:               Wiphy phy4         Band 1:             Capabilities: 0x104e                 HT20/HT40                 SM Power Save disabled                 RX HT40 SGI                 No RX STBC                 Max AMSDU length: 7935 bytes                 DSSS/CCK HT40             Maximum RX AMPDU length 65535 bytes (exponent: 0x003)             Minimum RX AMPDU time spacing: 8 usec (0x06)             HT TX/RX MCS rate indexes supported: 0-7             Frequencies:                 * 2412 MHz [1] (27.0 dBm)                 * 2417 MHz [2] (27.0 dBm)                 * 2422 MHz [3] (27.0 dBm)                 * 2427 MHz [4] (27.0 dBm)                 * 2432 MHz [5] (27.0 dBm)                 * 2437 MHz [6] (27.0 dBm)                 * 2442 MHz [7] (27.0 dBm)                 * 2447 MHz [8] (27.0 dBm)                 * 2452 MHz [9] (27.0 dBm)                 * 2457 MHz [10] (27.0 dBm)                 * 2462 MHz [11] (27.0 dBm)                 * 2467 MHz [12] (disabled)                 * 2472 MHz [13] (disabled)                 * 2484 MHz [14] (disabled)             Bitrates (non-HT):                 * 1.0 Mbps                 * 2.0 Mbps (short preamble supported)                 * 5.5 Mbps (short preamble supported)                 * 11.0 Mbps (short preamble supported)                 * 6.0 Mbps                 * 9.0 Mbps                 * 12.0 Mbps                 * 18.0 Mbps                 * 24.0 Mbps                 * 36.0 Mbps                 * 48.0 Mbps                 * 54.0 Mbps         max # scan SSIDs: 4         Supported interface modes:              * IBSS              * managed              * monitor         Supported commands:              * new_interface              * set_interface              * new_key              * new_beacon              * new_station              * set_bss              * authenticate              * associate              * deauthenticate              * disassociate              * join_ibss              * Unknown command (55)              * Unknown command (57)              * Unknown command (59)              * set_wiphy_netns              * Unknown command (65)              * connect              * disconnect      For this to work, I expect to see **AP** listed in `Supported interface modes` on that output (as it does when I connect it on my Debian 7.0+ desktop, which has Network Manager running).


title: Extract text between two specific lines

text: How can I get the part of the output of a command between two specific lines? A dummy example: Command:               git for-each-ref --sort='*authordate' --format='%(tag)' refs/tags | grep -v '^$'      Output:               0.1.0     0.2.0     1.0.0     1.0.1     1.0.2     1.1.0     1.2.0     1.2.1     1.3.0     1.4.0     1.4.1      I want to get the part of this output, between two specific lines (not based on line number, based on content):               0.1.0     0.2.0     1.0.0     1.0.1     1.0.2


title: Could not open X display after hostname change

text: I need to change the hostname of my Computer from `localhost.localdomain` to `DESKTOP`. However, I can't manage to do this, even after browsing some of the net. I've changed my hostname with `hostname DESKTOP` The best informations I've found so far as in there : http://stackoverflow.com/questions/20611783/after-changing-hostname-gedit-not- open However, once my hostname is changed to `DESKTOP`, I can't access `gedit` or any other thing that are IHM-linked in my terminal, as a root user. Which I need to do.               $ xauth list     xauth : file /root/.Xauthority does not exist      I can't get to add something to `xauth`, I've tried to type this:               $ xauth add ${DESKTOP}/unix:0 . [Same key as in xauth list as normal user]      Which gives me:               $ xauth: (argv):1:  bad display name "/unix:0" in "add" command      Is there a way to get this to work? I'm on the same machine, I don't use SSH. Oddly, I seem to be able to use `gedit` if I use `sudo -i` to log as `sudo`. But why? And how can I get to work permanently with `su` to log?


title: Modoboa 1.1.1 Deployment Errors

text: I try to install modoboa follow this steps: http://modoboa.readthedocs.org/en/latest/getting_started/install.html I installed modoboa with `pip install modoboa`               Traceback (most recent call last):       File "manage.py", line 10, in <module>         execute_from_command_line(sys.argv)       File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 453, in execute_from_command_line         utility.execute()       File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute         self.fetch_command(subcommand).run_from_argv(self.argv)       File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 272, in fetch_command         klass = load_command_class(app_name, subcommand)       File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 77, in load_command_class         module = import_module('%s.management.commands.%s' % (app_name, name))       File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module         __import__(name)       File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 8, in <module>         from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal       File "/usr/local/lib/python2.7/dist-packages/django/core/management/sql.py", line 9, in <module>         from django.db import models       File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 40, in <module>         backend = load_backend(connection.settings_dict['ENGINE'])       File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 34, in __getattr__         return getattr(connections[DEFAULT_DB_ALIAS], item)       File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 93, in __getitem__         backend = load_backend(db['ENGINE'])       File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 27, in load_backend         return import_module('.base', backend_name)       File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module         __import__(name)       File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 17, in <module>         raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)     django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb          python manage.py syncdb --noinput failed, check your configuration     Traceback (most recent call last):       File "manage.py", line 10, in <module>         execute_from_command_line(sys.argv)       File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 453, in execute_from_command_line         utility.execute()       File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute         self.fetch_command(subcommand).run_from_argv(self.argv)       File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 272, in fetch_command         klass = load_command_class(app_name, subcommand)       File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 77, in load_command_class         module = import_module('%s.management.commands.%s' % (app_name, name))       File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module         __import__(name)       File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 8, in <module>         from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal       File "/usr/local/lib/python2.7/dist-packages/django/core/management/sql.py", line 9, in <module>         from django.db import models       File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 40, in <module>         backend = load_backend(connection.settings_dict['ENGINE'])       File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 34, in __getattr__         return getattr(connections[DEFAULT_DB_ALIAS], item)       File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 93, in __getitem__         backend = load_backend(db['ENGINE'])       File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 27, in load_backend         return import_module('.base', backend_name)       File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module         __import__(name)       File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 17, in <module>         raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)     django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb          python manage.py syncdb  failed, check your configuration     Unknown command: 'migrate'     Type 'manage.py help' for usage.          python manage.py migrate --fake failed, check your configuration     Traceback (most recent call last):       File "manage.py", line 10, in <module>         execute_from_command_line(sys.argv)       File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 453, in execute_from_command_line         utility.execute()       File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute         self.fetch_command(subcommand).run_from_argv(self.argv)       File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 272, in fetch_command         klass = load_command_class(app_name, subcommand)       File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 77, in load_command_class         module = import_module('%s.management.commands.%s' % (app_name, name))       File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module         __import__(name)       File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/loaddata.py", line 11, in <module>         from django.core import serializers       File "/usr/local/lib/python2.7/dist-packages/django/core/serializers/__init__.py", line 22, in <module>         from django.core.serializers.base import SerializerDoesNotExist       File "/usr/local/lib/python2.7/dist-packages/django/core/serializers/base.py", line 5, in <module>         from django.db import models       File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 40, in <module>         backend = load_backend(connection.settings_dict['ENGINE'])       File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 34, in __getattr__         return getattr(connections[DEFAULT_DB_ALIAS], item)       File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 93, in __getitem__         backend = load_backend(db['ENGINE'])       File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 27, in load_backend         return import_module('.base', backend_name)       File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module         __import__(name)       File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 17, in <module>         raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)     django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb          python manage.py loaddata initial_users.json failed, check your configuration     Unknown command: 'collectstatic'     Type 'manage.py help' for usage.          python manage.py collectstatic --noinput failed, check your configuration      I tried to install `pip install MySQL-python` but i recieved this error:               Downloading/unpacking MySQL-python       Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded       Running setup.py egg_info for package MySQL-python         sh: mysql_config: orden no encontrada         Traceback (most recent call last):           File "<string>", line 16, in <module>           File "/tmp/pip_build_root/MySQL-python/setup.py", line 17, in <module>             metadata, options = get_config()           File "setup_posix.py", line 43, in get_config             libs = mysql_config("libs_r")           File "setup_posix.py", line 25, in mysql_config             raise EnvironmentError("%s not found" % (mysql_config.path,))         EnvironmentError: mysql_config not found         Complete output from command python setup.py egg_info:         sh: mysql_config: orden no encontrada          Traceback (most recent call last):            File "<string>", line 16, in <module>            File "/tmp/pip_build_root/MySQL-python/setup.py", line 17, in <module>              metadata, options = get_config()            File "setup_posix.py", line 43, in get_config              libs = mysql_config("libs_r")            File "setup_posix.py", line 25, in mysql_config              raise EnvironmentError("%s not found" % (mysql_config.path,))          EnvironmentError: mysql_config not found          ----------------------------------------     Cleaning up...     Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/MySQL-python     Storing complete log in /root/.pip/pip.log      Seems that error is caused by mysql module but i dont know how i can resolve


title: Unix/Linux process scheduler logs

text: Where can I actually see what decisions did a process scheduler make over a time period? Are there scheduling specific logs maintained by Unix/Linux systems I could take a look or should I be looking for specific lines in general logs?


title: krusader - single queue instead of multiple queues

text: I need to copy a whole bunch of files from various directories onto an external drive. I thought Krusader might be the best tool for this job. As I select and copy different files, a new queue keeps being opened. On Mechanical drives this is not ideal as it causes the hard drive heads to thrash. How do I get a single queue in Krusader?


title: How can I make multiple copies of one folder without merging?

text: When two or more identically named folders are to be copied into or moved to the same location, the default option either in the GUI file manager, or using in a terminal `cp -r --backup=numbered` or `rsync --backup` , is to merge the contents of these folders. Is there any native command to make progressively numbered copies of the actual directories instead, like say folder_copy_1, folder_copy_2 and so on, similar to what happens in windows?


title: How to control desktop applications over SSH

text: Assuming that the wife is _right now_ using our desktop Kubuntu machine, probably surfing the web in Firefox or using Digikam. After logging into the machine via SSH, what can I do to 'pop up' little things to make her smile? I've already figured out that `notify-send "Hi Ety"` will pop up KDE's messaging system and that she'll get the message. Is there anything else I can do, such as maybe start playing a song that she likes with Amarok? I'm not sure if `amarok -e /some-song.mp3` is actually getting sent to Amarok on her desktop. Any other ideas? Anything from the mildly annoying to the very sweet would be appreciated!


title: Windows Remote Desktop login failed with Ubuntu Server 12.4

text: So, I have a server that I have RDC (Remote Desktop Connection) set up on, and I am looking at making it globally available on the internet so that I can access it from anywhere. I am currently in the process of changing the password so that it's more secure now that it's going to be visible on the web, but I'm running into a bit of a snag. I'll use some example passwords here.   * Before I changed my password, I had full access using RDC and my previous password: _abc123_.   * I used passwd to change my password from _abc123_ to _d4f5g6_. The change was successful, but is only fully recognized when I type it at the machine itself, but not from RDC When I try to connect using RDC and use my new password, I get the following error:               connecting to sesman ip 127.0.0.1 port 3350     sesman connect ok     sending login info to sesman     xrdp_mm_process_login_response: login successful for display     started connecting     connecting to 127.0.0.5910     tcp connected     security level is 2 (1 = none, 2 = standard)     password failed     error - problem connecting      Note that the password is currently _d4f5g6_ , and I only get this error when I use _d4f5g6_. If I use any other password including _abc123_ , I get this error:               connecting to sesman ip 127.0.0.1 port 3350     sesman connect ok     sending login info to sesman     xrdp_mm_process_login_response: login failed      Also note that I am typing these credentials within the connection, and they are not cached within RDC, so RDC doesn't seem to be playing into this at all. So, it seems my correct password is getting through a first check just fine, but not through a second check? Here's the kicker; If I change my password back to _abc123_ directly on my server, then I can successfully connect to the server with RDC using _abc123_...


title: Sed - unknown option to `s'

text: I execute a `sed` command in my script:               sed -i "${1}s/${2}=.*/${2}=${REPLY}/" $3      this is the echo:               sed -i 13s/log4j.appender.ROOT2.File=.*/log4j.appender.ROOT2.File=/app/TET/log.log/ /applis/DIAPASON/diapason1/conf/log4j.properties      My error: `sed: -e expression n°1, character 61: unknown option for`s`'


title: How to loop through xargs where each script uses a common env variable

text: Is it possible to initiate 10 of the same shell scripts which also initiate more copies, and have them all use the same env variable? For example: **script.sh:**               #!/bin/bash     export COUNTER=$((COUNTER+1));     echo $COUNTER;     sleep 5;     /script.sh      using `xargs -P 10 script.sh` results in each instance creating its own scope, rather than sharing the same $COUNTER variable I'm essentially trying to deploy `script.sh` 10 initial times, and then when each one completes, it automatically executes `script.sh` again, only this time with the newly incremented `$COUNTER` variable. I've asked a similar question here, and now understand why my previous method does not work, I'm extremely interested in learning what the best way to actually accomplish this will be.


title: the difference in used hard drive space as shown by df and du is HUGE!

text: It seems that du discounts the #open files when calculating the disk usage, and this hit me when I saw that df is showing 100% usage, while du says only 40% is in use. when i looked up on this, i came to realize that there are some open files that are used by the active processes that take up space               sudo /usr/sbin/lsof | grep services      Output:               java       3772      root   44r      REG                9,5     76608   11649161 /services/apache-tomcat-6.0.20/lib/jsp-api.jar     java       3772      root   74r      REG                9,5    724225   16829492 /services/apache-tomcat-6.0.20/webapps/myapp/WEB-INF/lib/mysql-connector-java-5.1.10-bin.jar     smbd       3794      root  mem       REG                9,5      8192   12320776 /services/samba/etc/secrets.tdb     smbd       3794      root    2w      REG                9,5      1096   12320780 /services/samba/logs/smbd.log      the grand total of open files shown by this command (7th column in the output shown) is almost >60% of the total allotted 200GB space. This is surprising to me that i can count on only 40% of my partition for actual storage. Really! is this normal. I use this partition for hosting mysql database, tomcat server, samba, svn etc. What are my options here? How can i tune this up to be able to use all 200GB for my data and not open files, if that is a normal expectation! # Newly added information as per some of your suggestions here is the output from `du`, `df` and `lsof`. the problem i want to resolve is not have too many open files which is unusually occupying more than 50% of the allotted disk space.   1. My /services partition is originally allotted 184GB space (as shown in `df` command)   2. But my `du` command shows only 67GB (649GB-582GB) is occupied (excluding /services/BackupDir which is external drive)   3. while my `lsof` shows that there is 205GB open files (grand total of column#7), which is absurd because 205GB + 67GB is > 184GB!               #df showing the hard drive and the external drive on /dev/sde     >df -h     Filesystem            Size  Used Avail Use% Mounted on     /dev/md0               43G   21G   21G  50% /     /dev/md1              145M   37M  101M  27% /boot     tmpfs                 1.9G     0  1.9G   0% /dev/shm     /dev/md3              230G  168G   63G  73% /sharefolder1     /dev/md4              230G   51G  179G  23% /sharefolder2     /dev/md5              184G  183G  1.4G 100% /services     /dev/md6              138G   33G  106G  24% /home     /dev/md7               94G  3.5G   90G   4% /users     /dev/md8              230G  196G   23G  90% /sharefolder3     /dev/md9              230G  102G  116G  47% /sharefolder4     /dev/md10             459G  367G   69G  85% /sharefolder5     /dev/sde1             459G  141G  318G  31% /services/BackupDir/ext1     /dev/sde2             230G   85G  145G  37% /services/BackupDir/ext2     /dev/sde3             230G  102G  128G  45% /services/BackupDir/ext3     /dev/sde5             230G   47G  183G  21% /services/BackupDir/ext4     /dev/sde6             230G  172G   58G  75% /services/BackupDir/ext5     /dev/sde7             230G   38G  192G  17% /services/BackupDir/ext6     /dev/sde8             230G  188M  230G   1% /services/BackupDir/ext7          #du showing only /services partition on the hard drive the subfolder BackupDir is the mounted external hard drive     >sudo du --max-depth=1 -h /services     1.2G    /services/svn     331M    /services/httpd     582G    /services/BackupDir     16K     /services/lost+found     600M    /services/netbeans-6.8     55G     /services/apache-tomcat-6.0.20     9.3G    /services/apache-tomcat-5.5.25     365M    /services/mysql     3.7M    /services/samba     649G    /services          #lsof command on /services      > sudo /usr/sbin/lsof | grep services     mysqld     3632     mysql  cwd       DIR                9,5      4096   15220739 /services/mysql/lib     mysqld     3632     mysql    1u      REG                9,5     51725   15220742 /services/mysql/log/mysqld.log     mysqld     3632     mysql    2u      REG                9,5     51725   15220742 /services/mysql/log/mysqld.log     mysqld     3632     mysql    3uW     REG                9,5 161480704   15220797 /services/mysql/lib/ibdata1     mysqld     3632     mysql    8uW     REG                9,5   5242880   15220798 /services/mysql/lib/ib_logfile0     mysqld     3632     mysql    9uW     REG                9,5   5242880   15220799 /services/mysql/lib/ib_logfile1     mysqld     3632     mysql   13u      REG                9,5      1024   15220750 /services/mysql/lib/mysql/host.MYI     mysqld     3632     mysql   14u      REG                9,5         0   15220751 /services/mysql/lib/mysql/host.MYD     mysqld     3632     mysql   15u      REG                9,5      2048   15220753 /services/mysql/lib/mysql/user.MYI     mysqld     3632     mysql   16u      REG                9,5      2032   15220754 /services/mysql/lib/mysql/user.MYD     mysqld     3632     mysql   17u      REG                9,5      4096   15220747 /services/mysql/lib/mysql/db.MYI     mysqld     3632     mysql   18u      REG                9,5     17520   15220748 /services/mysql/lib/mysql/db.MYD     mysqld     3632     mysql   19u      REG                9,5      5120   15220759 /services/mysql/lib/mysql/tables_priv.MYI     mysqld     3632     mysql   20u      REG                9,5      3404   15220760 /services/mysql/lib/mysql/tables_priv.MYD     mysqld     3632     mysql   21u      REG                9,5      1024   15220762 /services/mysql/lib/mysql/columns_priv.MYI     mysqld     3632     mysql   22u      REG                9,5         0   15220763 /services/mysql/lib/mysql/columns_priv.MYD     mysqld     3632     mysql   23u      REG                9,5      1024   15220795 /services/mysql/lib/mysql/procs_priv.MYI     mysqld     3632     mysql   24u      REG                9,5         0   15220796 /services/mysql/lib/mysql/procs_priv.MYD     mysqld     3632     mysql   26u      REG                9,5      3072   15220792 /services/mysql/lib/mysql/proc.MYI     mysqld     3632     mysql   27u      REG                9,5      1852   15220793 /services/mysql/lib/mysql/proc.MYD     smbd       3752      root  mem       REG                9,5      8192   12320776 /services/samba/etc/secrets.tdb     smbd       3752      root    2w      REG                9,5      1096   12320780 /services/samba/logs/smbd.log     smbd       3752      root    7u      REG                9,5      8192   12320776 /services/samba/etc/secrets.tdb     smbd       3752      root   24w      REG                9,5      1096   12320780 /services/samba/logs/smbd.log     nmbd       3755      root    2w      REG                9,5      2028   12320784 /services/samba/logs/nmbd.log     nmbd       3755      root    3w      REG                9,5      2028   12320784 /services/samba/logs/nmbd.log     java       3772      root  mem       REG                9,5     17508   11649135 /services/apache-tomcat-6.0.20/bin/bootstrap.jar     java       3772      root  mem       REG                9,5      9341   11649138 /services/apache-tomcat-6.0.20/bin/commons-daemon.jar     java       3772      root  mem       REG                9,5     19399   11649146 /services/apache-tomcat-6.0.20/bin/tomcat-juli.jar     java       3772      root  mem       REG                9,5    795412   11649645 /services/apache-tomcat-6.0.20/lib/poi-scratchpad-3.5-FINAL-20090928.jar     java       3772      root  mem       REG                9,5    383040   11649637 /services/apache-tomcat-6.0.20/lib/commons-io-1.3.2-javadoc.jar     java       3772      root  mem       REG                9,5   1516415   11649642 /services/apache-tomcat-6.0.20/lib/poi-3.5-FINAL-20090928.jar     java       3772      root  mem       REG                9,5   1395266   11649159 /services/apache-tomcat-6.0.20/lib/jasper-jdt.jar     java       3772      root  mem       REG                9,5    103201   11649158 /services/apache-tomcat-6.0.20/lib/jasper-el.jar     java       3772      root  mem       REG                9,5    123820   11649154 /services/apache-tomcat-6.0.20/lib/catalina-ha.jar     java       3772      root  mem       REG                9,5     88209   11649162 /services/apache-tomcat-6.0.20/lib/servlet-api.jar     java       3772      root  mem       REG                9,5    724225   11650061 /services/apache-tomcat-6.0.20/lib/mysql-connector-java-5.1.10-bin.jar     java       3772      root  mem       REG                9,5   1146570   11649156 /services/apache-tomcat-6.0.20/lib/catalina.jar     java       3772      root  mem       REG                9,5    163177   11649641 /services/apache-tomcat-6.0.20/lib/commons-io-1.4-sources.jar     java       3772      root  mem       REG                9,5    109043   11649639 /services/apache-tomcat-6.0.20/lib/commons-io-1.4.jar     java       3772      root  mem       REG                9,5    197445   11649164 /services/apache-tomcat-6.0.20/lib/tomcat-dbcp.jar     java       3772      root  mem       REG                9,5     69040   11649643 /services/apache-tomcat-6.0.20/lib/poi-contrib-3.5-FINAL-20090928.jar     java       3772      root  mem       REG                9,5     27814   11649157 /services/apache-tomcat-6.0.20/lib/el-api.jar     java       3772      root  mem       REG                9,5    391250   11649644 /services/apache-tomcat-6.0.20/lib/poi-ooxml-3.5-FINAL-20090928.jar     java       3772      root  mem       REG                9,5    230149   11649155 /services/apache-tomcat-6.0.20/lib/catalina-tribes.jar     java       3772      root  mem       REG                9,5    275779   11649634 /services/apache-tomcat-6.0.20/lib/commons-fileupload-1.2.1-javadoc.jar     java       3772      root  mem       REG                9,5    513722   11649160 /services/apache-tomcat-6.0.20/lib/jasper.jar     java       3772      root  mem       REG                9,5     87776   11649636 /services/apache-tomcat-6.0.20/lib/commons-io-1.3.2.jar     java       3772      root  mem       REG                9,5    135544   11649638 /services/apache-tomcat-6.0.20/lib/commons-io-1.3.2-sources.jar     java       3772      root  mem       REG                9,5     66144   11649165 /services/apache-tomcat-6.0.20/lib/tomcat-i18n-es.jar     java       3772      root  mem       REG                9,5    499643   11649640 /services/apache-tomcat-6.0.20/lib/commons-io-1.4-javadoc.jar     java       3772      root  mem       REG                9,5     49147   11649153 /services/apache-tomcat-6.0.20/lib/catalina-ant.jar     java       3772      root  mem       REG                9,5     43742   11649166 /services/apache-tomcat-6.0.20/lib/tomcat-i18n-fr.jar     java       3772      root  mem       REG                9,5     57779   11649632 /services/apache-tomcat-6.0.20/lib/commons-fileupload-1.2.1.jar     java       3772      root  mem       REG                9,5     10807   11649152 /services/apache-tomcat-6.0.20/lib/annotations-api.jar     java       3772      root  mem       REG                9,5    750470   11649163 /services/apache-tomcat-6.0.20/lib/tomcat-coyote.jar     java       3772      root  mem       REG                9,5     73721   11649635 /services/apache-tomcat-6.0.20/lib/commons-fileupload-1.2.1-sources.jar     java       3772      root  mem       REG                9,5     49021   11649167 /services/apache-tomcat-6.0.20/lib/tomcat-i18n-ja.jar     java       3772      root  mem       REG                9,5     76608   11649161 /services/apache-tomcat-6.0.20/lib/jsp-api.jar     java       3772      root  mem       REG                9,5    724225   16829492 /services/apache-tomcat-6.0.20/webapps/myapp/WEB-INF/lib/mysql-connector-java-5.1.10-bin.jar     java       3772      root    1w      REG                9,5     79186    9404433 /services/apache-tomcat-6.0.20/logs/catalina.out     java       3772      root    2w      REG                9,5     79186    9404433 /services/apache-tomcat-6.0.20/logs/catalina.out     java       3772      root    5r      REG                9,5     17508   11649135 /services/apache-tomcat-6.0.20/bin/bootstrap.jar     java       3772      root    9r      REG                9,5      9341   11649138 /services/apache-tomcat-6.0.20/bin/commons-daemon.jar     java       3772      root   10r      REG                9,5     19399   11649146 /services/apache-tomcat-6.0.20/bin/tomcat-juli.jar     java       3772      root   11w      REG                9,5     32125    9404434 /services/apache-tomcat-6.0.20/logs/catalina.2013-09-18.log     java       3772      root   12w      REG                9,5     24718    9404435 /services/apache-tomcat-6.0.20/logs/localhost.2013-09-18.log     java       3772      root   13w      REG                9,5      5336    9404436 /services/apache-tomcat-6.0.20/logs/manager.2013-09-18.log     java       3772      root   14w      REG                9,5         0    9404437 /services/apache-tomcat-6.0.20/logs/host-manager.2013-09-18.log     java       3772      root   15r      REG                9,5    795412   11649645 /services/apache-tomcat-6.0.20/lib/poi-scratchpad-3.5-FINAL-20090928.jar     java       3772      root   16r      REG                9,5    383040   11649637 /services/apache-tomcat-6.0.20/lib/commons-io-1.3.2-javadoc.jar     java       3772      root   17r      REG                9,5   1516415   11649642 /services/apache-tomcat-6.0.20/lib/poi-3.5-FINAL-20090928.jar     java       3772      root   18r      REG                9,5   1395266   11649159 /services/apache-tomcat-6.0.20/lib/jasper-jdt.jar     java       3772      root   19r      REG                9,5    103201   11649158 /services/apache-tomcat-6.0.20/lib/jasper-el.jar     java       3772      root   20r      REG                9,5    123820   11649154 /services/apache-tomcat-6.0.20/lib/catalina-ha.jar     java       3772      root   21r      REG                9,5     88209   11649162 /services/apache-tomcat-6.0.20/lib/servlet-api.jar     java       3772      root   22r      REG                9,5    724225   11650061 /services/apache-tomcat-6.0.20/lib/mysql-connector-java-5.1.10-bin.jar     java       3772      root   23r      REG                9,5   1146570   11649156 /services/apache-tomcat-6.0.20/lib/catalina.jar     java       3772      root   24r      REG                9,5    163177   11649641 /services/apache-tomcat-6.0.20/lib/commons-io-1.4-sources.jar     java       3772      root   25r      REG                9,5    109043   11649639 /services/apache-tomcat-6.0.20/lib/commons-io-1.4.jar     java       3772      root   26r      REG                9,5    197445   11649164 /services/apache-tomcat-6.0.20/lib/tomcat-dbcp.jar     java       3772      root   27r      REG                9,5     69040   11649643 /services/apache-tomcat-6.0.20/lib/poi-contrib-3.5-FINAL-20090928.jar     java       3772      root   28r      REG                9,5     27814   11649157 /services/apache-tomcat-6.0.20/lib/el-api.jar     java       3772      root   29r      REG                9,5    391250   11649644 /services/apache-tomcat-6.0.20/lib/poi-ooxml-3.5-FINAL-20090928.jar     java       3772      root   30r      REG                9,5    230149   11649155 /services/apache-tomcat-6.0.20/lib/catalina-tribes.jar     java       3772      root   31r      REG                9,5    275779   11649634 /services/apache-tomcat-6.0.20/lib/commons-fileupload-1.2.1-javadoc.jar     java       3772      root   32r      REG                9,5    513722   11649160 /services/apache-tomcat-6.0.20/lib/jasper.jar     java       3772      root   33r      REG                9,5     87776   11649636 /services/apache-tomcat-6.0.20/lib/commons-io-1.3.2.jar     java       3772      root   34r      REG                9,5    135544   11649638 /services/apache-tomcat-6.0.20/lib/commons-io-1.3.2-sources.jar     java       3772      root   35r      REG                9,5     66144   11649165 /services/apache-tomcat-6.0.20/lib/tomcat-i18n-es.jar     java       3772      root   36r      REG                9,5    499643   11649640 /services/apache-tomcat-6.0.20/lib/commons-io-1.4-javadoc.jar     java       3772      root   37r      REG                9,5     49147   11649153 /services/apache-tomcat-6.0.20/lib/catalina-ant.jar     java       3772      root   38r      REG                9,5     43742   11649166 /services/apache-tomcat-6.0.20/lib/tomcat-i18n-fr.jar     java       3772      root   39r      REG                9,5     57779   11649632 /services/apache-tomcat-6.0.20/lib/commons-fileupload-1.2.1.jar     java       3772      root   40r      REG                9,5     10807   11649152 /services/apache-tomcat-6.0.20/lib/annotations-api.jar     java       3772      root   41r      REG                9,5    750470   11649163 /services/apache-tomcat-6.0.20/lib/tomcat-coyote.jar     java       3772      root   42r      REG                9,5     73721   11649635 /services/apache-tomcat-6.0.20/lib/commons-fileupload-1.2.1-sources.jar     java       3772      root   43r      REG                9,5     49021   11649167 /services/apache-tomcat-6.0.20/lib/tomcat-i18n-ja.jar     java       3772      root   44r      REG                9,5     76608   11649161 /services/apache-tomcat-6.0.20/lib/jsp-api.jar     java       3772      root   74r      REG                9,5    724225   16829492 /services/apache-tomcat-6.0.20/webapps/myapp/WEB-INF/lib/mysql-connector-java-5.1.10-bin.jar     smbd       3794      root  mem       REG                9,5      8192   12320776 /services/samba/etc/secrets.tdb     smbd       3794      root    2w      REG                9,5      1096   12320780 /services/samba/logs/smbd.log     smbd       3794      root    5w      REG                9,5      1096   12320780 /services/samba/logs/smbd.log     smbd       3794      root    7u      REG                9,5      8192   12320776 /services/samba/etc/secrets.tdb     bash      10449  user1  cwd       DIR                9,5      4096   14516225 /services/BackupDir     smbd      10647      root  mem       REG                9,5      8192   12320776 /services/samba/etc/secrets.tdb     smbd      10647      root    2w      REG                9,5     50351   12320785 /services/samba/logs/sridevi-pc.log     smbd      10647      root    7u      REG                9,5      8192   12320776 /services/samba/etc/secrets.tdb     smbd      10647      root   27w      REG                9,5     50351   12320785 /services/samba/logs/sridevi-pc.log     rsync     11030  user1    3r      REG               9,10  21418176   23955858 /internalfile500GB/BackupDir/fileserver_services_bkup/internalfile-root-bkup/services/services/BackupDir/internalfile_repository_bkup/cng_repository/Deepak/DissertationDefense/Dissertation/Expression/Expression Encoder/Screen Capture Output/ScreenCapture_7-25-2011 4.55.33 PM.xesc     smbd      11267      root  mem       REG                9,5      8192   12320776 /services/samba/etc/secrets.tdb     smbd      11267      root    2w      REG                9,5      6298   12321110 /services/samba/logs/drwindows8.log     smbd      11267      root    7u      REG                9,5      8192   12320776 /services/samba/etc/secrets.tdb     smbd      11267      root   28w      REG                9,5      6298   12321110 /services/samba/logs/drwindows8.log     smbd      11334      root  mem       REG                9,5      8192   12320776 /services/samba/etc/secrets.tdb     smbd      11334      root    2w      REG                9,5      5918   12321012 /services/samba/logs/nmo-dataprocess.log     smbd      11334      root    7u      REG                9,5      8192   12320776 /services/samba/etc/secrets.tdb     smbd      11334      root   32w      REG                9,5      5918   12321012 /services/samba/logs/nmo-dataprocess.log     smbd      11489      root  mem       REG                9,5      8192   12320776 /services/samba/etc/secrets.tdb     smbd      11489      root    2w      REG                9,5      3484   12320915 /services/samba/logs/hippocampus-pc.log     smbd      11489      root    7u      REG                9,5      8192   12320776 /services/samba/etc/secrets.tdb     smbd      11489      root   28w      REG                9,5      3484   12320915 /services/samba/logs/hippocampus-pc.log     sudo      11525      root  cwd       DIR                9,5      4096   14516225 /services/BackupDir     grep      11526  user1  cwd       DIR                9,5      4096   14516225 /services/BackupDir     lsof      11527      root  cwd       DIR                9,5      4096   14516225 /services/BackupDir     lsof      11528      root  cwd       DIR                9,5      4096   14516225 /services/BackupDir          #the size of deleted files in column#7 is 0 bytes!     > sudo /usr/sbin/lsof | grep deleted     mysqld     3632     mysql    4u      REG                9,0         0    7070979 /tmp/ibjpoC3F (deleted)     mysqld     3632     mysql    5u      REG                9,0         0    7070980 /tmp/ibTKRzCQ (deleted)     mysqld     3632     mysql    6u      REG                9,0         0    7070981 /tmp/ibvuExb1 (deleted)     mysqld     3632     mysql    7u      REG                9,0         0    7070983 /tmp/ibYLMOLb (deleted)     mysqld     3632     mysql   11u      REG                9,0         0    7070984 /tmp/ibQfuW1m (deleted)     gpm        3690      root    0u      CHR              136,0       0t0          2 /dev/pts/0 (deleted)     gpm        3690      root    1u      CHR              136,0       0t0          2 /dev/pts/0 (deleted)     gpm        3690      root    2u      CHR              136,0       0t0          2 /dev/pts/0 (deleted)


title: Running external commands in vim

text: It seems that if I run the following inside the `vim`: `:w !wc -w` I get the word count of the file. But I don't understand the syntax. How does this work and how would I specify that I want the word count of a paragraph and not of the whole file?


title: cw and . does not work as expected in vim on character deletion

text: If I have the following non-sense text:               Hi woman! What is your name? I know what you mean...       Yeap.       Yeap. Again :)       Hi woman! What i s your name? I know what you mean...       Yeap.       Yeap. Again :)       Hi woman! What is your name? I know what you mean...       Yeap.       Yeap. Again :)       Hi woman! What is your name? I know what you mean...       Yeap.       Yeap. Again :)        and I want to replace all occurences of `woman` with `man` I do:   Go my cursor to the first occurence of `woman` which is on the first line. I press `*` and all occurrences are highlighted.   Then I type `cw` and delete `w` and `o` and press `ESC`.   Then I press `n` and move to the next occurrence.   Then I type `.` and expect that `wo` will be removed. But only `w` is deleted. Why?


title: Delete IP address alias by label name

text: I would like to delete an alias I created using:               ip addr add 192.168.1.1 dev eth0 label eth0:100      without having to know the IP address. Basically, I would like to do               ip addr del dev eth0 label eth0.100      which, according to documentation should be valid, but rather gives me:               ip: RTNETLINK answers: Operation not supported      In the mean time, I worked around using               ip addr del $(ip addr list label eth0:100 | awk '{ print $2 }') dev eth0 label eth0.100


title: How does xdg-open do its work

text: According to the man page, `xdg-open` will open a file using the application the user has configured. But how is that application actually determined? I can see no config files associated with `xdg-utils`, so where are my settings stored and how can I modify them? Seeing how a simple PNG file opens Internet Explorer using Wine, I see urgent need to change these settings.


title: Problem when splitting command with backslash in unix prompt

text: I often use the space-backslash combination ( ) to split a command and its parameters into various lines and make it more readable:               /home/user> ls -ltra \     > file1.txt \     > file2.txt      Recently I used an instruction with a similar format on my terminal window. Since I was going use the same files in various instructions, I decided to highlight\copy the whole command with my mouse and paste them in an open editor.   Unfortunately,   1. I only highlighted with my mouse the two file lines and    2. pasted them by mistake into the same terminal window: Like this:               /home/user> > /home/user/file1.txt     > > /home/user/file2.txt      They system thought I was overwritting the files. The data was lost. Fortunately, there was backup! Now my question: Can a terminal session be re-configured so it uses a symbol, other than the > sign, at the start of a split command? Something which won't have such horrendous consequences. Example:               /home/user> ls -ltra \     # file1.txt \     # file2.txt      ## UPDATE I am using Korn shell (/usr/bin/ksh) on a Solaris server. Korn is the company's default shell.


title: How can I remove Orphan Packages in Fedora?

text: I just switched from Ubuntu to Fedora14. In Ubuntu we had the `apt-get autoremove` thing to remove orphan/unused packages. What is the counterpart in Fedora?


title: Terminal change keys

text: Is it possible in the unix terminal to change the keys so that when I press for instance `,` then `_` gets printed? And if so, how do I go about doing that? (I'm on Ubuntu, by the way.)


title: Deploy libs in hard-coded dir

text: I have a set of libraries and some apps that depend on it. Some of these libraries names might conflict with already installed libraries. The easiest way for me to deploy them would be   * Install the libraries in a fixed-path "/usr/local/[my-firm]/lib"   * Compile my apps with a rpath pointing to this path   * My apps' installer can tell if the libraries are installed by looking at something like "/usr/local/[my-firm]/libversion" What do you think about it ? Is installing the libraries in a fixed path acceptable ? **Edit** I should add that I wish to be able to ship my libraries and my apps independently.


title: Emacs/Lisp interactive string variable scoping

text: Why doesn't this work?               (defun load-browser (app)         (interactive "sChoose Browser? ")         (cond ((string= app '"c")             (setq browse-url-generic-program "chromium")             (setq browse-url-browser-function 'browse-url-generic))         (message "Else case Typed %s" app)         )     )      It fails to work in the Else case where the input string/char is not "c".


title: How to compose bash functions using pipes?

text: I have few functions defined in this fashion:               function f {       read and process $1       ...       echo $result     }      I want to compose them together so that invocation would look like `f | g | h`. What idiom shoud I use to convert function working on arguments to one reading arguments from stdin? Is it possible to read pairs, tuples of arguments from stream without need to escape them (e.g. null terminating)?


title: grep to extract a substring from a huge string

text:
I am extracting certain information from a website using `curl` command. I need to extract a certain subsection of the string using grep command. For example, using curl command I am getting the HTML page and storing in a variable as below.               page="$(curl http://www.somewebsite.com)"      My extracted HTML page is as below.                         --------     --------     --------

Sub heading here

     ----------     ----------           Now, I need to extract the subsection of the entire div with **id="id1"**. I tried the below command.               output="$(curl http:/somesite.com | grep "id="id1")"      It just gets me the 2 lines where I have id=id1. I need to extract the entire contents between the and tag.


title: apt-show-versions - Maybe no deb entries

text: When installing Ajenti I get this error:               Error: No information about packages! (Maybe no deb entries?)     E: Problem executing scripts APT::Update::Post-Invoke-Success 'test -x /usr/bin/apt-show-versions || exit 0 ; apt-show-versions -i'     E: Sub-process returned an error code      I have cleared all files in /var/lib/apt/lists. I have cleared all entries and added one-by-one from /etc/apt/sources.list. I have rebooted, twice. apt-get update gives the same error. I have tried 'dpkg --configure -a' It returns this message:               Setting up apt-show-versions (0.22.3) ...     ** initializing cache. This may take a while **     Error: No information about packages! (Maybe no deb entries?)     dpkg: error processing package apt-show-versions (--configure):      subprocess installed post-installation script returned error exit status 255     dpkg: dependency problems prevent configuration of ajenti:      ajenti depends on apt-show-versions; however:       Package apt-show-versions is not configured yet.          dpkg: error processing package ajenti (--configure):      dependency problems - leaving unconfigured     Errors were encountered while processing:      apt-show-versions      ajenti      Then I have read the first 30 hits in Google, followed all steps in all threads that came out. Deleted all .gz files, created 'partial' directory etc. Linux debian-imx6 3.0.35-g0f2006c-dirty #161 SMP PREEMPT Tue Dec 31 14:06:45 IST 2013 armv7l GNU/Linux All commands executed as root. I read some stuff about bugs, some stuff about bad files in apt dir and some other stuff, I'm looking for some directions on how to fix apt-show-versions. * * *               root@debian-imx6:~# ls -la /usr/bin/apt-show-versions /var/lib/dpkg     -rwxr-xr-x 1 root root 34551 sep 30 12:15 /usr/bin/apt-show-versions          /var/lib/dpkg:     total 4424     drwxr-xr-x  7 root root    4096 feb  8 01:18 .     drwxr-xr-x 47 root root    4096 feb  8 01:03 ..     drwxr-xr-x  2 root root    4096 feb  8 01:11 alternatives     -rw-r--r--  1 root root 1038192 feb  8 01:05 available     -rw-r--r--  1 root root 1010493 feb  8 00:04 available-old     -rw-r--r--  1 root root       8 nov 15 23:21 cmethopt     -rw-r--r--  1 root root     560 dec 16 21:23 diversions     -rw-r--r--  1 root root     448 dec 16 21:23 diversions-old     drwxr-xr-x  2 root root  249856 feb  8 01:17 info     -rw-r-----  1 root root       0 feb  8 01:17 lock     drwxr-xr-x  2 root root    4096 okt  1 21:25 parts     -rw-r--r--  1 root root     116 feb  8 01:11 statoverride     -rw-r--r--  1 root root      70 nov 15 23:30 statoverride-old     -rw-r--r--  1 root root 1086813 feb  8 01:18 status     -rw-r--r--  1 root root 1086813 feb  8 01:17 status-old     drwxr-xr-x  2 root root    4096 feb  8 01:09 triggers     drwxr-xr-x  2 root root    4096 feb  8 01:18 updates      * * *               root@debian-imx6:~# apt-show-versions -iv     Unknown option: iv      * * *               root@debian-imx6:~# apt-show-versions -i -v     Error: No information about packages! (Maybe no deb entries?)


title: Find a file which is 30 minutes old

text: How can I find the file which is of 30 minutes old in `/bin/ksh`?


title: Play .wav when text scrolls in terminal

text: After watching a TV show, I came up with a fun idea. Is there a way to take that cheesy high-pitched sound effect they play every time text scrolls down a command-line screen on TV and play it when text scrolls in my terminal window (talking X here)? Bonus points if you can modulate it with the amount/speed of scrolling text.


title: BASH and Subshells

text: From what I gather from the online docs, the following should spawn a subshell for the part of the command embedded with `{}`:               $ bash -c '{ sleep 10; echo "Sleeping process", $$; }  & echo $$; '     11237      Sleeping process, 11237      However as you can see, in both cases the process ID is the same. What am I missing? Thanks for any pointers.


title: How to custom build debian's busybox?

text: I'm building an embedded system based on debian 7, and I'd like to make the most out of busybox that comes with debian. The problem is default busybox build in debian seems quite minimal, for example it does not even include `passwd`. On the other hand I don't want to build busybox from busybox.net sources for stability and update issues. So how can I build and install a bigger busybox from debian source package?


title: How do I copy directories and symlink files?

text: I have got a directory of huge files (total ~ 1TB) and I don't want copy them around. However, I'd like to work around them, so it would be convenient to have them linked in a directory hierarchy I have access to (aka one I created). So               /path/to/dirs/       foo       bar       baz/         tri      Should be copied to               ~/path/to/dirs/       foo -> /path/to/dirs/foo       bar -> /path/to/dirs/bar       baz/         tri -> /path/to/dirs/tri


title: How to assign result of sed to variable

text: Below is a complete copy of a demo I'm using to to figure out to get the `sed` command to get rid of the spaces in a persons name, and compress it down to not have spaces. Once this is done, I want to assign it to the variable `comp` then I can re- use it later on in the script. Here I am just trying to `echo` it to the stdout so I can see it worked. If I run the script and enter my name as `Ronald McDonald` the result I get returned is `RonaldMcDonald}` with that curly brace on the end of his name, or whatever I type in. How do I get it to work, so that the result doesn't append the `}` to the back of the assigned text.               #!/bin/bash          function readName {         echo "Enter your full name:"         read fullName         clear     }    # end readName          function cmprsName {         comp={ echo "$fullName" } | sed 's/ //g'     }    # end cmprsName          function sayItNow {         echo $comp     }    # end sayItNow          function allTogether {         readName         cmprsName         sayItNow     }    #end allTogether          case $1 in             -h | --help )           allTogether                                     exit                                     ;;             * )                     echo "$0 -h"                                     exit 1     esac


title: permission on a user I added locally

text: I added a user to my Mint (Ubuntu) Desktop so that he could ftp files that I can share - I am peter he is john, so we have `/home/peter` and `/home/john`. I want to have full permissions on his home share, so I can copy files to and from the shared drive but not give him access to my home directory. I assumed that I could add myself to the john group would be enough (no) I have tried various options with no success (Brute force I can `sudo cp` to my home directory then change ownership)


title: What do GDIR, GREG, VDIR, VREG mean in lsof output

text: The `lsof` manpage says the following about the `TYPE` column. > TYPE is the type of the node associated with the file - e.g., GDIR, GREG, > VDIR, VREG, etc. Can someone please explain (or point me to a link which explains) what these mean. I have tried googling on these but all the links take me to the lsof man page only. If you find a link, do tell me how you googled it :)


title: Trouble w/ bash programmable completion of filenames matching patterns

text: I've got a simple command named `th`. I've got a bash-completion file for it that goes as follows:               _th()  {       COMPREPLY=()       local curr=${COMP_WORDS[COMP_CWORD]}       COMPREPLY=( $(compgen -f -X '!*.@(tar|tar.xz|tar.bz2|tar.gz|tbz|tgz)' -- "$curr") )     }                     complete -F _th -o filenames th      This works as intended, for the most part. For arguments to my `th` function, BASH only tab-completes files ending in `.tar`, .`tar.xz`, etc. Two problems:   1. The matching is case-sensitive. Not all tar files have lower-case extensions. (Using `shopt` to set `nocaseglob` inside the bash-completion file doesn't work.)   2. The matching chokes on multi-word filenames, e.g. files with spaces in their names.              [rsaw:blahb]$ ls     bam.tgz  boom.TGZ  sad.TAR  spaces in this-file.tbz     [rsaw:blahb]$ th<tabtab>     bam.tgz        in             spaces         this-file.tbz       [rsaw:blahb]$ th spa<tabtab>     in             spaces         this-file.tbz       [rsaw:blahb]$ th spaces<tabtab>   # At this point I added a backslash and pressed tab until 4 backslashes appeared     in             spaces         this-file.tbz       [rsaw:blahb]$ th spaces\\\\<tabtab>   # At this point, nothing else happened       Any help appreciated!


title: gnuplot lost the plot

text: I'm experimenting with evolutionary algorithms and I have written two text files that I cannot get the plot. Based on the information on google, I think I have the format correct. (generation-number) (tab) (best-fitness) for example: 1 231 2 240 3 245 ... To plot this, I start gnuplot and I am greeted by the welcome screen. I then type: plot 'ga.txt' The cursor immediately returns and nothing is plotted. I am using 64 bit Mint with Mate.


title: creating abbreviations for commonly used paths

text: I am new to linux and was wondering whether it is possible to create abbreviations that can be used in terminal. I know about `alias` command, but am not sure whether that can be used for what I am looking for. Example: Say I often need to copy stuff from folder `~/Dropbox/thisfolder`. I know that I can create a shortcut to switch to this folder by creating an alias, such as,               alias tf="cd ~/Dropbox/thisfolder"      However, if I do               alias justpath="~/Dropbox/thisfolder"      then, I cannot use commands such as `cp justpath/blahfile ./`. Is it possible to do something like this using some other way to abbreviate the path `~/Dropbox/thisfolder`?


title: No network connection in CentOS 6.3 Minimal under VMWare Player

text: I'm trying to replicate in VMWare Player the exact same conditions I have under my Dedicated Server for testing purposes. Now, the thing is that that when I try to install something, or ping http://google.com, it fails since it has no connection. what do I do to fix it?? Screenshot I'm not much of a sys admin, but i'll get there (This is my first Dedicated Server), I ordered a minimal OS to **learn**.


title: Proper way to disable tmpfs on /run/shm

text: How do I disable `tmpfs` on `/run/shm`? I searched through initscripts and found that the following code checks the entry in `fstab`, but what should I change to make it not mount `/run/shm`? I'm running Debian sid. ### /lib/init/mount-functions.sh               read_fstab_entry () {             # Not found by default.             found=1                  for file in "$(eval ls $(fstab_files))"; do                     if [ -f "$file" ]; then                             while read MNT_FSNAME MNT_DIR MNT_TYPE MNT_OPTS MNT_FREQ MNT_PASS MNT_JUNK; do                                     case "$MNT_FSNAME" in                                       ""|\#*)                                             continue;                                             ;;                                     esac                                     if [ "$MNT_DIR" = "$1" ]; then                                             if [ -n "$2" ]; then                                                     [ "$MNT_TYPE" = "$2" ] || continue;                                             fi                                             found=0                                             break 2                                     fi                             done < "$file"                     fi             done                  return $found      ### Function callsite                if read_fstab_entry /run/lock; then                 if [ "$MNT_TYPE" = "tmpfs" ] ; then                     RAMLOCK="yes"                 else                     RAMLOCK="no"                 fi             fi      ### Later               if [ yes = "$RAMLOCK" ]; then                     domount "$MNTMODE" tmpfs shmfs /run/lock tmpfs "-o${NODEV}noexec,nosuid$LOCK_OPT"                     # Make sure we don't get cleaned                     touch /run/lock/.tmpfs             else                     chmod "$LOCK_MODE" /run/lock             fi


title: Very basic question, ls a different directory and save file

text: I seriously can't understand where I'm going wrong with his question. The first part is. _List all the file and directory names in /etc which have 1 or more numbers in their name. Remember to use "-d" in the ls command, and do not descend into subdirectories (i.e. no recursion). Save this list in caine's home directory as a file called "digit". Do the "ls" command when CDed to /etc, thus your names avoid having "/etc/" stuck in front of them._ Which is have done with the following command:               ls -d *[0-9]* > digit      However, the second part of the question is; _Redo the previous question, except this time repeat the exercise when CDed in /home/caine. Save the output in digit2. "digit" and "digit2" should be identical, except in "digit2" all the filenames will begin "/etc/"._ I thought the following code would work;               ls -d ../../etc/ *[0-9]* > digit2      When I cat the contents of the file, it appears to have ignored the parameters I have set using the *'s and numbers, I have tried moving the statement around and I am stumped as to why this isn't working. Any advice, or pref an explanation as to where I am going wrong would be much appreciated. I know this could be achieved with grep, but even though I've moved on to that and am learning it, I'd still really like to know how I can't get the right syntax for this!


Can Debian linux find automaticaly drivers for USB ethernet NIC? Which would you recommend me? My problem is, on my datastore, there is only 100mbps network, no free PCI slots, so last chance how to speedup my datastore is to add next USB NIC. Is it useful to buy 1Gbps NIC to USB if usb 2.0 has only 480mbps speed ? Or actually, is it better, than buy USB NIC 100mbps ? Do you think, could I use it with debian for loadbalancing? Is there support in drivers for loadbalancing? Next solution is to add about 3 or 4 USB nic, that could make solution .-)


title: How to prevent tmux from reading .profile/.zprofile/.bash_profile

text: **The original question** Is it possible to override `tmux`'s default behaviour of executing `.[z|bash_]profile` files on every new session, window and pane? In other words, I'd like it to only execute only the relevant `.[zsh|bash]rc` script, i.e. for the new session/window/pane to behave like an `xterm` or `urxvt`, not like a `tty`. **More specifically (edit)** I'd like to avoid changing anything to my `.*profile` and `.*rc` scripts. I'm looking for a way to ask `tmux` to open non-login shells in its new sessions, windows and panes by properly configuring it in `.tmux.conf`, in order to keep the prior philosophy of putting only actual 'login' instructions on `.*profile` scripts, as recommended for instance here: What should/shouldn't go in .zshenv, .zshrc, .zlogin, .zprofile, .zlogout? I am aware on how to circumvent the issue by hacking e.g. `.zprofile` as was answered to Changing tmux .bash_profile behavior , but the question is of how to do it from `.tmux.conf` **Secondary question** Why does `tmux` load the `.*profile` scripts by default, on **every** session, window and pane, whereas subshells on any context and all (or at least most) variants of X terminals don't? **Some background information (not necessarily relevant)** I barely started using `tmux` (only occasionally, for now), but I do have an ever-evolving setup, using `zsh` as my shell of choice, in which `.zprofile` expects to be called from a `tty` and do relevant stuff (like deciding to run `startx` or not based on whether it's on a laptop and the tty number), the `.zshrc` script expects to be called from any interactive environment and the `.zshenv` script expects to be loaded whether on an interactive environment or not. **EDIT: Solution (based on comments below)** Adding the following line to `.tmux.conf` overrides `tmux`'s behaviour and defaults to starting non-login interactive shells (zsh in this case) on new sessions, windows and panes:               set-option -g default-command zsh


title: What's stealing my F11 key?

text: I've just installed Arch Linux with LXDE and Openbox on my Asus Eee PC 1000. I can't get my F11 key to work in any application. It doesn't appear to do anything when I press it. I installed `xev`, and the F11 key doesn't generate a KeyPress event like the other function keys do. Here's what I get when I press F12:               KeyPress event, serial 46, synthetic NO, window 0x2400001,         root 0xac, subw 0x0, time 11144523, (-49,121), root:(789,347),         state 0x0, keycode 96 (keysym 0xffc9, F12), same_screen YES,         XLookupString gives 0 bytes:          XmbLookupString gives 0 bytes:          XFilterEvent returns: False          KeyRelease event, serial 46, synthetic NO, window 0x2400001,         root 0xac, subw 0x0, time 11144627, (-49,121), root:(789,347),         state 0x0, keycode 96 (keysym 0xffc9, F12), same_screen YES,         XLookupString gives 0 bytes:          XFilterEvent returns: False      The other function keys look similar. But here's what I get when I press F11:               FocusOut event, serial 46, synthetic NO, window 0x2400001,         mode NotifyGrab, detail NotifyAncestor          FocusIn event, serial 46, synthetic NO, window 0x2400001,         mode NotifyUngrab, detail NotifyAncestor          KeymapNotify event, serial 46, synthetic NO, window 0x0,         keys:  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0                   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0         In `~/.config/openbox/lxde-rc.xml` I found this snippet:               <!--keybindings for LXPanel -->     ...     <keybind key="F11">       <action name="ToggleFullscreen"/>     </keybind>      But I commented that out, logged out, and logged back in. It didn't make any difference. How do I get my F11 key back? I use full screen in Firefox all the time, and I need it.


title: Create file with specific formatting from directory contents

text: I am using Solaris and csh. In `$home/test` there are five files: `a.txt`, `b.txt`, `c.txt`, `d.txt` and `e.txt`. If I run               % find $home/test/ -type f -print > ../filenames.txt      that file will look like:               /home/me/test/a.txt       /home/me/test/b.txt       …     /home/me/test/e.txt        I need to add `␣none` after each line, so that I can use the text file as the input to another script. i.e.:               /home/me/test/a.txt none       …     /home/me/test/e.txt none        This simple problem is causing me issues.


title: How to add a custom button to KDM

text: I want to add a button to KDM. It should just be able to start a script. Is there a way to add such a custom button to KDM?


title: unable to install KDE on Ubuntu 13.04

text: I am unable to install KDE on my Ubuntu 13.04.It gives me the following error:                       The following packages have unmet dependencies:             kde-standard : Depends: kde-plasma-desktop (>= 5:76~pre1ubuntu10)  but it is not going to be installed or             kde-plasma-netbook (>= 5:76~pre1ubuntu10) but it is not going to be installed             Depends: kscreensaver (>= 4:4.9.97) but it is not going to be installed             kubuntu-desktop : Depends: kde-workspace but it is not going to be installed             E: Unable to correct problems, you have held broken packages.             kanwar@kanwar-IdeaPad-Z585:~$       How to correct these codes


title: How to preserve special characters highlighting when converting to HTML?

text: I have an issue with the `:TOhtml` command. It works great, but it doesn't preserve the `list` option. If I do:               :set list listchars=tab:>-,trail:.,extends:>     :TOhtml      The special characters highlight is missing in the generated HTML file. Any idea how to fix that?


title: Error with if [ -n $diffCurr ]: Too many arguments

text: I have been using the below code ok for sometime, but now, I get an error               java Editor < "input/editor$i.in" > "tmp/editor$i.out"     diffCurr="$(diff "tmp/editor$i.out" "output/editor$i.out")"     if [ -n $diffCurr ]      Error (occurs on last line of above snippet): > [: too many arguments Whats wrong? I am trying to test that the diff result was empty (ie. same contents in file)


title: Popularity contest for Fedora and friends?

text: For Debian and Ubuntu there is the populartiiy contest package and result pages (Popcon). Is there something similar for Fedora? And what about derivatives like RHEL, CentOS, Scientific Linux etc.? I found just old proposals and a blog post of an Open Suse effort from 2009. What is the current status of such efforts?


title: no default repositories in yum

text: I am trying to install gtk-murrine-engine on my RedHat Linux Client 5.5 using yum install. It says package not available. It appears that there only exists some local repositories in yum , pertaining to my company use. Is there any way i can add the default repositories that normally exists , so that i can install other applications too?? PS: It is not a single case. I have been trying to install other packages too and gives the same error.


title: Linux Mint 11 won't connect to Windows 7 Wireless Ad Hoc

text: I apologise if this question has been asked before, but I am not exactly sure what I should be looking for, hence my reason for posting a new question. I am a newbie to Linux and have been using Linux Mint 11 for the past few days on a 2GB USB pen drive to test it out My problem is to do with connecting to a Windows 7 wireless ad hoc network. The reason for setting up a wireless ad hoc network in windows 7 is because to connect to the internet we have to use a Softbank 3G mobile USB dongle (Sorry I don't know the proper word for it), but we only have one of them, so our other laptops/devices need to use the main laptop, which is running Windows 7, as a kind of internet access point. I have setup the the windows 7 wireless ad hoc network and devices like the iPod touch connect to the network and can use the internet without any problem. But the laptop which is running Linux Mint 11 from a USB pen drive (The HDD is dead) can't connect. I can see the ad hoc connection in the wireless connections menu and I can click on it and provide a password, but it always fails to connect asking for the password each time it fails. Does anybody know what the problem could be? Is there any solution to this? Any help would be greatly appreciated! And of course if more information is needed please let me know.


title: Failure to recover grub2 after installing arch-linux

text: I am currently installing and and re-installing Arch Linux for learning purposes. As I don't have a secondary machine, I have to do it on my main one. The thing is - I couldn't find a way to avoid installing grub in the installation process of Arch. That's another problem, but I fail to use `boot-repair` as explained here to make Ubuntu my default OS again. After installing Arch I get grub1 booting, and it doesn't have entries to log into my Ubuntu system, and I don't really know how to edit grub. I prefer just restoring grub2 used by Ubuntu. My question is simple - how do I do that? Thanks in advance


title: where are the spamassassin KHOP rules?

text: I have this spamassassin implementation where I lowered the score on: **KHOP_BIG_TO_CC** It works when I override the score in my /etc/mail/spamassassin/local.cf file but I cannot find the .cf file that holds this specific rule. Checked both the locations where rules are kept:   * /usr/share/spamassassin   * /etc/mail/spamassassin And also some local users home folder like   * /root/.spamassassin/   * /var/amavisd/.spamassassin/  Did a grep on the directories like this:               grep -r "KHOP_BIG_TO_CC" /<directory/path/*      but nothing, I find other KHOP rules but never this one although it shows up in the xspam headers. Now I have read somewhere that there exists an khop channel: http://khopesh.com/wiki/Anti-spam however, the only channel I read with sa-update is "sought.rules.yerp.org" Does anyobody recognize the **KHOP_BIG_TO_CC** rule and knows where i can find it?


title: How to find text in files and only keep the respective matching lines using the terminal on OS X?

text: I am pretty new to the terminal and command lines, from what I have found out grep seems to be the right tool for search files for specific text strings. I have a folder with many huge text files and I would like to to only keep those lines of each file that contains a certain string (e.g. "/foobar"., for instance:               file1 (no file ending)           1. lorem ipsum      2. trololo /foobar abc      3. dolor sit      4. foobar def      shall afterwards be:                1. trololo /foobar abc      2. foobar def      I guess the command looks something like this               grep -wE "(/foobar)"       but I have no clue how to tell the command to only keep those lines and do that for each file that you find in the current folder. Would you do that with `find` or does grep have an own functionality for that? Something like:               find ./* -exec do grep stuff here


title: Getting data section with maximum element

text: I have some data stored in JSON-like format.               {         {             value1: 14,             value2: 12,             value3: 1         },         {             value1: 4,             value3: -1         }     }      How can I get subsection with maximum 'value3' value using `awk` (which is most preferable and related to that kind of problems, I think), `sed` or `grep`? So, this output is expecting:               {         value1: 14,         value2: 12,         value3: 1     }


title: Is it possible to stop emacs from down translating my key chords?

text: `emacs` has the default behaviour of double-guessing which key-combo (chord) I've pressed. It automatically down-translates to a lesser chord when the key- combo I pressed is unassigned, eg. `<C-M-up> (translated from <C-M-S-up>)` How can I turn this off? I really can't see any value in it, but it must be for some users. I'd also like to know what advantage this (dubious) feature offers...


title: automatic proxy selecting depending on target

text: Situation:   * ISP with proxy server   * local TOR service I would like to automatically let all .onion-domain traffic go to the local TOR-service and all other traffic to the ISP proxy (am using TOR only to browse the hidden TOR sites, not for privacy). Now I was thinking of using Squid for that. Squid can automatically select a parent proxy depending on the target (with the plus that it then also caches the slow tor sites) but I could not find a way to let it connect to the TOR socks5 service. Anyone got an idea how to do this? Thanks.


title: shell commands to check & create dir

text: I am writing a Ruby script inside which I would like to invoke/execute some **shell commands**. The shell commands I would like to run should check if a directory named ' **tmp** ' under `/var/lib/mysql/` exists or not.   * if it exists, remove all the files (including sub-dirs & files) inside `/var/lib/mysql/tmp/`.    * If it does not exist, just create it. ( **P.S.** only root user can access `/var/lib/mysql/`) I know `mkdir` will create directory, but I am not sure **how to make a command to check if the directory exists or not**. As a whole, I would like to have some shell commands to achieve the scenario described above, and **the more elegant way the better** , as I will run the shell commands in a ruby script. Anyone can Help me ?


title: Add additional processing in an automake build for one object

text: I'm trying to make a small change to an automake build. The system to modify uses `configure.ac` and `Makefile.am` inputs. For a single object file within one subdirectory I have to invoke a script before compiling, to patch config info into the build. I don't see the right location to allow such pre-processing ahead of compiling this specific C file. What I've tried is to insert an additional target into               all: all-am      But this seems not to be the way to go and in addition I wasn't able to figure how to overload this generated line.


title: How to perform a dry-run using rsync over ssh?

text: I got these errors while trying to perform a dry-run with option `-n` over ssh on a remote server:               # rsync --progress --delete -avhHen ssh /etc/yum root@my.ipaddress:/etc     rsync: Failed to exec n: No such file or directory (2)     rsync error: error in IPC code (code 14) at pipe.c(85) [sender=3.1.0]     rsync: connection unexpectedly closed (0 bytes received so far) [sender]     rsync error: error in IPC code (code 14) at io.c(226) [sender=3.1.0]      How do I perform a dry-run for the above command using rsync over ssh?


title: Alias from .bash_profile is not reflected across the system

text: I have few path settings and alias in .bash_profile, and I am exporting those. For example:               alias gcc=/abc/def/......./myrtgcc     export gcc      And I want use **myrtgcc** to compile C programs either from terminal or from Eclipse using the command `gcc`; I expect the system to run `myrtgcc somfile.c -o output`. However this is not the case. Even after adding the above alias in `.bash_profile`, and restarting the system ( or using `source .bash_profile` ) the changes are not reflected: If I open the terminal and type `which gcc`, I get `/usr/bin/gcc` and when eclipse uses "GCC" command it again invokes the same `/usr/bin/gcc`. How do I make **myrtgcc** default across the system, for command **gcc**


title: nohup and screen not working when running program in background?

text: I don't why but my `screen` command running on server is stopping on its own. Therefore I tried to use `nohup`. e.g:               nohup bzcat a.bz      But when running `nohup` it is giving me               nohup: ignoring input and appending output to `nohup.out'      Also in order to resume I run: `fg` which gives me:               -bash: fg: current: no such job


title: Openbox doesn't seem to have correct environment variables set

text: I've installed Debian 7.0, and then installed Openbox on top of it. I've got some executable files in `~/bin`, and this line in my `.bashrc` and `.profile`:               export PATH="$HOME/bin:$PATH"      I can normally execute the programs when I'm using the terminal, but when I'm using Openbox keyboard shortcuts, configured in `~/.config/openbox/rc.xml`, then Openbox complains about not being able to find a file or a directory. What can I do to have Openbox use the correct `$PATH`?


title: How to retrieve information about locked accounts

text: Is it possible to retrieve info regarding to locked unix accouts? I am interested in seeing information about what date and time the lockout happend and from what hostname (pc name). I would like to see something similar to the `who` command.


title: trying to setup cntlm on ubuntu for NTLM authentication

text: I am trying to setup cntlm on ubuntu13 for NTLM authentication. I used apt-get install to setup ctlm. My cntlm.conf file in the etc directory is copied below - the username/domain and password are correct (I have tested them with a different application). **cntlm.conf**                   # Cntlm Authentication Proxy Configuration              Username        account         Domain          xxxxxx.com         Password        password              # Workstation   netbios_hostname             Proxy                xxx.xxx.xxx.xxx:3128         ###Proxy                10.0.0.42:8080              NoProxy         localhost, 127.0.0.*, 10.*, 192.168.*, 0.0.*              Listen          3128              #SOCKS5Proxy    8010         #SOCKS5User     dave:password              #Auth           NTLM2         #Flags          0x06820000              #Gateway        yes              #Allow          127.0.0.1         #Deny           0/0              #ISAScannerSize     1024         #ISAScannerAgent    Wget/         #ISAScannerAgent    APT-HTTP/         #ISAScannerAgent    Yum/              #Header         User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)         #Tunnel         11443:remote.com:443      **Error Message in /var/log/syslog:**               Proxy returning invalid challenge!      cntlm is running on port 3129 (squid running on port 3128). I pointed IE to use the proxy on the IP address and port number for cntlm (I tried with squid as well) - however, the connection times out. Any suggestions on troubleshooting this will be appreciated.


title: Enter user authentication details for a printer?

text: I have a printer which is configured using the correct drivers. However, the printer requires user authentication (i.e. a username and password) to print. Where are authentication details usually entered in Unix systems? No dialog pops up when I print a job. The printer is Sharp MX-2610N. I downloaded the Linux Cups PPD driver from the manufacturer's site. I am on Ubuntu 12.04 machine.


title: What is the right file permission for a .pem file to SSH and SCP

text: I have tried to SSH into my AWS ubuntu server and copy the directory to my local machine. Throughout the process I experience different file permission errors (noted below). Is there one specific file permission needed for the .pem file that allows me to SSH and SCP?   Or do I need to change the file permission twice - once for SSH and another for SCP after I login? **Here are the commands I'm using:** SSH:               ssh -i sentiment.pem Todo@54.555.555.555      Copy from remote to local computer with:               scp Todo@54.555.555.555:/home/ubuntu/sentimentfolder /Users/Toga/Desktop/sentimentlocal      I'm on a Mac OS X 10.7.5, any guidance would be very much appreciated. * * * **Trial and Error:** 1.) After I initially downloaded the .pem file, its permissions were set to, I THINK: 0644 > -rw-r--r--@ 1 Toga staff 1692 Feb 18 21:27 sentiment.pem I then tried to SSH via terminal and received the following:               WARNING: UNPROTECTED PRIVATE KEY FILE!      Permissions 0644 for 'sentiment.pem' are too open.     It is recommended that your private key files are NOT accessible by others.     This private key will be ignored.     bad permissions: ignore key: sentiment.pem     Permission denied (publickey).      2.) I updated the file permissions to: chmod 660 sentiment.pem After the update, the permissions were set to: > -rw-rw----@ 1 Toga staff 1692 Feb 18 21:27 sentiment.pem I then tried to SSH via terminal and received the following:               WARNING: UNPROTECTED PRIVATE KEY FILE!      Permissions 0660 for 'sentiment.pem' are too open.     It is recommended that your private key files are NOT accessible by others.     This private key will be ignored.     bad permissions: ignore key: sentiment.pem     Permission denied (publickey).      3.) I updated the file permissions to: chmod 600 sentiment.pem After the update, the permissions were set to: > -rw-------@ 1 Toga staff 1692 Feb 18 21:27 sentiment.pem **I then tried to SSH via terminal and was successful!!** 4.) Now logged in, I run the a command to copy the remote directory to my local computer with:               scp Todo@54.555.555.555:/home/ubuntu/sentimentfolder /Users/Toga/Desktop/sentimentlocal      Which returns:               Permission denied (publickey).      * * * **SCP Commands Attempted:** 1.) added the command -i and referenced the .pem file: > scp -i sentiment.pem Todo@54.555.555.555:/home/ubuntu/sentimentfolder > /Users/Toga/Desktop/sentimentlocal 2.) added the command -i, referenced the .pem file, and changed the user for AWS to ec2-user: > scp -i sentiment.pem ec2-user@54.555.555.555:/home/ubuntu/sentimentfolder > /Users/Toga/Desktop/sentimentlocal 3.) added the command -i, referenced the .pem filem, changed the user for AWS to ec2-user, and added the complete file path for the location of the .pem file: > scp -i > /Users/Toga/Desktop/rollup/Personal/Serial_Project_Starter/sentiment/sentiment.pem > ec2-user@54.555.555.555:/home/ubuntu/sentiment > /Users/Toga/Desktop/sentimentlocal


title: Change sshd logging file location on CentOS?

text: How do I change the `sshd` logging file location on CentOS? `sshd` logs to `/var/log/messages` instead of `/var/log/secure`. How can I change the setting so `sshd` will stop sending logs to `/var/log/messages`?


title: How to reinstall yum?

text: I made a big mistake: I removed yum. So now when I for example run the following it gives me an error:               $ yum clean all     yum command not found.      I can download the package succesfully:               wget mirror.centos.org/centos/6/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm     --2014-01-15 15:42:59--  http://mirror.centos.org/centos/6/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm     Resolving mirror.centos.org... 192.133.139.3     Connecting to mirror.centos.org|192.133.139.3|:80... connected.     HTTP request sent, awaiting response... 200 OK     Length: 1019540 (996K) [application/x-rpm]     Saving to: “yum-3.2.29-40.el6.centos.noarch.rpm.1”          100%[====================================================================================================================>] 1,019,540    649K/s   in 1.5s          2014-01-15 15:43:01 (649 KB/s) - “yum-3.2.29-40.el6.centos.noarch.rpm.1” saved [1019540/1019540]      Trying to install the downloaded package gives the following error:               # rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm     Preparing...                ########################################### [100%]         file /usr/lib/python2.6/site-packages/yum/__init__.py from install of yum-3.2.29-40.el6.centos.noarch conflicts with file from package yum-3.2.29-30.el6.centos.noarch     [...]     file /usr/share/yum-cli/yummain.pyo from install of yum-3.2.29-40.el6.centos.noarch conflicts with file from package yum-3.2.29-30.el6.centos.noarch      There is no directory "yum" in `/usr/bin`. When I use the command "rpm -qa | grep yum".               yum-metadata-parser-1.1.2-16.el6.x86_64     yum-plugin-fastestmirror-1.1.30-14.el6.noarch     yum-3.2.29-30.el6.centos.noarch      The distro is CentOS 6.3.   How can I reinstall yum?


title: How to cd to a Windows file share?

text: At work, I spend a lot of time manipulating files on a networked computer that's running SME Server (but that's set up for Windows filesharing, if that somehow makes a difference). I have been wondering how to cd to the network drive's root from bash so that I don't have to keep calling up Finder / nautilus every time I want to copy a file. Any suggestions? In Ubuntu, I connect to the drive as a Windows share via Places - Connect to Server. In OSX, well, I logged in to the drive once, and it just shows up in Finder.


title: How to overwrite target files with mv?

text: I have a ton of files and dirs in a subdirectory I want to move to the parent directory. There are already some files and dirs in the target directory which need to be overwritten. Files that are only present in the target should be left untouched. Can I force `mv`to do that? It (`mv * ..`) complains               mv: cannot move `xyz' to `../xyz': Directory not empty      What am I missing?


title: Bash if script is called from terminal echo stdout to terminal, if from cron do not echo output

text: I would like to have a service watchdog script echo the status to the screen if called like ./watchdog.sh but if it is run by cron, there is no need to echo output. What is the proper method? Where does stdout go when a script is run under root's crontab?


title: How to change the hard drive serial number in Ubuntu?

text: Xilinx license file is produced by hard drive serial number. Now, I got it. But, it is produced by other PC which is windows 7. Hence, I need to change the hard drive serial number. As I know, I can found it by the command               hdparm -I /dev/sda | grep Serial      But, how to change it?


title: Numpy module not found despite being in path

text: I am having trouble with the module on python. Here is my path variable,               /opt/local/bin /opt/local/sbin /Developer/usr/bin /usr/local/git/bin /usr/X11/bin /Users/oskarniburski/.rvm/bin /usr/X11R6/bin /Library/Frameworks/Python.framework/Versions/3.3/bin /Library/Frameworks/Python.framework/Versions/2.7/bin /Library/Frameworks/Python.framework/Versions/Current/bin /usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/local/git/bin /usr/X11/bin /Users/oskarniburski/.rvm/bin      and as seen, it goes through 3.3 and 2.7 therefore should it not find the numpy module in python? I cannot do the euler intergration without the numpy module, so I am curious as to what is the solution. I tried reinstall numpy with pip install numpy , but it did not solve my problem (as numpy module is already in python2.7 framework.) Therefore I am not sure why it is unable to locate numpy module. Any help? The error I get originally was               ImportError: No module named numpy       Now, after some changes, I get the error:               $ python eulerintegration.py          Traceback (most recent call last):       File "eulerintegration.py", line 1, in <module>         import numpy as np       File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/numpy/__init__.py", line 137, in <module>         import add_newdocs       File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/numpy/add_newdocs.py", line 9, in <module>         from numpy.lib import add_newdoc       File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/numpy/lib/__init__.py", line 4, in <module>         from type_check import *       File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/numpy/lib/type_check.py", line 8, in <module>         import numpy.core.numeric as _nx       File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/numpy/core/__init__.py", line 5, in <module>         import multiarray     ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/numpy/core/multiarray.so, 2): no suitable image found.  Did find:         /Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/numpy/core/multiarray.so: mach-o, but wrong architecture


title: Saving terminal windows in mint

text: How can I save all the terminal tabs(with each current pwd in each tab) and terminal window positions.


title: Are there any tools to recover files from a previously formatted WinNT drive?

text: I scratched the previous Windows NT filesystem, now I'm running Ubuntu. I've created the whole disk as EXT4. Are there **any** tools to locate and save some previous Windows files from the original filesystem?


title: Way to write new filename on wildcard input?

text: I have some experience with Inix terminals from science internships I've been part of, mainly using a few utilities like `grep`, `awk`, and `sed` but there is one thing I've been trying to figure out for a while that would really make me far more efficient with the number crunching I have to do. I have a script `run.awk` that performs some manipulations on a large of collection of massive text files. As it is it will take the file `chloride.out`, extract data from it and write `chloride.cm` . Is there anyway I can make this script take in `*.out` and write `*.cm` files based off the initial wildcard phrase in shell? The amount of scripts I've written for processing large amounts of data that I've had to do a hundred+ iterations of is just annoying. Ideally I would like to know if there is a way that I can do this for all my scripts with something via the shell. If it can't be automated in the shell or an equivalent can I least automate my `awk` scripts in a similar manner as I've described?


title: RELATED,ESTABLISHED state in iptables

text: What do the words 'RELATED' and 'ESTABLISHED' individually signify in RELATED,ESTABLISHED state in iptables?


title: Trying To Get Data From Server HDD

text: I had two CentOS 6.5 servers that I was running using the Plesk control panel. I have moved and decided not to use them no more but just buy my hosting. My new ISP blocks port 80 and the cost is insane to get it unblocked from them. I took out the server HDD and trying to use a Fedora 12 Live CD to just get the website files backed up. The issue I'm having is that the folder I need access to are all locked out. The error says I do not have permissions to view folder. When I go to permissions tab I'm being told I'm not the owner. I'm not good with command lines so is there a way to make myself the owner from the interface?


title: Consistency in default installation directories

text: I am very new to Linux (Ubuntu 13.10) and having difficulty understanding the file system, particularly with regards to installing applications. In Windows, when I installed an application, it put the contents of the application in a folder in Program Files, by default. I knew exactly where to look if I wanted to browse all my applications, for example to see if I had already installed something. However, I have found that with Linux, there is much less consistency. For example, when I installed the Komodo code editor, by default it created a folder in `/home`. Then, when I installed the TexLive Latex editor, by default it created a folder in `/usr/local`. From searching around, I have found that most applications are _supposed_ to be installed in `/bin` or `/usr/bin`. Why are there so many different default places to install applications? Why not the consistency found in Windows? On a slightly different note, if I were to move my Komodo folder from /home to /bin, for example, will doing a simple cut and paste be acceptable, or will there be references to the original folder in /home that will now be invalid? I have already added the Komodo bin folder to $PATH, so I already know about that one, but are there any other such references?


title: Assistance applying poorly packaged patches?

text: I manage a handful of servers running the various roles of a Ahsay online backup solution. A few times a year the software is updated and I need to apply patches on my servers. Annoyingly the patches are rather poorly packaged/distributed, so where one would like to have the servers installed/updated using yum everything is instead handled manually. Installing the server the first time is rather simple, unpack the archive file to /usr/local and run install.sh (to create init-scripts and such). After that however the management start to get annoying. To make setting changes and rebrand the server you make changes to startup-scripts and the actual xml-files that make up the server. This in itself would be no big issue if it wasn't for the fact that every time a new patch is released it comes with the stock versions of these files and instructions to overwrite the customized ones. Rewriting the files on every update on multiple server naturally is quite a hassle. So I find myself proofreading most of the files in the patch, handpicking the ones I figure contain the actual updates and updating only those. Now, it is not billions of files, just enough of them to be annoying. The latest patch:               # find . -type f     ./webapps/rdr/jsp/lib/common.js     ./webapps/rdr/WEB-INF/lib/rdr.jar     ./webapps/rdr/WEB-INF/web.xml     ./webapps/rdr/WEB-INF/struts-config.xml     ./webapps/obs/WEB-INF/lib/rdr.jar     ./webapps/obs/WEB-INF/web.xml     ./webapps/obs/WEB-INF/struts-config.xml     ./tomcat/lib/libFileSysUtilObdX86.so     ./tomcat/lib/libFileSysUtilFbdX64.so     ./tomcat/lib/libFileSysUtilObdX64.so     ./tomcat/lib/mail.jar     ./tomcat/lib/libFileSysUtilSosSp9.so     ./tomcat/lib/libFileSysUtilFbdX86.so     ./tomcat/lib/libFileSysUtilLinX64.so     ./tomcat/lib/libFileSysUtilLinSpc.so     ./tomcat/lib/libFileSysUtilSosX86.so     ./tomcat/lib/libFileSysUtilLinPpc.so     ./tomcat/lib/libFileSysUtilLinArm.so     ./tomcat/lib/libFileSysUtilLinP64.so     ./tomcat/lib/libFileSysUtilLinX86.so     ./tomcat/lib/libFileSysUtilSosX64.so     ./tomcat/lib/libFileSysUtilSosSpc.so     ./tomcat/lib/ani.jar     ./bin/startup.sh     ./bin/shutdown.sh      Doing the following I've managed to spot the text differences more easily:               for NEW in `find . | xargs file | grep text | sed 's/:.*$//' | xargs`     do      OLD=`echo $NEW | sed 's!^\.!/usr/local/rdr!'`      echo -e "$NEW \t\treplaces $OLD"      diff $OLD $NEW     done      And in this latest patch there where no update (that I could identify) to any of the text files. Meaning I could just replace the **diff** with **rm $NEW**. After that I ran a diff over all of the files instead of just the text files:               # for NEW in `find . -type f | xargs`; do OLD=`echo $NEW | sed 's!^\.!/usr/local/rdr!'`; diff $NEW $OLD; done     Binary files ./webapps/rdr/WEB-INF/lib/rdr.jar and /usr/local/rdr/webapps/rdr/WEB-INF/lib/rdr.jar differ     Binary files ./webapps/obs/WEB-INF/lib/rdr.jar and /usr/local/rdr/webapps/obs/WEB-INF/lib/rdr.jar differ     Binary files ./tomcat/lib/mail.jar and /usr/local/rdr/tomcat/lib/mail.jar differ     Binary files ./tomcat/lib/libFileSysUtilSosX64.so and /usr/local/rdr/tomcat/lib/libFileSysUtilSosX64.so differ     Binary files ./tomcat/lib/ani.jar and /usr/local/rdr/tomcat/lib/ani.jar differ      Giving the list of the 5 (out of 25) I actually need to change. This seems like the kind of headache package maintainers deal with all the time, is there some way to make the process less cumbersome? My servers (if it make any difference) are running CentOS 6.5.


title: Testing a Linux router on Laptop with one NIC

text: So, I have these instructions on converting my Linux machine to a router using (enable IP forwarding, NAT). Now my laptop has only one NIC and I want to test this setup. Any ideas how I can do this? Do I need to use Linux in VM and there is no other way? Or is there a network config that can show routing behaviour with one interface only? (Please give details if required, I am not very good on linux) Note: If there is a tool, I need any that works, not the very best in one's opinion.