title: Check for plugged in network cable on startup

text: I actually wanted to post the below as an answer to this question. But am not sure if this is right approach or it's a way of screwing up things badly. We can actually check if the network cable is connected to the machine, or not, by running the command,               grep "" /sys/class/net/eth0/carrier      When the network cable is plugged in, the output would be **1** for the above command and when it is not plugged in, the output would be **0** for the above command. I tested the above part in my system and it worked fine as expected. Now the question lies in how to include this condition on **startup**. We can include this in the network **startup** file, which can check this condition before bringing up the interfaces. In RHEL box the file `/etc/sysconfig/network-scripts/ifcfg-eth0` is used to bring up the network interfaces. So, If I change the file to look like,               cable=$(grep "" /sys/class/net/eth0/carrier)     if $cable -eq 1 then        #rest of the /etc/sysconfig/network-scripts/ifcfg-eth0 as it is.      else        break      However, before proposing this method, or even trying on my machine, my question is: When the services are being brought up will the `/sys/class/net/eth0/carrier` be ready and available? Assuming this approach works, if I decide to use wireless network will there be a problem?


title: Change the order of executables started in bash

text: If I execute the `test` command in bash, `test`(evaluates conditional expression) built-in utility is started:               $ type test     test is a shell builtin     $ type -a test     test is a shell builtin     test is /usr/local/bin/test     test is /usr/bin/test     $       However, as seen in output of `type -a test` above, there is another `test` in /usr/local/bin directory and yet another one in /usr/bin directory. How are executables ordered, i.e. are the built-in commands always preferred and then the rest of the commands depend on the directory order in $PATH variable? In addition, is it possible to change the order of the executables started, e.g. if I type in `test`, then /usr/bin/test is started instead of bash-builtin `test`?


title: Using variable in KSH function

text: I tried to have a switch if either an option is set or not                        while getopts "s:u:d:e:ch" _OPTION; do              case $_OPTION in              ...              c)                      isCSet="Y"      then I'm calling my function :               myFunction $isCSet      then in my function I'm doing : `echo $1` but I don't have anything in. How can I solve this problem?


title: What is new in Kernel 3.0?

text: I understand this is somewhat less Ubuntu related, but it affects it. So,what is so new about it that Linus decided to name it 3.0? I'm not trying to get information about the drivers that got into it or stuff that always gets improved. I want to know what really made it 3.0. I read somewhere that Linus wanted to get rid of the code that supports legacy hardware. Hm, not sure what that really meant because 3.0 is bigger (in MB), not smaller, than, say, 2.6.38. What was the cause of naming it 3.0?


title: Why does gnome-shell-timer not work after installing on Debian Wheezy?

text: I'm on Debian Wheezy and in Gnome 3.4.2 but using the "classic" view.. after installing gnome-shell I can't find any way to add it to the dock. The only thing that's invokable is gnome-shell-timer-config, if I try to invoke 'gnome- shell-timer' nothing opens.


title: Session limit for OpenSSH server on Ubuntu Desktop 7.10

text: I need restrict session limit on my OpenSSH server only for one session (one connection). I use Ubuntu Desktop 7.10. Of course Version is old, but I need it for experimental purposes. I tried modify my config file - /etc/ssh/sshd_config two ways: First I changed:               MaxStartups 1       but it does not work correctly. I can make many connections still. Second I changed:               MaxSessions 1       after restart I get error message:               /etc/ssh/sshd_config: line 71: Bad configuration option: MaxSessions     /etc/ssh/sshd_config: terminating, 1 bad configuration options      I saw to sshd_config MaxSessions parameter and I tried add:               mato - maxlogins 1       to /etc/security/limits.conf but it does not help me. I used - http://www.cyberciti.biz/faq/iptables-connection-limits-howto/ too:               /sbin/iptables -A INPUT -p tcp --syn --dport 22 -m connlimit --connlimit-above 1 -j REJECT,       but I get error message:               iptables: No chain/target/match by that name


title: lde (linux disk editor) open just few beggining blocks

text: I have installed lde (linux disk editor) to verify some data but I see just only up to 0xB670 block. But it's strage sometime the last block in the page is 0xB4B0 and the next is 0xB0C0. And from 0xB6F0 to 0xB300 ?!?! Anyway it looks a loop and I can't go straight. I used lde years ago and I remember I browse the full disk..


title: What is the difference between 'No' and 'Continue' on interactive startup?

text: I have a problem that Centos is hanging on a custom process at startup. I tried running interactive startup to sidestep it and allow the machine to boot up. I selected no for the process but it is still hanging. Obviously selecting 'yes' will start the process. **But what is the difference between 'No' and 'Continue'?**


title: Replication data in SAN

text: I am using openfiler as SAN. Then I create a disk in SAN using ISCSI. I have 2 CentOS client machines connect to SAN disk. When I create data in client1 machine, It doesn't update to client2 machine. Am I doing something wrong?


title: What is the smallest LVM2 logical volume unit?

text: Could you ensure me that minimal LVM2 size Unit is one extent to which all sizes are rounded up ? Is 4MiB the default size of extent for LVM2 ? Can it be configurable or is it the only size ? Small experiment of try of creating 2B logical volume:               # lvcreate -L 2 r2Ta -n test2b       Rounding up size to full physical extent 4.00 MiB                                                                                Logical volume "test2b" created     # lvdisplay /dev/mapper/r2Ta-test2b  | grep 'LV Size'                                                                                LV Size                4.00 MiB


title: Resize /home on CentOS vmware guest

text: I have a new vmware guest, let's say I want to extend it from 100 GB to 300 GB My question is **how to insert all the 200gb into`/home`? Where can I start?** `df -h` displays: ![enter image description here](http://i.stack.imgur.com/Ce2bt.png)


title: How achieve variable indirection (refer to a variable whose name is stored in another variable) in tcsh

text: I'm trying to do the following:               set a = kitten     set temp_kitten = purr     echo ${temp_$a}      I want the `echo` command to return "purr". The overall idea is that I have a bunch of variables in an array and a bunch of `temp_variables` in another array and I want to loop through them in a single `foreach` loop for comparison.


title: Install mandriva in USB HDD

text: I want to install Mandriva 2010.2 in my external USB HDD using the image file. The laptop's cd/dvd drive doesn't work, so I don't have the option of making a Live CD and starting the installation from there (which works well enough). My external HDD has some an NTFS partition and a free partition in which I want to install Mandriva.


title: blktrace - differentiating between sequential to random io

text: I'm looking for a way to determine whether an app is doing sequential or random I/O. Is it possible to look at a blktrace capture and say if I/O is sequential or random? If yes, any examples of what patterns should I be looking for?


title: Is it possible to merge video files using `cat`?

text: I wonder if it's possible to merge video files using the `cat` command? I mean will the resultant file play seamlessly?


title: Strange file ownership with Ubuntu

text: Normally we know when we create one file in Linux, the file's owner and group will set with the creator. For example, I have one user, `usera`, after I execute               usera@srv1:$touch 1.txt      I will find the owner of this file will be usera, just like               usera@srv1:$ll     -rw-r--r-- 1 usera usera 0 2012-07-25 14:29 1.txt      But now the result is:               -rw-r--r-- 1 root usera 0 2012-07-25 14:29 1.txt      It seems that not only the touch command, but also others are all have the same problem. For example, if I use `vim` to create a new file in usera's home, which means this user has permission to create file:               usera@srv1:$ vim a.txt      I can enter edit screen, but cannot save it. The error message is the same as we do not have write permission on that file. So what happens on our server, the server is Ubuntu 11.04 64bits. One extra but maybe useful information:   Now all new created users have similar problem. `usera` is a `sudoer`, but after I create a new normal user (`sudo createuser xxx`), assign password and login with this new account, it's the same.


title: The meaning of '-' and '+' symbol when background processes are finished?

text: When I am running background processes like(I have 9 files suffixed by phastcon):               for i in *.phastcon; do cut -f 2 $i >$i.value & done      After kicking the "Enter", I get the output in terminal showing background id and process id,               [1] 22917     [2] 22918     [3] 22919     [4] 22920     [5] 22921     [6] 22922     [7] 22923     [8] 22924     [9] 22925      But hen finished, I got               [7]   Done                    cut -f 2 $i > $i.value     [8]-  Done                    cut -f 2 $i > $i.value     [1]   Done                    cut -f 2 $i > $i.value     [2]   Done                    cut -f 2 $i > $i.value     [3]   Done                    cut -f 2 $i > $i.value     [4]   Done                    cut -f 2 $i > $i.value     [5]   Done                    cut -f 2 $i > $i.value     [6]-  Done                    cut -f 2 $i > $i.value     [9]+  Done                    cut -f 2 $i > $i.value      The results are all right. But I can not understand what is the difference of **'-'** and **'+'** after the square. Thank you for all helps! Tong


title: forwarding web traffic through a vps running on Ubuntu in another country

text: I've got a vps in another country. And I'd like to forward all my web traffic through it. I know there are commercial options available in the market but I'd like to do it by myself for the sake of experimentation, learning and some fun. My vps runs Ubuntu 12.04x64. And I'm connecting to the vps through either a macbook or windows laptop. Can someone please help me through a step by step guide as to how this can be achieved? Else any guidance in this regard would be appreciated. Thanks.


title: Internal Server Error nginx

text: I'm trying to install and get running **Tendenci** on a DigitalOcean server. Tendenci is this open source association management software: http://tendenci.com/ I've followed the instructions here to the letter: http://tendenci.readthedocs.org/en/latest/installation/remote.html And have hit a roadblock as I get an Internal Server Error every time I visit the site at 107.170.117.57 I think the problem is either my `/var/www` permissions are not set correctly or that nginx isn't listening to port 80 requests. (OR both?). The server is running Ubuntu 12.04.4 x64 and when I logged in, I had to create the `/var/www` folder. Later on, thinking this could be the cause of the Internal Server Error I set its permissions by               chown root:www-data www     chmod 755 www      I had also applied these same permissions to `/var/www/tendenci` (where Tendenci is installed), as per the guide instructions at the beginning. That didn't change anything, so I added               listen [::]:80 ipv6only=on default_server;      To `/etc/nginx/sites-available/tendenci` based on what I read over here: http://stackoverflow.com/questions/14972792/nginx-nginx-emerg-bind- to-80-failed-98-address-already-in-use Which hasn't helped. I'm stumped, because I'm not a sysadmin. Is there something basic that I'm missing? Is the issue with `/var/www` permissions or with the way `/etc/nginx/sites-available/tendenci` is configured? Note: this is the 3rd time I follow the instructions. The second time I tried with a LAMP setup and when I visited the site at 107.170.117.57/tendenci, that showed the directory and files instead of the actual frontend of the site itself. On another note: the site should be displayed when visiting 107.170.117.57 directly. Any help or pointers in the right direction would be appreciated, thanks!


title: How to make my tmux which starts via crontab @reboot use bash?

text: I have a crontab which launches tmux-launching-script as follows :               -sh-3.00# crontab -l     @reboot /root/scripts/tmux_autostart.sh      where               #!/bin/bash     # setup tmux session          tmux new -d -s my_session      but when the system boots I don't have my regular prompt but **shell** prompt :               -sh-3.00#      how to change it to bash if I already have this in my config **.tmux.conf**               set-option -g default-shell /bin/bash      **EDIT**               -sh-3.00# cat /etc/crontab     SHELL=/bin/bash     PATH=/sbin:/bin:/usr/sbin:/usr/bin     MAILTO=root     HOME=/          # run-parts     01 * * * * root run-parts /etc/cron.hourly     02 4 * * * root run-parts /etc/cron.daily     22 4 * * 0 root run-parts /etc/cron.weekly     42 4 1 * * root run-parts /etc/cron.monthly


title: MySQL Database Charset

text: I have just migrated a MySQL database to a new server using mysqldump. The charset of database is normally UTF-8 and everything was working fine on the old server but when we switched over to new one, the special characters started not to show properly. The only difference I can see between two servers is that the default charset of new server is set to latin1 in my.cnf whereas this was not the case on old server. I have tried to replace all these special characters using interconnect/it's tool but that did not work. What needs to be done to get this fixed? What should one pay attention to in such a situation? Charsets of database, table?


title: CentOS Local User not able to view directories/files via FTP login

text: Currently running CentOS 6.5 with vsftpd. As a newbie, I would like to explain my process and then have the proper process explained back to me from scratch which I believe will solve my issue. I am currently able to log into my server via FTP from my "root" user account, but I understand that is bad practice. So what I need to do is create another local user/virtual user (I really do not know) to be able to access via FTP the "/var/www" directory. _(I'm simply needing to get to the point were I can begin uploading web files, as I'm a web programmer, not a system administrator -- but I was so pleasantly surprise with a dedicated server to work with.)_ Initially I created a Local User, but was only able to FTP the "home" user directory. So I next tries unjailing that user via CHROOT (vsftpd.conf). That worked sort of; the parent directories were visible, but upon navigating up to them via FTP everything disappeared (possibly an issue with permissions, idk). Next I tried rejailing the Local User and then modifying its "home" directory from "/home/" to "/var/www". After doing attempting that, I FTP'd in and then could not see anything... so another fail. I've since returned the user's "home" directory back to "/home/" and crawl over to SOF confused as hell. **vsftpd.conf**               # Allow anonymous FTP? (Beware - allowed by default if you comment this out).     anonymous_enable=NO     #     # Uncomment this to allow local users to log in.     local_enable=YES     #     # Uncomment this to enable any form of FTP write command.     write_enable=YES     #     # Default umask for local users is 077. You may wish to change this to 022,     # if your users expect that (022 is used by most other ftpd's)     local_umask=022     #     # Uncomment this to allow the anonymous FTP user to upload files. This only     # has an effect if the above global write enable is activated. Also, you will     # obviously need to create a directory writable by the FTP user.     #anon_upload_enable=YES     #     # Uncomment this if you want the anonymous FTP user to be able to create     # new directories.     #anon_mkdir_write_enable=YES     #     # Activate directory messages - messages given to remote users when they     # go into a certain directory.     dirmessage_enable=YES     #     # The target log file can be vsftpd_log_file or xferlog_file.     # This depends on setting xferlog_std_format parameter     xferlog_enable=YES     #     # Make sure PORT transfer connections originate from port 20 (ftp-data).     connect_from_port_20=YES     #     # If you want, you can arrange for uploaded anonymous files to be owned by     # a different user. Note! Using "root" for uploaded files is not     # recommended!     #chown_uploads=YES     #chown_username=whoever     #     # The name of log file when xferlog_enable=YES and xferlog_std_format=YES     # WARNING - changing this filename affects /etc/logrotate.d/vsftpd.log     xferlog_file=/var/log/xferlog     #     # Switches between logging into vsftpd_log_file and xferlog_file files.     # NO writes to vsftpd_log_file, YES to xferlog_file     xferlog_std_format=YES     #     # You may change the default value for timing out an idle session.     #idle_session_timeout=600     #     # You may change the default value for timing out a data connection.     #data_connection_timeout=120     #     # It is recommended that you define on your system a unique user which the     # ftp server can use as a totally isolated and unprivileged user.     #nopriv_user=ftpsecure     #     # Enable this and the server will recognise asynchronous ABOR requests. Not     # recommended for security (the code is non-trivial). Not enabling it,     # however, may confuse older FTP clients.     #async_abor_enable=YES     #     # By default the server will pretend to allow ASCII mode but in fact ignore     # the request. Turn on the below options to have the server actually do ASCII     # mangling on files when in ASCII mode.     # Beware that on some FTP servers, ASCII support allows a denial of service     # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd     # predicted this attack and has always been safe, reporting the size of the     # raw file.     # ASCII mangling is a horrible feature of the protocol.     #ascii_upload_enable=YES     #ascii_download_enable=YES     #     # You may fully customise the login banner string:     #ftpd_banner=Welcome to blah FTP service.     #     # You may specify a file of disallowed anonymous e-mail addresses. Apparently     # useful for combatting certain DoS attacks.     #deny_email_enable=YES     # (default follows)     #banned_email_file=/etc/vsftpd/banned_emails     #     # You may specify an explicit list of local users to chroot() to their home     # directory. If chroot_local_user is YES, then this list becomes a list of     # users to NOT chroot().     chroot_local_user=YES     chroot_list_enable=NO     # (default follows)     #chroot_list_file=/etc/vsftpd/chroot_list     #     # You may activate the "-R" option to the builtin ls. This is disabled by     # default to avoid remote users being able to cause excessive I/O on large     # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume     # the presence of the "-R" option, so there is a strong case for enabling it.     #ls_recurse_enable=YES     #     # When "listen" directive is enabled, vsftpd runs in standalone mode and     # listens on IPv4 sockets. This directive cannot be used in conjunction     # with the listen_ipv6 directive.     listen=YES     #     # This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6     # sockets, you must run two copies of vsftpd with two configuration files.     # Make sure, that one of the listen options is commented !!     #listen_ipv6=YES          pasv_enable=YES     pasv_min_port=50000     pasv_max_port=51000     port_enable=YES     pasv_address=xxx.xxx.xxx.xxx     pasv_addr_resolve=NO          pam_service_name=vsftpd     userlist_enable=YES     tcp_wrappers=YES      Any help is greatly appreciated.


title: binding to remote IP

text: I have two servers and would like one server to be able to use some of the other's external IPs. Server A has 20 IPs and server B has 5 so I want B to use 5 of A's IPs. How would I go about this? Would I need to create 5 openvpn tunnels from A to B? My goal is for server B to have 10 distinct outgoing IPs.


title: Why doesn't 'ar' work like the manpage says?

text: I'm trying to use 'ar' included in Debian Wheezy armel version of binutils and it doesn't seem to operate like on other systems I've encountered. Some sample output from the command-line:               $ ar     Usage: ar [options] archive      Generate an index to speed access to archives      The options are:       @<file>                      Read options from <file>       --plugin <name>              Load the specified plugin       -t                           Update the archive's symbol map timestamp       -h --help                    Print this help message       -v --version                 Print version information     ar: supported targets: elf32-littlearm elf32-bigarm elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex          $ ar -crs something.a file1.o file2.o     ar: invalid option -- 'c'     ar: invalid option -- 'r'     ar: invalid option -- 's'      What am I missing here? Why do I always get the invalid option message?


title: How can I semi-automatically mount a TrueCrypt volume using built in system tools?

text: I recently purchased a new external hard drive and encrypted it with TrueCrypt as I want it accessible from both Windows and Linux. However, when I try to access the mount point for it in Linux it hangs indefinitely unless I previously load the volume with cryptsetup. So I'm guessing the problem is in my crypttab. Here's the line for the volume:               USBMassStorageTB /dev/disk/by-path/pci-0000\:00\:14.0-usb-0\:3\:1.0-scsi-0\:0\:0\:0-part1 none tcrypt,noauto      The goal with that is to create an entry called /dev/mapper/USBMassStorageTB at the disk with that path, prompting for a password rather than reading it from a file, using truecrypt and not automounting at boot. My understanding - which may be flawed - of what should happen is:   1. I access the mountpoint   2. System sees this is not mounted, and looks it up in fstab   3. System finds the entry in fstab pointing at device /dev/mapper/USBMassStorageTB and looks for that device, loading it if it's available (so far so good - this works fine if the device is opened with cryptsetup)   4. If the device is not available, it needs to be decrypted based on the settings in crypttab - this is the bit where I'm not clear on what happens, I'm assuming it just looks up the entry for /dev/mapper/USBMassStorageTB in crypttab and sees it needs to decrypt the volume at that path   5. The now-decrypted volume has a device entry and gets mounted according to the settings in fstab, and I can access the volume The most useful information I've obtained so far is from the ArchWiki TrueCrypt page, specifically the automounting section at https://wiki.archlinux.org/index.php/TrueCrypt#Automounting_using_.2Fetc.2Fcrypttab which seems to imply the fstab and crypttab settings I have should be sufficient.


title: IPTables Port Redirection Should Have Broken Apache But Didn't

text: I have a Load Balance set up in Apache `httpd`:               <VirtualHost *:80>             DocumentRoot /var/www/html             ServerName xxx.xxx.xxx.com             ProxyRequests           Off             ProxyPreserveHost       On             ProxyPass / http://xxx.xxx.xxx.xxx:8080/             ProxyPassReverse / http://xxx.xxx.xxx.xxx:8080/     </VirtualHost>      `:8080` is an Apache `tomcat` application server running on the same host. We have log retention requirements where I work, so I figured making everything apache `httpd` would make things ideal for analytics. I was attempting to get all public requests to go through port 80 without breaking any links or bookmarks end users might have. I was going to do that by doing some port translation so that everything looked like it was coming in via port 80 to applications. Without thinking about my load balance above I added the following rules to the `nat` table:               -A PREROUTING -i eth0 -p tcp -m tcp --dport 8080 -j REDIRECT --to-ports 80     -A PREROUTING -i eth0 -p tcp -m tcp --dport 8081 -j REDIRECT --to-ports 80      Which I'll admit was pretty dumb of me. Problem is, that I can get to the application either through `httpd` or directly by going to `:8080`. The packet count is also going up on each rule so apparently they're being matched against. My question is this: **Why didn't this just create an infinite loop?** It would seem the `:8080` requests would get forwarded to `httpd` which would itself attempt to retrieve them by going over `:8080` and thus the circle would continue onwards until I was reformatting my new resume.


title: Add VPN button is disabled in Debian Wheezy/LXDE

text: I want to configure a VPN connection, so choose VPN Connections->Configure VPN..., and I get to the Network Connections dialog. But the Add button is disabled. How do I enable it? ![enter image description here](http://i.stack.imgur.com/9QT1s.png)


title: comparing columnn values between two unix files

text: File A               Table SAPSR3./1BEA/BBEA_BDH has no BasicFile LOB columns     Table SAPSR3./1BEA/BBEA_BDI has no BasicFile LOB columns     Table SAPSR3./1BEA/BBEA_DLI has no BasicFile LOB columns     Table SAPSR3./1BEA/CNPL_PDL has no BasicFile LOB columns     Table SAPSR3./1BEA/CNPL_PLH has no BasicFile LOB columns     Table SAPSR3./1BEA/CNPL_PLI has no BasicFile LOB columns     SAPSR3.RSEUMOD has more than 255 columns      File B               SAPSR3.TERCL2     SAPSR3.TERCL3     SAPSR3.CRM_ACE_UCC     SAPSR3.CRMIOBJCONT     SAPSR3.CRMORDERCONT     SAPSR3.CRMD_WEBREQ_CONT     SAPSR3.CRMIBASECONT     SAPSR3.CRMD_UIF_SYSINDX     SAPSR3.CRMISMCONT      Need to compare 2nd column from FileA to FileB, if not found print the entire line of fileA into new fileC otherwise if found then also printe entire line along with concatenated string as "found", also from File B 1st column needs to be compared with FileA 2nd column only if not found then searching string(1st column of fileB) along with concatenated string as "Need to be Analysed" needs to be print into fileC.


title: What is the difference between @ and * when referencing bash array values?

text: This Bash guide says: > If the index number is @ or *, all members of an array are referenced. When I do this:               LIST=(1 2 3)     for i in "${LIST[@]}"; do       echo "example.$i "     done      Gives: `example.1 example.2 example.3` (desired result). But when I use `${LIST[*]}`, I get `example.1 2 3` instead. Why? Edit: when using printf, @ and * actually do give the same results.


title: unable to run darkice on raspberry pi

text: I'm doing a project on live audio streaming using Icecast and darkice using raspberry pi. I configured icecast server darkice successfully on ubuntu. I am following this tutorial as my reference. I followed the same steps on my raspberry pi, but unfortunately darkice is not configured successfully. When I start darkice an error occurs :               DarkIce: DarkIce.cpp:1187: can't open connector [0]       I don't know what it means? How can I investigate and solve this issue?


title: How to check whether file1 is a prefix of file2?

text: I have two files with sizes 124665 and 124858 in bytes and want to check whether file1 is a prefix of file2 or not.


title: How to find out if httpd is running or not via command line?

text: I'm working on a small control panel for my server. I need a command that will say if `httpd` is running or stopped. Will probably be using the same code for other services as well.


title: Ping to my own public IP results in host unreachable

text: First of all, I'm running a Manjaro 3.10 (Archlinux x64) install. I'm trying to make my No-IP configuration work. I have tried to ping my no-ip host and I recieve `host unreachable` ICMPs only. I was wondering if was a noip problem, so I have checked out my public ip with:               curl ifconfig.me      I have taken the result public Ip and done a ping to it:               ping my_public_ip       The result was `host unreachable` responses too, so I suppose no-ip has nothing to do with this situation (But I'm not sure, thats why I commented it on the question). Could be a double IP problem. I have a RapsberryPI (With archlinux too) and I have noticed that it has exactly the same public IP. **Whats wrong in my setup? Is this a IP conflict problem? If could be a problem, what I can do to check it?**


title: Run script in current shell without . before command

text: If a script should be executed in the current shell, it can be achieved by adding a dot before the command:                  . ./somescript.sh      Is there a way to do this without typing the dot every time? For example a command to change to the parent shell from the script itself?


title: find command help

text: I'm struggling using the find command that will allow me to find all files that were modified over 7 days ago and that are larger than 1 MB. Here's what I have -               find /path/to/files* -mtime +7 | -size +1M      But I don't think this is the right syntax.


title: How can I clear portion of what is typed into the prompt while working on Linux and using C-shell?

text: I am working in Linux and C-shell. Often times I would require to change some portion of what is there already in the prompt that I obtain from reverse searching through the history command by use of `CTRL+R`. I do not want to use the `Backspace` for doing this. I have looked at this question on superuser.com which was specifically for bash. This answer says to use `CTRL+U` which would clear out everything before the current cursor position. But this is clearing out everything for me even though I have hit a few backspaces and now am at the middle of the text in the prompt. Is there a C-shell specific way of achieving the same in Linux?


title: hardlink/softlink multiple file to one file

text: I have many files in a folder. I want to concatenate all these files to a single file. For example cat * > final_file; But this will increase disk space and also will consume time. Is there is a way where I can hardlink/softlink all the files to final_file? For example ln * final_file.


title: Where does the pattern occur in a match by find?

text: The manpage of `find` says: > -name > > Base of file name (the path with the leading directories removed)               $ find ~ -name bookmark | less      returns nothing, while               $ find ~ -name bookmarks | less     ./.streamtuner/cache/bookmarks     ./.config/zathura/bookmarks     ./.elinks/bookmarks      has three matches. Why does the first not have the matches of the second? If I would like to find those files whose names contain `bookmark` regardless the position of `bookmark` in the filename, how should I use `find`? Thanks.


title: bash setenv command is not found

text: every body I am new in centos server I am getting a error while using following command                        setenv CLASSPATH /path/mysql-connector-java-ver-bin.jar:$CLASSPATH      error is                       bash setenv command is not found      When i find path of setenv by which command , then i found following path                (/usr/kerberos/sbin:/usr/kerberos/bin:/home/ec2/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/home/ec2/bin:/root/bin)      Now i am confuse after lot of searching. So please some one help get rid of this error


title: What's The Best(tm) way to install Emerald into Mint 12?

text: I understand that the Mint people seem to know what I want better than I do and all (kidding!) but I'd really like to get Emerald installed without resorting to compile from source. So far I can't find a reliable place to point at to get it.


title: text processing-perl

text: I am a biologist. I would like help of computer experts to help in text file editing. Here is what the input file looks like:               ##dsfsd2     ##sdf-sdf sasg 5.6.3     gi34_ex Gen  CDS     161     317     .       +       .       Name=Xm ZAK;created by=User     gi56_ex Gen  CDS     2194    2280    .       +       .       Name=Xm ZAK;created by=User     gi37_ex Gen  CDS     2848    2951    .       +       .       Name=Xm ZAK;created by=User     gi37_ex Gen  CDS     4554    4619    .       +       .       Name=Xm ZAK;created by=User     gi37_ex Gen  CDS     4729    4756    .       +       .       Name=Xm ZAK;created by=User     gi37_ex Gen  extracted region        1       11677   .       +       .       Name=Extracted region from gi|371443185|gb|JH556675.1|;Extracted interval="1960862 -> 1972538"      Note that following from third row, the input has 12 ($1 to $12) columns, tab separated. The last line of the file has 16 ($1 to $16) columns, tab separated. ## lines should be ignored. I want to take $14 of the last line (interval="1960862) only the number (1960862) add to $4 column (161,2194,2848..4729) i.e (161+1960862=1961023,2194+1960862=1963056..) and to $5 column (317,2280,2951..4756) i.e (317+1960862=1961179,2280+1960862=1963142), ignore the last line. The output should look like this:               ##dsfsd2     ##sdf-sdf sasg 5.6.3     gi34_ex Gen  CDS     1961023     1961179     .       +       .       Name=Xm ZAK;created by=User     gi56_ex Gen  CDS     1963056    1963142    .       +       .       Name=Xm ZAK;created by=User     gi37_ex Gen  CDS     1963710    1963813    .       +       .       Name=Xm ZAK;created by=User     gi37_ex Gen  CDS     1965416    1965481    .       +       .       Name=Xm ZAK;created by=User     gi37_ex Gen  CDS     1965591    1965618    .       +       .       Name=Xm ZAK;created by=User     gi37_ex Gen  extracted region        1       11677   .       +       .       Name=Extracted region from gi|371443185|gb|JH556675.1|;Extracted interval="1960862 -> 1972538"


title: Problem making a virtual host with apache

text: Once i tried to make a virtual host, and the problem was that if i make another file in `/etc/apache2/sites-available/` that says               ...     DocumentRoot /var/www/newsite     ServerName   newsite     ...      Then save it, restart apache, and appending `/etc/hosts` like this:               127.0.0.1 newsite      I get the page that corresponds the DocumentRoot from `/etc/apache2/sites- available/default` That time i left it unsolved. Now i want to do it once again and i get the same problem. Despite the fact that i use different version of linux distro. I feel like i'm doomed. Any help would be very appreciated


title: What are pros/cons of dselect and apt-get?

text: I hardly ever hear anyone mention `dselect`, a deprecated package management front-end for Debian. Considering that it still exists as part of dpkg source, it must still have its uses. What are those? How does it compare with `apt- get`?


title: Find files which are created a certain time after or before a particular file was created

text: I need a shell script which finds files which are created 1 hour before or 1 hour after a particular file (`test.txt`) was created. If I go with `find -newer`, that means I'd have to create a temporary file, use `touch` to change the time on that 1 hour before the creation time of the `test.txt` file, and then use `-newer tempFile` to find the files which are newer than the `tempFile`, ultimately finding the files which are created 1 hour before the test.txt file. Then I have to go back through that process to find those an hour or more _older_ than the file I'm interested in. That seems like a lot of extra work to go through to answer a simple question. I also see `find -mmin`, but I worry that it's an extension to POSIX `find`. Any other suggestions?


title: export HTTP_PROXY and special characters in passwd

text: Suppose for the sake of argument my password below is `abc123@` I need to authenticate my linux machine through a corporate proxy to get patches and updates... normally I'd use this:               export HTTP_PROXY='http://<Americas\Username>:<Password>@proxy.foo.com'     export http_proxy='http://<Americas\Username>:<Password>@proxy.foo.com'      However, when I substitute a real password ending with `@` and then run `aptitude update`, I get...               [mpenning@netwiki ~]$ sudo -E aptitude update     Err http://mirror.anl.gov squeeze Release.gpg       Could not resolve '@proxy.foo.com'     Err http://mirror.anl.gov/debian/ squeeze/main Translation-en       Could not resolve '@proxy.foo.com'      I have tried escaping the password with `\@`, escaping both with `\@\@`, double characters (`@@`), and nothing seems to get this to proxy correctly; I never had a problem until I changed my password recently. What is the right way to escape my password in `bash`?


title: usb thumbdrive not mountable

text: I am new at linux and currently I have a problem with my USB thumbdrive (can't access it either in windows - no volumes are shown). `cat /proc/scsi/scsi` shows the following:                Host: scsi8 Channel: 00 Id: 00 Lun: 00       Vendor:          Model: USB MEMORY BAR   Rev: 1000       Type:   Direct-Access                    ANSI  SCSI revision: 00      `dmesg` shows the usb drive:               [ 1422.720016] usb 2-7: new high-speed USB device number 4 using ehci_hcd     [ 1425.004881] scsi8 : usb-storage 2-7:1.0     [ 1426.005127] scsi 8:0:0:0: Direct-Access              USB MEMORY BAR   1000 PQ: 0 ANSI: 0 CCS     [ 1426.005734] sd 8:0:0:0: Attached scsi generic sg4 type 0     [ 1426.008739] sd 8:0:0:0: [sdd] Attached SCSI removable disk      but manually mounting was not successful:                sudo mount -t ntfs /dev/sdd /mnt/usb      Failed to mount '/dev/sdd': No medium found      Could anyone please help me? Thank you in advance!


title: Get the free space available in current directory in Bash

text: I know `df -h` and `pwd`, but it seems a little complex for the regex matching part. Any ideas?


title: Linux - Repairing bad blocks on a RAID1 array with GPT

text: The tl;dr: how would I go about fixing a bad block on 1 disk in a RAID1 array? But please read this whole thing for what I've tried already and possible errors in my methods. I've tried to be as detailed as possible, and I'm really hoping for some feedback This is my situation: I have two 2TB disks (same model) set up in a RAID1 array managed by `mdadm`. About 6 months ago I noticed the first bad block when SMART reported it. Today I noticed more, and am now trying to fix it. This HOWTO page seems to be the one article everyone links to to fix bad blocks that SMART is reporting. It's a great page, full of info, however it is fairly outdated and doesn't address my particular setup. Here is how my config is different:   * Instead of one disk, I'm using two disks in a RAID1 array. One disk is reporting errors while the other is fine. The HOWTO is written with only one disk in mind, which bring up various questions such as 'do I use this command on the disk device or the RAID device'?   * I'm using GPT, which fdisk does not support. I've been using gdisk instead, and I'm hoping that it is giving me the same info that I need So, lets get down to it. This is what I have done, however it doesn't seem to be working. Please feel free to double check my calculations and method for errors. The disk reporting errors is /dev/sda:               # smartctl -l selftest /dev/sda     smartctl 5.42 2011-10-20 r3458 [x86_64-linux-3.4.4-2-ARCH] (local build)     Copyright (C) 2002-11 by Bruce Allen, http://smartmontools.sourceforge.net          === START OF READ SMART DATA SECTION ===     SMART Self-test log structure revision number 1     Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error     # 1  Short offline       Completed: read failure       90%     12169         3212761936      With this, we gather that the error resides on LBA 3212761936. Following the HOWTO, I use gdisk to find the start sector to be used later in determining the block number (as I cannot use fdisk since it does not support GPT):               # gdisk -l /dev/sda     GPT fdisk (gdisk) version 0.8.5          Partition table scan:       MBR: protective       BSD: not present       APM: not present       GPT: present          Found valid GPT with protective MBR; using GPT.     Disk /dev/sda: 3907029168 sectors, 1.8 TiB     Logical sector size: 512 bytes     Disk identifier (GUID): CFB87C67-1993-4517-8301-76E16BBEA901     Partition table holds up to 128 entries     First usable sector is 34, last usable sector is 3907029134     Partitions will be aligned on 2048-sector boundaries     Total free space is 2014 sectors (1007.0 KiB)          Number  Start (sector)    End (sector)  Size       Code  Name        1            2048      3907029134   1.8 TiB     FD00  Linux RAID      Using `tunefs` I find the blocksize to be `4096`. Using this info and the calculuation from the HOWTO, I conclude that the block in question is `((3212761936 - 2048) * 512) / 4096 = 401594986`. The HOWTO then directs me to `debugfs` to see if the block is in use (I use the RAID device as it needs an EXT filesystem, this was one of the commands that confused me as I did not, at first, know if I should use /dev/sda or /dev/md0):               # debugfs     debugfs 1.42.4 (12-June-2012)     debugfs:  open /dev/md0     debugfs:  testb 401594986     Block 401594986 not in use      So block 401594986 is empty space, I should be able to write over it without problems. Before writing to it, though, I try to make sure that it, indeed, cannot be read:               # dd if=/dev/sda1 of=/dev/null bs=4096 count=1 seek=401594986     1+0 records in     1+0 records out     4096 bytes (4.1 kB) copied, 0.000198887 s, 20.6 MB/s      If the block could not be read, I wouldn't expect this to work. However, it does. I repeat using `/dev/sda`, `/dev/sda1`, `/dev/sdb`, `/dev/sdb1`, `/dev/md0`, and +-5 to the block number to search around the bad block. It all works. I shrug my shoulders and go ahead and commit the write and sync (I use /dev/md0 because I figured modifying one disk and not the other might cause issues, this way both disks overwrite the bad block):               # dd if=/dev/zero of=/dev/md0 bs=4096 count=1 seek=401594986     1+0 records in     1+0 records out     4096 bytes (4.1 kB) copied, 0.000142366 s, 28.8 MB/s     # sync       I would expect that writing to the bad block would have the disks reassign the block to a good one, however running another SMART test shows differently:               # 1  Short offline       Completed: read failure       90%     12170         3212761936      Back to square 1. So basically, how would I fix a bad block on 1 disk in a RAID1 array? I'm sure I've not done something correctly... Thanks for your time and patience. * * * ## EDIT 1: I've tried to run an long SMART test, with the same LBA returning as bad (the only difference is it reports 30% remaining rather than 90%):               SMART Self-test log structure revision number 1     Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error     # 1  Extended offline    Completed: read failure       30%     12180         3212761936     # 2  Short offline       Completed: read failure       90%     12170         3212761936      I've also used badblocks with the following output. The output is strange and seems to be miss-formatted, but I tried to test the numbers outputed as blocks but debugfs gives an error               # badblocks -sv /dev/sda     Checking blocks 0 to 1953514583     Checking for bad blocks (read-only test): 1606380968ne, 3:57:08 elapsed. (0/0/0 errors)     1606380969ne, 3:57:39 elapsed. (1/0/0 errors)     1606380970ne, 3:58:11 elapsed. (2/0/0 errors)     1606380971ne, 3:58:43 elapsed. (3/0/0 errors)     done     Pass completed, 4 bad blocks found. (4/0/0 errors)     # debugfs     debugfs 1.42.4 (12-June-2012)     debugfs:  open /dev/md0     debugfs:  testb 1606380968     Illegal block number passed to ext2fs_test_block_bitmap #1606380968 for block bitmap for /dev/md0     Block 1606380968 not in use      Not sure where to go from here. `badblocks` definitely found something, but I'm not sure what to do with the information presented... * * * ## EDIT 2 More commands and info. I feel like an idiot forgetting to include this originally. This is SMART values for `/dev/sda`. I have 1 Current_Pending_Sector, and 0 Offline_Uncorrectable.               SMART Attributes Data Structure revision number: 16     Vendor Specific SMART Attributes with Thresholds:     ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE       1 Raw_Read_Error_Rate     0x002f   100   100   051    Pre-fail  Always       -       166       2 Throughput_Performance  0x0026   055   055   000    Old_age   Always       -       18345       3 Spin_Up_Time            0x0023   084   068   025    Pre-fail  Always       -       5078       4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       75       5 Reallocated_Sector_Ct   0x0033   252   252   010    Pre-fail  Always       -       0       7 Seek_Error_Rate         0x002e   252   252   051    Old_age   Always       -       0       8 Seek_Time_Performance   0x0024   252   252   015    Old_age   Offline      -       0       9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       12224      10 Spin_Retry_Count        0x0032   252   252   051    Old_age   Always       -       0      11 Calibration_Retry_Count 0x0032   252   252   000    Old_age   Always       -       0      12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       75     181 Program_Fail_Cnt_Total  0x0022   100   100   000    Old_age   Always       -       1646911     191 G-Sense_Error_Rate      0x0022   100   100   000    Old_age   Always       -       12     192 Power-Off_Retract_Count 0x0022   252   252   000    Old_age   Always       -       0     194 Temperature_Celsius     0x0002   064   059   000    Old_age   Always       -       36 (Min/Max 22/41)     195 Hardware_ECC_Recovered  0x003a   100   100   000    Old_age   Always       -       0     196 Reallocated_Event_Count 0x0032   252   252   000    Old_age   Always       -       0     197 Current_Pending_Sector  0x0032   100   100   000    Old_age   Always       -       1     198 Offline_Uncorrectable   0x0030   252   100   000    Old_age   Offline      -       0     199 UDMA_CRC_Error_Count    0x0036   200   200   000    Old_age   Always       -       0     200 Multi_Zone_Error_Rate   0x002a   100   100   000    Old_age   Always       -       30     223 Load_Retry_Count        0x0032   252   252   000    Old_age   Always       -       0     225 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       77          # mdadm -D /dev/md0     /dev/md0:             Version : 1.2       Creation Time : Thu May  5 06:30:21 2011          Raid Level : raid1          Array Size : 1953512383 (1863.01 GiB 2000.40 GB)       Used Dev Size : 1953512383 (1863.01 GiB 2000.40 GB)        Raid Devices : 2       Total Devices : 2         Persistence : Superblock is persistent              Update Time : Tue Jul  3 22:15:51 2012               State : clean      Active Devices : 2     Working Devices : 2      Failed Devices : 0       Spare Devices : 0                     Name : server:0  (local to host server)                UUID : e7ebaefd:e05c9d6e:3b558391:9b131afb              Events : 67889              Number   Major   Minor   RaidDevice State            2       8        1        0      active sync   /dev/sda1            1       8       17        1      active sync   /dev/sdb1      As per one of the answers: it would seem I did switch `seek` and `skip` for `dd`. I was using seek as that's what is used with the HOWTO. Using this command causes `dd` to hang: # dd if=/dev/sda1 of=/dev/null bs=4096 count=1 skip=401594986 Using blocks around that one (..84, ..85, ..87, ..88) seems to work just fine, and using /dev/sdb1 with block `401594986` reads just fine as well (as expected as that disk passed SMART testing). Now, the question that I have is: When writing over this area to reassign the blocks, do I use `/dev/sda1` or `/dev/md0`? I don't want to cause any issues with the RAID array by writing directly to one disk and not having the other disk update. ## EDIT 3 Writing to the block directly produced filesystem errors. I've chosen an answer that solved the problem quickly:               # 1  Short offline       Completed without error       00%     14211         -     # 2  Extended offline    Completed: read failure       30%     12244         3212761936      Thanks to everyone who helped. =)


title: Get exit status of a process over SSH

text: Not sure how to google this (I tried with some things and didn't get much) or how this is even called. This is my typical workflow: >   1. SSH to a server >   2. run something there and leave it running in the background (bg command > for example) >   3. exit SSH and come back later > Is there any way I could, when I come back later, see if the process was killed and on what status it was killed (segfault or something else) or get any kind of exit status information of the process I was running? For example, if I run it normally and leave my terminal open, it will print segmentation fault or something else, but I have no idea how to obtain this status once I disconnected and connected back again.


title: Output visual (ASCII) Debian dependency tree to terminal?

text: I'm not sure if this is more of a SuperUser or UnixLinux question, but I'll try here... Recently, I found this: #710689 - aptitude: use unicode character in the trees - Debian Bug report logs > It would be nice when aptitude would use unicode characters for the trees in > the dependency lists, e.g. instead of: >   >   >     --\ Depends (3) >        --- libc-dev-bin (= 2.17-3) >        --- libc6 (= 2.17-3) >        --- linux-libc-dev >      --\ Suggests (2) >        --- glibc-doc (UNSATISFIED) >        --\ manpages-dev >   > > ... ... and I thought - wow, I really like that ASCII-art tree output, wasn't aware that `aptitude` could do that! So, I start messing for an hour with `aptitude` command line switches - and I simply cannot get that output? So my initial question was - where does that output come from in the first place?! After a while, I realized that on my system, `aptitude` ultimately symlinks to `/usr/bin/aptitude-curses`; and I finally realized that `aptitude` has a `curses` interface! `:/` So, I finally run `aptitude` without any arguments - and so the `curses` interface starts, and I can see something like this: ![aptitude-curses-terminal](http://i.stack.imgur.com/nDfgi.png) ... so quite obviously, those ASCII tree characters come from the curses interface. So I was wondering - is there a Debian/apt tool, which will output such a "visual" ASCII tree - but with actual dependencies of packages? I know about debtree - Package dependency graphs (also software recommendation - How to visually display dependencies of a package? - Ask Ubuntu); but I'd rather have something in terminal, resembling a directory tree (rather than the "unordered" [in terms of node position] graphs from `debtree`, generated by `graphviz`'s `dot`). I've also seen Is there anything that will show dependencies visually, like a tree?, which recommends:               $ apt-rdepends aptitude     Reading package lists... Done     Building dependency tree            Reading state information... Done     aptitude       Depends: libapt-pkg4.10       Depends: libboost-iostreams1.42.0 (>= 1.42.0-1)       Depends: libc6 (>= 2.4)       Depends: libcwidget3       Depends: libept1       Depends: libgcc1 (>= 1:4.1.1)       Depends: libncursesw5 (>= 5.7+20100313)       Depends: libsigc++-2.0-0c2a (>= 2.0.2)       Depends: libsqlite3-0 (>= 3.7.3)       Depends: libstdc++6 (>= 4.5)       Depends: libxapian22     libapt-pkg4.10     libboost-iostreams1.42.0       Depends: libbz2-1.0       Depends: libc6 (>= 2.3.6-6~)       Depends: libgcc1 (>= 1:4.1.1)       Depends: libstdc++6 (>= 4.2.1)       Depends: zlib1g (>= 1:1.1.4)     ...      ... which is good, because it lists first the immediate dependencies of the required package; and then the dependencies of the first-level dependency packages, and so on - but it's not visualized as a tree (and actually, `aptitude`'s `curses` interface simply shows installed info when you expand dependency node; it does not expand to further dependencies). So, the question is - is there a tool, that would produce a dependency tree graph with terminal characters - like, say, in the following pseudocode:               $ pseudo-deb-graph --show-package="aptitude"          aptitude       --- Depends: libapt-pkg4.10       --\ Depends: libboost-iostreams1.42.0 (>= 1.42.0-1)          --- Depends: libbz2-1.0          --- Depends: libc6 (>= 2.4)       --\ Depends: libc6 (>= 2.3.6-6~)          --\ Depends: libc-bin (= 2.13-0ubuntu13)             --- ...          --\ Depends: libgcc1             --- ...          --\ Depends: tzdata             --- ...     ...


title: Theming in tiling window managers?

text: I am trying out tiling window managers like scrotWM, and have noticed that GUI programs start with a "theme" (or lack, thereof) that looks like the bland Redmond theme. Is there a way to specify the appearance/themes of windows in a tiling window manager? Or is it window manager OR GUI toolkit specific? Is there anything I can do? Thanks.


title: Ssh login hook?

text: Is there a way to run a script/command every time a user connects using ssh? Can it be configured globally (i.e run the script when **any** user login)? I came across this question on Identica, but there is no answer yet and would like to know it anyway.


title: Attempting to update Amazon Route53 using a script, but domain is not being updated

text: I have several Amazon EC2 instances, running Ubuntu 10.04, with which I'd like to use Amazon's Route53. I setup a script as described in Shlomo Swidler's article, but I'm still missing something. When the script runs, it doesn't return any output, which I initially assumed meant it ran correctly. However, when I check the DNS records using MyR53DNS, there are no entries for my instances. Here's my script:               #!/bin/tcsh -f          set root=`dirname $0`     setenv EC2_HOME /usr/lib/ec2-api-tools     setenv EC2_CERT /etc/cron.route53/ec2_x509_cert.pem     setenv EC2_PRIVATE_KEY /etc/cron.route53/ec2_x509_private.pem     setenv AWS_ACCESS_KEY_ID myaccesskeyid     setenv AWS_SECRET_ACCESS_KEY myaccesskey          /usr/bin/ec2-describe-instances | \     perl -ne '/^INSTANCE\s+(i-\S+).*?(\S+\.amazonaws\.com)/ \     and do { $dns = $2; print "$1 $dns\n" }; /^TAG.+\sShortName\s+(\S+)/ \     and print "$1 $dns\n"' | \     perl -ane 'print "$F[0] CNAME $F[1] --replace\n"' | \     xargs -n 4 /etc/cron.route53/cli53/cli53.py \     rrcreate -x 60 mydomain.com      Does anyone see a problem with this script? If its not the script, what else could be preventing my Route53 domain from being updated? I am using the Security Groups to IP-restrict the instances. I've tried opening port 53, but that didn't seem to have an effect. Is there another port that Route53 uses? I'd appreciate any help or guidance the Unix & Linux community can offer. Let me know if you need any further info. * * * Here is the results of running: **tcsh -f -x /etc/cron.route53/aws- route53.sh**               set root=`dirname $0`     dirname /etc/cron.route53/aws-route53.sh     setenv EC2_HOME /usr/lib/ec2-api-tools     setenv EC2_CERT /etc/cron.route53/ec2_x509_cert.pem     setenv EC2_PRIVATE_KEY /etc/cron.route53/ec2_x509_private.pem     setenv AWS_ACCESS_KEY_ID myaccesskeyid     setenv AWS_SECRET_ACCESS_KEY myaccesskey      I receive the same output whether the last 7 lines are commented or uncommented. * * *               > cat -A  /etc/cron.route53/aws-route53.sh     #!/bin/tcsh -f$     $     set root=`dirname $0`$     setenv EC2_HOME /usr/lib/ec2-api-tools$     setenv EC2_CERT /etc/cron.route53/ec2_x509_cert.pem$     setenv EC2_PRIVATE_KEY /etc/cron.route53/ec2_x509_private.pem$     setenv AWS_ACCESS_KEY_ID myaccesskeyid$     setenv AWS_SECRET_ACCESS_KEY myaccesskey$     $     /usr/bin/ec2-describe-instances | \$     perl -ne '/^INSTANCE\s+(i-\S+).*?(\S+\.amazonaws\.com)/ \$     and do { $dns = $2; print "$1 $dns\n" }; /^TAG.+\sShortName\s+(\S+)/ \$     and print "$1 $dns\n"' | \$     perl -ane 'print "$F[0] CNAME $F[1] --replace\n"' | \$     xargs -n 4 /etc/cron.route53/cli53/cli53.py \$     rrcreate -x 60 mydomain.com          > cat /etc/cron.route53/aws-route53.sh     #!/bin/tcsh -f          set root=`dirname $0`     setenv EC2_HOME /usr/lib/ec2-api-tools     setenv EC2_CERT /etc/cron.route53/ec2_x509_cert.pem     setenv EC2_PRIVATE_KEY /etc/cron.route53/ec2_x509_private.pem     setenv AWS_ACCESS_KEY_ID myaccesskeyid     setenv AWS_SECRET_ACCESS_KEY myaccesskey          /usr/bin/ec2-describe-instances | \     perl -ne '/^INSTANCE\s+(i-\S+).*?(\S+\.amazonaws\.com)/ \     and do { $dns = $2; print "$1 $dns\n" }; /^TAG.+\sShortName\s+(\S+)/ \     and print "$1 $dns\n"' | \     perl -ane 'print "$F[0] CNAME $F[1] --replace\n"' | \     xargs -n 4 /etc/cron.route53/cli53/cli53.py \     rrcreate -x 60 mydomain.com


title: How to detect what is causing entries in the "last" cmd's output?

text: last     ...     date      {                                 Sun Mar 31 12:00     date      |                                 Sun Mar 31 12:00     date      {                                 Sun Mar 31 00:00     date      |                                 Sun Mar 31 00:00     ...      Why are there e.x.: "{" in the last commands output? Some sort of script could do this? (on OpenBSD 5.1)


title: Desktop background appears black when using XFCE

text: I've installed Xfce4 on my laptop which runs Linux Mint 17 with Cinamon default desktop. Everything works OK and I customized my lightweight Xfce, like change menu location and desktop background that it is similar to my Cinamon desktop and used it for a while. Suddenly after last restart my desktop background becomes black and there is no option for desktop background change when I right click on desktop. I should mention that               xfdesktop &       didn't help, which tells it's already running. Some icons like **Computer** , **Home** and **Oracle VM** that was already there is showing, but my **Trash** or other icons did not. I've tried everywhere in               xfce4-settings-manager      but could not get my desktop background back running xfdesktop cause this message:               ** (xfdesktop:3068): WARNING **: xfdesktop: another desktop manager is running.      running               killall xfdesktop      results               xfdesktop: no process found      It seems to me another process takes place of xfdesktop I don't know how can I find and replace it


title: IP to Country console command

text: Is there a console command that takes an IP address as an input and shows its geographical information like city, country, ISP, etc.?


title: Is there a tool for summarizing what all commands do?

text: So I understand that there are `man` pages for getting the documentation when the internet is unavailable, or when you need advanced uses, but what if I'm offline and I don't even know what tool I need for the job? Is there a command that lets me see each program/command and a short description?


title: How can I use nested [] to replace a if-then-fi ? ("[: -f: binary operator expected")

text: In my .bashrc file I have:               if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion; fi      I wanted to use `[]` around it instead of `if then fi` I already have               [ -f ~/.bash_aliases ] && source ~/.bash_aliases     [ "${BASH_VERSINFO[0]}" -ge 4 ] && shopt -s autocd     [ -f ~/.git-completion.bash ] && source ~/.git-completion.bash      so I thought maybe I could use               [ [ -f /etc/bash_completion ] && [! shopt -oq posix] ] && . /etc/bash_completion      but I get               -bash: [: -f: binary operator expected


title: Paradox about a-z vs A-Z

text: I wrote a shell script to recognize the type of character               printf "Enter a character: "     read var     case "$var" in     [a-z])             echo "You entered a lower case alphabet."             ;;     [A-Z])             echo "You entered an upper case alphabet."             ;;     [0-9])             echo "You entered a digit."             ;;     ?)             echo "You entered a special simbol."             ;;     *)             echo "You entered more then one character."             ;;     esac      But if input letter is whether lower-case or upper-case the output is: > You entered a lower case alphabet. The output is correct if I write it this way:               printf "Enter a character: "     read var     case "$var" in     [A-Z])             echo "You entered a upper case alphabet."             ;;     [a-z])             echo "You entered an lower case alphabet."             ;;     [0-9])             echo "You entered a digit."             ;;     ?)             echo "You entered a special simbol."             ;;     *)             echo "You entered more then one character."             ;;     esac      Can't figure out why. The only logical answer is `[a-z]` includes lower-case and upper-case characters.


title: Regular expression find 3 or 4 numbers

text: So, I have 50+ words and I have to match the numbers in them. These numbers can be 3 or 4 digit numbers. I think I tried every way there is, but nothing seems to work (I need to remember the number as a pattern). My attempts:               '/\(.*\)\([0-9][0-9]?[0-9][0-9]\)\(.*\)/'     '/\(.*\)\([0-9]\{3,4\}\)\(.*\)/'     '/\(.*\)\(([0-9][0-9][0-9][0-9]|[0-9][0-9][0-9])\)\(.*\)/'     ...      It always matches only 3 numbers, or the whole word. **INPUT:**               1844-PAL.Bak      IMG_1959.bak       ZER_1940.BAK       PEN225.bak     word-1943.BAK      **NEED TO REMEMBER AS A PATTERN:**               1844     1959     1940     225     1943


title: How do I change my pacman root so that it downloads packages elsewhere?

text: My `/root` is full to the brim and I can't install new packages. My `/home` has 8 times the space of my `/root`, but pacman is set to install new packages on `/root`. Is there a safe way that I can change where pacman permanently installs new packages?


title: Crontab in Daylight Savings

text: This weekend with daylight savings, we had a situation that when the system clock hit 3:00am from the jump, we had hundreds of processes fire off out of the crontab. Everything I'm reading says that if you schedule processes during this time and you're running the system in the local timezone, then you may have scripts not run at all (since you skip over the 2:00 hour). However, in this situation, we had several processes spawn 50+ times out of the cron. Has anyone experienced why several processes would be executed so many times? Again, I've read that they may run twice, or not at all (depending on fall/spring), but 50+ times? If it helps, each script that ran was scheduled at the top of the hour of 3:00, and not again for at least an hour. Here are a few:               0  3  * * *     0 0-6 * * *


title: "NFS <server> not responding still trying" error timestamp

text: Sometime while my putty session is connected to server, it gets this NFS error. Note the server is Solaris 11 based.               NFS server <server> not responding still trying     NFS server <server> not responding still trying     NFS server <server> not responding still trying     NFS server <server> not responding still trying      . . After some tries it becomes ok.               NFS server <server> ok     NFS server <server> ok     NFS server <server> ok      Is there a way by which I can get to know the exact timestamp when this error occurs? I am quite new to Unix and could not find a way to get the timestamp. Regards Jim


title: Get running status of mongodb

text: Having a script where I start/stop various services depending on what I need. For example Apache, BIND, MySQL, PostFix, Memcached, Tomcat, ... and so on. Depending on status options to script etc. various actions are taken. For most this works fine: (example with Apache)               if service apache2 status >/dev/null; then         # ... do some action     fi      For others one have to use other tricks like `mysqladmin ping`. However I'm not able to find any good way to check status for `mongodb`.               service mongodb status      It has the same _"sickness"_ as MySQL and yield `mongodb stop/waiting` and also evaluates to true, even if service is not up and running. Have looked at `mongod`, `mongostat` etc. but not found any option for this. One way could be to use `ps` or perhaps better `netstat` and combine either with `grep` or the like, but wondering if there is a better (more native/targeted) way to check status. Could also grep for `stop/waiting`, but not sure how reliable this is, and guess it could likely break in a future upgrade.


title: GPU computation on Linux using open source kernel drivers

text: Assuming freedom to choose whichever currently available GPU is most suited for the job, is it currently feasible to do GPU computation (either CUDA or OpenCL) on Linux using one of the _open source_ GPU kernel drivers (i.e. not fgrlx or nvidia's binary driver)?


title: Wpa-supplicant overriding iwconfig

text: `Wpa-supplicant` is not clearing its settings when I disconnect, and is overriding `iwconfig` on my next connection. These settings are persisting even through reboot - the only way to get back online is to take wpa- supplicant out of the pipeline. I disconnect using a script which includes everything I could think of:               sudo dhcpcd --release "$INTERFACE"     sudo iwconfig "$INTERFACE" essid off     sudo iwconfig "$INTERFACE" ap off     sudo ifconfig "$INTERFACE" down      This worked well until I tried to integrate `wpa-supplicant` in it. My "connect" script includes these lines, which I thought would clear out any remaining settings:               sudo killall wpa_supplicant 2>/dev/null     sudo rm "/var/run/wpa_supplicant/$INTERFACE" 2>/dev/null     sudo killall dhcpcd 2>/dev/null     sudo rm "/var/lib/dhcpcd/$INTERFACE" 2>/dev/null      How do I "reset" `wpa-supplicant`? [edit] I tried               wpa_cli -i "$INTERFACE" reconfigure      but that gave me               Failed to connect to non-global ctrl_ifname: wlp2s3  error: No such file or directory


title: Can't find a way to customize Mutter under Elementary-OS

text: I just installed Elementary OS, even if it's still buggy and not even in beta version I am very satisfied of the look, but I would like to have some option to customize the effects and settings like I could do with Compiz but I couldn't find any settings panel related to Mutter! Is there any GUI utility I should install ?


title: VirtualBox with aMule - How to configure network, port forwarding... properly?

text: for security reasons I am running aMule inside VirtualBox.   * Guest and Host systems are Linux (to be more specific Arch 64 distro)   * Host system has public ip directly connected to internet (no router)   * Guest System I almost pure after installation (no iptables, etc only VirtualBox addons)   * I'd like to setup three ports for aMule: 4884, 4885, 4887   * I'd love to use NAT VirtualBox interface, if possible For this case I've made following forwarding rules:               VBoxManage modifyvm "$vm" --natpf1 "amule_u4,udp,,4884,,4884"     VBoxManage modifyvm "$vm" --natpf1 "amule_u5,udp,,4885,,4885"     VBoxManage modifyvm "$vm" --natpf1 "amule_u7,udp,,4887,,4887"     VBoxManage modifyvm "$vm" --natpf1 "amule_t4,tcp,,4884,,4884"     VBoxManage modifyvm "$vm" --natpf1 "amule_t5,tcp,,4885,,4885"     VBoxManage modifyvm "$vm" --natpf1 "amule_t7,tcp,,4887,,4887"      On Host I've added to `/etc/hosts.allow` :               # amule     4884: ALL     4885: ALL     4887: ALL      Sanity check made with `netcat` works:               netcat -l -p 4885 # inside VM     netcat $ip 4885  # from "outside world"      To ensure:               aMule standard TCP Port: 4884     UDP port for server requests (TCP+3): 4887     Extended UDP port (Kad/global search): 4885      But aMule gets only **"Low-ID"** and **"Kad: Firewalled"**. Is it possible to configure VM's Nat interface and aMule to cooperate nicely ? If yes, how ? If it is not possible, why? And how to do this other way?


title: Redirect requests to my external IP/port to an internal IP/port?

text: I have a dedicated server running KVM virtualization with n public IP addresses dedicated to n-1 web-facing virtual machines. Now I'd like to set up some web-facing VM's that don't have a dedicated address, but instead will have 2 or 3 ports forwarded for them from the host machine. Bridge configuration is:               brctl show      ![enter image description here](http://i.stack.imgur.com/Z9nf4.jpg) Let's say I would like to forward   * 178.126.193.153:201 to 192.168.1.101:22   * 178.126.193.153:801 to 192.168.1.101:80 First, I have enabled port forwarding on a host machine by uncommenting               # net.ipv4.ip_forward=1      in `/etc/sysctl.conf`, then I did               sysctl -p /etc/sysctl.conf     service network restart      Then, similar to the recipe in this question, I did:               iptables -t nat -A PREROUTING -p tcp -i br0 --dport 201 -j DNAT --to-destination 192.168.1.101:22     iptables -A FORWARD -p tcp -d 192.168.1.101 --dport 201 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT     iptables -t nat -A PREROUTING -p tcp -i br0 --dport 801 -j DNAT --to-destination 192.168.1.101:80     iptables -A FORWARD -p tcp -d 192.168.1.101 --dport 801 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT      I ran `ifconfig` on a guest machine and checked that its interface eth0, indeed, has the IP address 192.168.1.101. The interface inside of virtual machine is called `eth0`, is this right? But it doesn't work: `nmap 178.126.193.153` doesn't show an open port 201 nor 801, and `ssh -l root -p 201 178.126.193.153` gets me               ssh: connect to host 178.126.193.153 port 201: Connection refused      `ip route` on a host machine returns               178.126.193.128/26 dev br0  proto kernel  scope link  src 178.162.193.153      192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1      169.254.0.0/16 dev br0  scope link  metric 1004      default via 178.126.193.190 dev br0       What am I doing wrong?


title: How to undo `set -x`?

text: I typed `set -x` in terminal. Now the terminal keeps printing the last command run on top of my output so the command               ~]$echo "this is what I see"      returns               + echo 'this is what I see'     this is what I see      There is no man page for `set`, how do I turn `set -x` off?


title: Nvidia 9800GT and HP w1907v resolution woes

text: I was happily dual-booting Windows 7 and Ubuntu 10.10 a year or two ago, with, as in the title, an Nvidia GeForce 9800 GT graphics card (on a Gigabyte GA- MA790XT-UD4P) outputting VGA to an HP w1907v monitor (1440x900). I then put my PC in storage for a month or so, all peripherals disconnected, and when I reassembled it and booted it up again, both Windows and Linux failed to allow me to use a 1440x900 resolution. I managed to fix Windows, though I don't remember how - it was all within the regular graphics interface as far as I remember, maybe installing updated drivers. However, to this day I've not been able to make Linux recognise resolutions larger than 1024x768. I went through several versions of Ubuntu and many different guides, played with my `xorg.conf` file, and most recently installed Fedora 17, with the same results - no resolutions greater than 1024x768. I followed this guide in particular to install Nvidia drivers, but no luck. I then tried installing the drivers from Nvidia's website (it was necessary to stop X using `init 3`, install the drivers, then `startx`), but the only outcome of that was removing all options except 640x480. After playing around with drivers for so long, I'm beginning to wonder if the problem isn't with the video card/drivers, but with the monitor. To that end, I have a few questions:   1. Are there known issues with Nvidia drivers in Linux, especially for the 9800 GT? I've seen comments indicating varying levels of success with any guide I've tried.   2. Would I see better support for a different series of Nvidia card, or an AMD card? (I've been thinking of upgrading.)   3. Could this sort of issue be caused by the monitor, and not a fault with the graphics card?   4. Might the monitor need drivers of its own? Thanks for anything you can tell me! I really want to be Linux-ing it up, and I'm coming to a point where I really need it for university and non-university work, but I just can't seem to deal with this issue. EDIT: Contents of /var/log/Xorg.0.log `xrandr` output:               xrandr: Failed to get size of gamma for output default     Screen 0: minimum 320 x 240, current 640 x 480, maximum 640 x 480     default connected 640x480+0+0 0mm x 0mm        640x480        50.0*         320x240        51.0


title: machine hardware name, processor type and hardware platform

text: The followings are the machine hardware names, processor types and hardware platforms returned by `uname`: on a server (with some 64-bit Linux distribution)               -bash-4.1$ uname -m     x86_64     -bash-4.1$ uname -p     x86_64     -bash-4.1$ uname -i     x86_64      on my laptop (Thinkpad T400 with 32-bit Ubuntu 12.04)               $ uname -m     i686     $ uname -p     i686     $ uname -i     i386      I wonder if machine hardware name and processor type are always the same thing? What is hardware platform? Why does it seem to indicate something about the OS? Thanks!


title: How to change desktop enviroment in Raspbian?

text: I'm running Raspbian “wheezy”, a Debian based Linux distribution for the Raspberry Pi and I would like to know where I can change the desktop environment that boots with the OS. In particular, how can I replace LXDE with an custom QT or Java program? Could you please point me in the right direction? Thank you.


title: Why can't anonymous users delete files via ftp?

text: I've created a new directory "uploads" in `/var/ftp`. The owner and group of this directory is "ftp" and the permissions are set to 777. Content of my `vsftpd.conf` file:               anonymous_enable=YES          local_enable=YES         write_enable=YES         local_umask=022          anon_upload_enable=YES         anon_mkdir_write_enable=YES          xferlog_enable=YES         xferlog_file=/var/log/xferlog         xferlog_std_format=YES          nopriv_user=ftpsecure          ascii_upload_enable=YES     ascii_download_enable=YES          listen=YES          pam_service_name=vsftpd     userlist_enable=YES     tcp_wrappers=YES      SELINUX permissions are:               allow_ftpd_anon_write --> on     allow_ftpd_full_access --> on      I can upload files to the directory, but can't delete files through FTP. Can anyone suggest me what to do?


title: Un-mount active partition

text: Is it possible to umount the partition, whose files/directories are in use? **The underlying files and directories are in memory so un-mounting the partition is technically safe (I guess).** But `umount` is not allowing me to un-mount it. (Who is denying this operation: umount or kernel?)


title: Why do I need the double dash before argument passed to sh by xargs -I for it to work properly?

text: Sorry for the mouthful title. Here is the command in question                find . -name "*.txt" | xargs -Ifile sh -c 'echo $(basename $1) ' -- file      So without the double dash the `file` is not passed to `sh` and then get recognized as `$1`. Why is that? I know that `--` prevents the consequent argument from being recognized as command line options. But since `file` is not prepended with a dash, it seems as though there is no reason for it to get recognized as a command line option.


title: Add file to deep inside a zip file

text: Say I want to add the file `file.txt` to `foo.zip`, I could just do `zip -u foo.zip file.txt`. However inside the zip-file there already exist a folder with the path `foo.zip/very/many/paths/` (relatively to the zip-file). How would I add `file.txt` to the zip-file so it's location inside the zip- file would be `foo.zip/very/many/paths/file.txt`? I could create the directory structure needed first, but isn't there an easier way? I would normally do it like this:               $ ls     file.txt     foo.zip     $ mkdir very     $ mkdir very/many     $ mkdir very/many/paths     $ cp file.txt very/many/paths     $ zip -u foo.zip very/many/paths/file.txt     $ rm -rf very


title: Write a script to create users with pre-defined passwords

text: I need a simple script. One file named `userID` consists of 10 unixID and another file with name `passwd` consists of 10 password for those 10 unixID in file `userID`. The first word of each file represents unixID and the corresponding passwd for that unixID. I think it would need to execute two for loop or something to assign password for that specific userID Does anyone have any suggestions?


title: Directory size as reported by stat on NTFS

text: We all have seen gazillions of directory size reports from ls or stat. We know they don't mean real size of the content, but they do have meaning, but since the meaning is not very useful for normal situations, we learned to ignore them. (And it's so often 4,0K that it's actually easy to learn to ignore them _visually_.) Now I just `ll` a directory on my NTFS volume and I see:   * couple of "4,0K" folders   * a just-created folder with a bunch of Unicode-named files, showing "664   * on old folder showing zero, while still having subdirectories So I wonder: How directory size works with Linux and ntfs-3g? How does stat or kernel count it? How do records added to the directory influence this number?


title: Using setuid Properly

text: I've been scared too much by the warning about setuid. However I cannot find a way around using it. I want to be able to run: `arp -s 198.51.100.1 00:53:00:12:34:56` as the user `steven` but arp -s requires root. Would this be the correct way to do it?               sudo nano example.sh     sudo chmod u+s example.sh     sudo chmod og-w example.sh     sudo chmod o+x example.sh     ./example.sh


title: Copying a file on a JFS filesystem, does not follow ACL guidelines

text: I have a JFS filesystem               /dev/md2 on /mnt/hd2 type jfs (rw)      to which I'm trying to copy some folders into target folder `/mnt/hd2/videos/movies/`. NOTE: I'm actually not using this target folder directly, but a symbolic link in my home folder that points to the target folder. Now, the folder `/mnt/hd2/videos/movies/` has default group ACL enabled:               nass@stargaze:/mnt/hd2/videos$ getfacl Movies/     # file: Movies/     # owner: nass     # group: shares     # flags: -s-     user::rwx     group::rwx     other::r-x     default:user::rwx     default:group::rwx     default:group:shares:rwx     default:mask::rwx     default:other::r-x      I copied the folders from a temporary folder and expected to get the group write permission to be set as well, instead the folder looks like this:               drwxr-sr-x+ 2 nass shares        24 Aug  6 01:12 The_Movie/      I had set ACLs on the "videos" folder initially, and all the sub-folders have inherited the default from that top folder. What have I missed? EDIT: JFS ACL support is indeed compiled in the kernel. EDIT2: getfacl on `The_Movie/` looks like               nass@stargaze:/mnt/hd2/videos/Movies$ getfacl The_Movie/     # file: The_Movie/     # owner: nass     # group: shares     # flags: -s-     user::rwx     group::rwx                      #effective:r-x     group:shares:rwx                #effective:r-x     mask::r-x     other::r-x     default:user::rwx     default:group::rwx     default:group:shares:rwx     default:mask::rwx     default:other::r-x      the source folder is on another jfs disk. the folder was transferred to that source location through a cifs share and, i think it was given initial permissions 755.


title: How to colorize output of git?

text: Is there a way to color output for git (or any command)? Consider:               baller@Laptop:~/rails/spunky-monkey$ git status     # On branch new-message-types     # Changes not staged for commit:     #   (use "git add <file>..." to update what will be committed)     #   (use "git checkout -- <file>..." to discard changes in working directory)     #     #       modified:   app/models/message_type.rb     #     no changes added to commit (use "git add" and/or "git commit -a")     baller@Laptop:~/rails/spunky-monkey$ git add app/models      And               baller@Laptop:~/rails/spunky-monkey$ git status     # On branch new-message-types     # Changes to be committed:     #   (use "git reset HEAD <file>..." to unstage)     #     #       modified:   app/models/message_type.rb     #      The output looks the same, but the information is totally different: the file has gone from unstaged to staged for commit. Is there a way to colorize the output? For example, files that are unstaged are red, staged are green? Or even `Changes not staged for commit:` to red and `# Changes to be committed:` to green? Working in Ubuntu. EDIT: Googling found this answer which works great: `git config --global --add color.ui true`. However, is there any more general solution for adding color to a command output?


title: How do I keep KDE from asking new users for a password when I use /etc/skel to set up their enviroment?

text: I made this nice custom KDE setup on Arch Linux with customised settings like desktop background, panel settings, kwin settings, etc. I heard that if you copy all the hidden files from your `/home/"dummy user"/` to `/etc/skel` it would copy my settings exactly the way they are from "dummy user" to all newly created users created after this procedure. I got what I wanted, which is copying my desktop interface to all newly created users on the system. But it keeps giving me all these password windows saying I need permission from "dummy user" to use certain files and apps like Nepomuk. How do I get these prompts to go away so the next user I make doesn't see them? or what files do i stay away from to avoid hitting user spesific data.


title: chown not permitted, but I have write access. How can I take recursive ownership?

text: Consider the following scenario:   1. I have `rwx` access to a directory as a member of the group id of the directory.    2. The system admin does not let users run `chown` (see this thread for details) **How can I take recursive ownership of the directory?** I believe I can do the following, assuming that I want to own `A`               cp -R A B     rm -R A     mv B A      but this is tedious and can require a large amount of space if `A` is large.


title: Automatically open a remote desktop connection upon login

text: I have installed Linux Mint to one of my desktop PCs. I have downloaded and installed Freerdp-x11 for me to connect into my Windows Terminal Server. I want the terminal command line to connect automatically to the Windows terminal server, so that every time I boot my Linux Mint PC, I wouldn't have to keep typing `xfreerdp 000.000.0.000` on the terminal command line. Is there a script for it?


title: How can I convert a PNG to a PDF in high quality so it's not blurry or fuzzy?

text: There are a lot of questions out there about how to convert a PDF file to a PNG image, but I'm looking to take a nice sharp PNG file and just basically wrap it or embed it in a PDF file without having it look blurry or fuzzy. I realize with imagemagic installed I can do a simple conversion like:               convert sample.png sample.pdf      I've also tried a lot of the switches to set the depth, and also the quality setting:               convert -quality 100 sample.png sample.pdf      However the PDF still comes out looking blurry / fuzzy. Here's a sample image: ![](http://img406.imageshack.us/img406/6461/picture3mu.png) As a png it's crisp and clean. When I convert it to a PDF, even at the same size it looks blurry: ![Picture 4.png](http://img803.imageshack.us/img803/9969/picture4at.png) How can I convert PNG to a PDF in high quality?


title: How to extend CentOS 5 partition on VMware?

text: I have a CentOS 5 virtual machine and I added 20GB more to disk size. How do I initialize and extend the available space? I'm new to Linux, so what should I do? I tried loading GParted as well, but the drive is locked; how do I unlock it? ![enter image description here](http://i.stack.imgur.com/vB3og.jpg) ![enter image description here](http://i.stack.imgur.com/u5bfi.jpg)


title: How to install subversion 1.6.x on SLE11?

text: I need specific version of subversion 1.6.x on my SLE11 (SUSE Linux Enterprise Server 11 (x86_64)) but I do not know how to install it. If I follow the instructions on http://software.opensuse.org/download.html?project=devel:tools:scm:svn&package=subversion I get subversion 1.7.x installed.


title: Arch Linux netinstall - conflicting packages on install

text: I'm using the latest Arch Netinstall image. I just went through and selected about 150 packages to download and install. However, when I get to the "Install Packges" step, I get an error saying that I have two conflicting packages (openjdk6 and jre7-openjdk) and the install fails and sends me back to the menu. The problem is, I don't know how to remove the conflicting package from my install list. If I go back to the list of packages, it erases the selections I made previously and I have to reselect each package all over again (I've done it twice already, no fun). Is there a way to omit a package without having to reselect all of them?


title: How do I make a shell script that sends output to a process

text: I'm currently running a server console program in a screen because I need to both read it and occasionally send commands. I'd like to run the app as a deamon in the background (start/stop it with init). I could tail -f the log, but that won't let me send input to the process. Is there any way to set this up so I can both read and send input, but still have it running in the background? I'd also like to be able to send input to the deamon from different processes as well (a shell script that could send a "Stop\n" command, for instance)


title: Bundle my scripts to make an installer in Unix?

text: We've got a PHP script running MongoDB in the background. I want to make it a bundle (Installer) for Unix. I will use it to install the following on any machines:   1. Install Apache, PHP + MongoDB    2. Setup the PHP + MongoDB project Can anyone direct me to an appropriate resources to achieve this? What are your suggestions? What is the best solution if you want to deploy a package to a client?


title: How do I install drivers for AR9271 on Centos 6?

text: I'm trying to get a USB wireless card that runs off of the AR9271 chipset to work with Centos 6.2. I read this description for compat-wireless and wanted to use a package manager (i.e. yum) because I wanted a relatively easy uninstall if it didn't work. I found a package on ELRepo. I installed kmod-compat-wireless.i686 via `yum install` as root. After rebooting and sticking the USB wireless card in, I didn't see anything that indicated that wireless was working. What should I be looking for? How can I make sure that this driver is loaded?


title: How to find the cause of an ssh-scan exploit?

text: One customer emailed my about their provider about to shut down a server because ssh attacks. I logged in to the server and found a lot of ssh-scan processes, and some strange files in /tmp. I had to shut it down, since I didn't know what to do. Before rebuilding the server, is there a way I can find out how this happened in order to prevent it from happening again?


title: Solaris: how to forward cron e-mails?

text: If a **cron** job produces output it is e-mailed to the user's account. I would like to redirect this e-mail to another e-mail account. Preferably on a user-by-user basis. I've looked into some options that are often mentioned in other postings:   1. Using the cron `MAILTO` variable. Won't work. That one is not supported on Solaris. It is a Linux thing, potentially also a BSD thing, but certainly doesn't exist on Solaris.   2. Using the `~/.forward` file. Can't make that work. I suspect it is because this file is really related to `sendmail` universe and I'm not sure Solaris cron actually uses `sendmail` to send its e-mails. To get to the bottom of this I guess I need to understand exactly by which mechanism Solaris cron sends e-mails. Anyone ?


title: Linux: create list of text with multiple operators

text: I want to make a list like this:               7785237_770x770_de3b540dc13ed50023d17854513b40aa07e50a6a     732308_770x770_ec5c344c0114011a5306b31142ff9b001813f6d6     7430796_800x800_ec0f2e614e2dc460fca7e626d83073c827dc9130     7431018_800x800_7caa40b85c21485c64f2ad509a0d9cc1ed3ba526      So to explain: First block before the first "_" is just a number between 0 and 9500000 - second block varies between two variables: "770x770" and "800x800"   Last block is a 40 character long HEX block. So what I want to do, is to generate all possible combinations of these, and combine it into one line. How do I do this? Don't know if it can be done in BASH, or it should be done in perl/something similar.


title: apt-get purge does not uninstall completely

text: I have installed emacs with `apt-get`. I tried to remove it later on, but the binary is left.               root@ionian:/home/gauthier# apt-get --purge remove emacs     Reading package lists... Done     Building dependency tree            Reading state information... Done     Package 'emacs' is not installed, so not removed     0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.     root@ionian:/home/gauthier# which emacs     /usr/bin/emacs     root@ionian:/home/gauthier#       (the purge shown above is not the first attempt, this is just to show that the package was already removed.) emacs was not installed before I did `apt-get install emacs`. Any idea what is going on? Why doesn't apt-get see the binary, why does it think emacs is already uninstalled? What would have been a clean way to uninstall emacs completely?


title: How does one atomically change a symlink to a directory in busybox?

text: I am trying to (as close as possibly) atomically change a symlink. I've tried:               ln -sf other_dir existing_symlink      That just put the new symlink in the directory that existing_symlink pointed to.               ln -sf other_dir new_symlink     mv -f new_symlink existing_symlink      That did the same thing: it moved the symlink into the directory.               cp -s other_dir existing_symlink      It refuses because it's a directory. I've read that `mv -T` is was made for this, but busybox doesn't have the `-T` flag.


title: Buffers or tabs in vim? What are advantages/disadvantages of each approach?

text: I'm used to _modeless_ editors. Only the past year I've been using vim/gvim, which has a _modal_ approach. I'm used to tabs in all editors, since before vim all of them are used to it. In gvim, you don't necessarily need to use tabs: you can just use buffers. My question is: what are the advantages/disadvantages between these two approaches (buffers vs tabs)? Why do these both options exist?


title: How can I solve wifi connection problems between Arch Linux and a WPA2 network?

text: My home network uses WPA2 for encryption. To connect to it from my Arch Linux insallation, I first tried using NetworkManager, however, that only managed to connect for a minute at most before dropping the connection. I replaced it with wicd, which worked satisfactorily until somewhat recently. Since then, if it fails to establish the connection at startup, or if it loses connection, it will be unable to establish a connection. Attempting to reconnect with the GUI slows the system down so much that I have to switch from X to a tty and kill the process. The curses interface is unable to establish a connection in these circumstances, but doesn't impair system performance. Restarting the daemon is not enough to fix it from the bugged state. I need to power the system off and on again. The windows installation on the same laptop does suffer some intermittent connectivity problems (it's a crappy ISP router powering the network), but recovers from them, only requiring reconnecting to the network. Prior to using Arch Linux, I used to use Ubuntu as the Linux distro on the laptop, and that had the same results as Windows. What could be causing this problem (which I suspect may be related to the earlier NetworkManager problem), and how can I resolve it? For what it's worth, my wireless network card is a broadcom BCM4312, and it is using the b43 drivers. **EDIT** : Attempting to run wpa_supplicant while wicd is unable to connect produces this output: > ioctl[SIOCSIWSCAN]: Device or resource busy   >  Failed to initiate AP scan.   >  ioctl[SIOCSIWSCAN]: Device or resource busy   >  Failed to initiate AP scan.   >  No network configuration found for the current AP   >  CTRL-EVENT-DISCONNECTED bssid=00:00:00:00:00:00 reason=0   >  ioctl[SIOCSIWSCAN]: Device or resource busy   >  Failed to initiate AP scan. **Further edit** : The problem is significantly more likely to occur when the system is running on battery power, but can still occur while it is plugged in. **EDIT 3** : This is almost certainly related to power saving options. Paying more attention, this always occurs when either the system is running on battery power, when it has been left alone for a significant period of time, or when the lid is closed.


title: What is the purpose of patches of the linux kernel?

text: For each Linux kernel version, there is a patch file available for download. For instance, _linux-3.12.22_ has a corresponding _patch-3.12.22_. What is the purpose of that patch? To always patch the corresponding kernel before compiling it, or to bring a former kernel version up-to-date with the kernel that the patch matches (3.12.22, in this case)?


title: Multiple X sessions with VNC

text: I have two separate X Sessions.   * One is unity Ubuntu Desktop   * The Second one is XBMC. I use the built-in remote desktop sharing `vino` of ubuntu for VNC. When the Ubuntu Desktop is up on the server screen, the VNC works perfectly. But when the second XBMC is up on the server screen `CTRL`+`ALT`+`F8`, the VNC shows a Blank screen and not the ubuntu desktop. what is the problem?


title: Why is there no graphical.target listed by "systemctl list-units --type=target"?

text: According to Fedora documentation, graphical.target is the default. And,               # systemctl list-units --type=target      will list all available targets. However, the command above outputs as follows without graphical.target:               [root@host ~]# systemctl list-units --type=target     UNIT                LOAD   ACTIVE SUB    DESCRIPTION     basic.target        loaded active active Basic System     cryptsetup.target   loaded active active Encrypted Volumes     getty.target        loaded active active Login Prompts     UNIT                LOAD   ACTIVE SUB    DESCRIPTION     basic.target        loaded active active Basic System     cryptsetup.target   loaded active active Encrypted Volumes     getty.target        loaded active active Login Prompts     UNIT                LOAD   ACTIVE SUB    DESCRIPTION     basic.target        loaded active active Basic System     cryptsetup.target   loaded active active Encrypted Volumes     getty.target        loaded active active Login Prompts     local-fs-pre.target loaded active active Local File Systems (Pre)     local-fs.target     loaded active active Local File Systems     multi-user.target   loaded active active Multi-User System     network.target      loaded active active Network     nfs.target          loaded active active Network File System Server     paths.target        loaded active active Paths     remote-fs.target    loaded active active Remote File Systems     slices.target       loaded active active Slices     sockets.target      loaded active active Sockets     swap.target         loaded active active Swap     sysinit.target      loaded active active System Initialization     timers.target       loaded active active Timers          LOAD   = Reflects whether the unit definition was properly loaded.     ACTIVE = The high-level unit activation state, i.e. generalization of SUB.      My Linux distro is Fedora 20 KDE spin. I run the command under an X terminal, that is to say, I am already in a graphical environment.


title: Is it possible to support multiple processes without support for Virtual memory?

text: Is it possible to support multiple processes without support for virtual memory? I would like to know more about it if so.


I know that Linux OS's are typically multi-programmed, which means that multiple processes can be active at the same time. Can there be multiple kernels executing at the same time?


title: block specific user to send mail

text: I am using `sendmail` in RHEL 5. I have three mail accounts for the users jack, bob and alice. I want to make sure that user bob can send mail to alice but jack can't send mail to alice. But user jack can send mail to bob. How can i do this?


title: How to add an item to the Applications menu?

text: How can I add an application to _Applications > Internet_ in Gnome Desktop running on CentOS 6.4? Per this old Docs link, it suggests to edit `/etc/xdg/menus/applications.menu`. How can I add `/home/danny/some/path/myprog/prog` (executable) to my Gnome Applications menu?