title: cd .. on root folder

text: Why `cd ..`, typed at root folder, does not warn or fails with an error? I would expect:               /$ cd ..     -bash: cd: ..: No such file or directory      Instead, I'm left at `/`. Of course, this is since `..` does exist in `/`, and is simply `/`, just like `.`. I just wonder why it is like that.


title: Ubuntu x86 10.10 terminal

text: I just downloaded a Ubuntu v10.10 vmware image for Windows. I'm trying to install a web application that can only run on Linux MySQL, Apache and PHP. How do I open a terminal in Ubuntu?


title: iscsi target to a folder of a mounted parition?

text: i'm thinking about installing and setting up iscsitarget on my Debian squeeze box. so far, the examples i saw on various Google searches and the debian wiki: http://wiki.debian.org/SAN/iSCSI/iscsitarget set the path to unmounted devices like `/dev/sda1` or `/dev/sda`. is it possible to set the path to a folder on a mounted filesystem instead? like: `/home/iscsi_target`


title: Scientific Linux 6 assigning keyboard shortcuts

text: Can I assign keyboard shortcuts for launching Konsole terminal emulator on Scientific Linux 6 without administrator privileges? If so can you guide me how, I appreciate your help.


title: Append huge files to each other without copying them

text: There are 5 huge files ( file1, file2, .. file5) about 10G each and extremely low free space left on the disk and I need to concatenate all this files into one. There is no need to keep original files, only the final one. Usual concatenation is going with `cat` in sequence for files `file2` .. `file5`:               cat file2 >> file1 ; rm file2      Unfortunately this way requires a at least 10G free space I don't have. Is there a way to concatenate files without actual copying it but tell filesystem somehow that file1 doesn't end at original file1 end and continues at file2 start? ps. filesystem is ext4 if that matters.


title: ssh user@IP sh <command> missed environment variables

text: I use an approach > ssh user@IP sh [runme.sh] to execute script remotely, this works fine. But I got one problem, that is in runme.sh, I can't get any envirnoment variables which are defined in ~/.bashrc. If I launch the script locally, everything goes fine, but how can I get those environment configurations with ssh command? One workable approach is to add one line > . ~/.bashrc in every runme.sh in the very beginning, but in this way, I need to modify a lot of "runme.sh" files on clients. Is there a better idea ?


title: Queries about top command

text: top command shows the process cpu utilization, and it when we sum the cpu utilization of all the processes then it goes greater than 100%. And how can it shows the cpu utilization of each process( app. > 300 process) in very short span of time. There is a question about cpu usage by a process that tells us to sleep for 1 second. And according to that solution Cpu usage by a process is different from top command output. so please tell me about right solution. My computer has the configuration Intel core2duo and ubuntu 10.10.


title: u-boot disable DHCP requests with setenv

text: I am trying to disable the DHCP requests after the Kernel was loaded. Using _`freescale imx25 dev-board`_ in standard config. In `u-boot`, I find two lines `ip=dhcp`:               MX25 U-Boot > pri     bootdelay=3     baudrate=115200     loadaddr=0x80800000     netdev=eth0     ethprime=smc911x-0     uboot=u-boot.bin     uboot_addr=0xa0000000     kernel=uImage     bootargs_base=setenv bootargs console=ttymxc0,115200     bootargs_nfs=setenv bootargs $(bootargs) root=/dev/nfs ip=dhcp nfsroot=$(serverip):$(nfsrootfs),v3,tcp     bootcmd_net=run bootargs_base bootargs_nfs; tftpboot ${loadaddr} ${kernel}; bootm     load_uboot=tftpboot ${loadaddr} ${uboot}     ethact=smc911x-0     bootargs_nand=setenv bootargs ${bootargs} root=/dev/mtdblock2 ip=dhcp rootfstype=jffs2     bootcmd_nand=run bootargs_base bootargs_nand; nand read ${loadaddr} 0x100000 0x1d2000;bootm     bootcmd=run bootcmd_nand     serverip=192.168.0.5     ipaddr=192.168.0.100     stdin=serial     stdout=serial     stderr=serial      If I do:               set bootargs_nand=setenv bootargs ${bootargs} root=/dev/mtdblock2 ip=192.168.0.100 rootfstype=jffs2      It does not work and my boot environment seems to be completely damaged. How can I assign a fixed IP address without changing other parameters?


title: Delayed write scenario

text: I was reading the design of unix OS by Maurice J bach and had a confusion. Suppose a process requests for a buffer for disk block number 18. The kernel searches for a free buffer from the free list. Let the first buffer (say buffer for block number 5) in the free list be marked as delayed write. (hash function for hash queue=disk-block-number % 4) What will the kernel do from here onwards? From my understanding, the kernel will start writing the buffer with block number 5 to the disk, allocate the next buffer in the free list to the current process and reassign it to the correct hash queue. The free list header will be adjusted to point to the next buffer in the free list after the one which is recently allocated. (assuming the free list follows the least recently used algorithm) Is this correct?


title: slow media - disk cache tuning?

text: Is there any way to make the system more consistent when using LUKS? (or slow storage in general) as it is everything is snappy until the write buffer is full, then everything grinds to a halt as the kernel blocks writes. Same issue on my laptop with the slow SSD - its fine, then I have to wait for 30 seconds while it flushes, meanwhile I can do nearly nothing. I'm hoping to tune the disk cache system? Alternatively, if I can get things to not completely cease while blocked, instead only blocking the write that's actually being blocked?


title: How can I set up SSH on Linux to log in password-less?

text: My Raspberry Pi is running the default Debian image and has SSH enabled. I log into my Pi as follows:               ssh pi@<IP-address-of-my-Pi>      I have to enter my password every time. Can I somehow make my Pi accept log ins from my local machine? I am running Fedora Linux.


title: Taking a screenshot (within X)

text: How can I take a screenshot in X.org? I am unsure if the Print Screen button will "just work" and I don't know how I would go about testing it.


title: affordable cloud space for a duplicity backup?

text: I'm searching for around 1TB of cloud space for backup using the Unix/Linux duplicity backup tool? Are there any recommendations?


title: How to constrain the resources an application can use on a linux web server

text: This is the situation: I have a PHP/MySQL web application that does some PDF processing and thumbnail creation. This is done by using some 3rd party command line software on the server. Both kinds of processing consume a lot of resources, to the point of choking the server. I would like to limit the amount of resources these applications can use in order to enable the server to keep serving users without too much delay, because now when some heavy PDF is processed my users don't get any response. Is it possible to constrain the amount of RAM and CPU an application can use (all processes combined)? Or is there another way to deal with these kinds of situations? How is this usually done?


title: Delete all folders containing files which match pattern

text: I'm trying to delete all subdirectories of my current working directory which contain a rar file. My first attempt: `find -name *.rar -exec rm -r {}/.. ';'` failed because that is not a valid directory. I tried using `dirname {}` for a more sensible command, but decided to just ask for help after almost deleting stuff I didn't mean to. I'm using Cygwin on Windows 7, in case that's relevant.


title: grep lines starting with "1" in Ubuntu

text: I try to search for lines that start with "1" using               ls -1 | grep ^1*      but it returns lines that do not start with 1. What I am missing here?


title: MySQL server-id not being set with Fedora 16

text: I am setting up a mysql slave on a Fedora 16 system, and the `server_id` is not being set properly. My `/etc/my.cnf` is:               [mysqld]     server-id=16     datadir=/var/lib/mysql     socket=/var/lib/mysql/mysql.sock     read-only = 1     symbolic-links=0     max_allowed_packet = 100000000          [mysqld_safe]     log-error=/var/log/mysqld.log     pid-file=/var/run/mysqld/mysqld.pid      However, after `systemctl restart mysqld.service`, `show variables like "server_id"` indicates that `server_id` is `0`, which causes replication to fail. `/var/log/mysqld.log` was last modified when I last restarted the server, but there are no log entries from then (I did the restart today, and the last entry is from yesterday). Why doesn't `server-id=16` work? Does it need to be set in some other file? Alternatively, is there a way to edit the `systemd` unit file such that `mysqld` starts with the `\--server-id=` command line option, or get `mysqld` to run an SQL statement to set the `server_id` on startup?


title: Passwordless sudo of a command containing a comma

text: I have a number of users of a desktop machine, who each have a folder on a remote samba server. I am trying to set up per-user mounting of these network folders following the instructions here: http://askubuntu.com/questions/67405/auto-mounting-network-shares-per-user That article recommends adding the following line to sudoers:               user ALL= NOPASSWD: /bin/mount -t cifs -o cred=/home/user/.Music.cred //server/music /home/user/MyMusicFolder      That command works fine, but I need to mount the shares so that they are owned by a specific group. I have tried changing the line to read like this:               user ALL= NOPASSWD: /bin/mount -t cifs -o cred=/home/user/.Music.cred,gid=xxx //server/music /home/user/MyMusicFolder      But with the addition of the ,gid=xxx the sudoers file no longer parses correctly. I assume this is because the NOPASSWD command actually takes a comma separated list of arguments so I need to escape the comma in the command. I can do this using a backslash, like so:               user ALL= NOPASSWD: /bin/mount -t cifs -o cred=/home/user/.Music.cred\,gid=xxx //server/music /home/user/MyMusicFolder      Now the sudoers file will parse, and I can run the mount command with sudo without being asked for a password. Unfortunately I now get this error:               Sorry, user is not allowed to execute '/bin/ls /home/' as root on ubuntu.      when I try to run any other command. I don't get this error if I remove the `\,gid=xxx` from the line. So what is the right way to escape commas in the sudoers file?


title: "trap ... INT TERM EXIT" really necessary?

text: Many examples for `trap` use `trap ... INT TERM EXIT` for cleanup tasks. But is it really necessary to list all the three sigspecs? The manual says: > If a SIGNAL_SPEC is EXIT (0) ARG is executed on exit from the shell. which I believe applies whether the script finished normally or it finished because it received `SIGINT` or `SIGTERM`. An experiment also confirms my belief:               $ cat ./trap-exit     #!/bin/bash     trap 'echo TRAP' EXIT     sleep 3     $ ./trap-exit & sleep 1; kill -INT %1     [1] 759     TRAP     [1]+  Interrupt               ./trap-exit     $ ./trap-exit & sleep 1; kill -TERM %1     [1] 773     TRAP     [1]+  Terminated              ./trap-exit      Then why do so many examples list all of `INT TERM EXIT`? Or did I miss something and is there any case where a sole `EXIT` would miss?


title: Getting linux webcam state via command line or API

text: I would, preferably, like to know of a command I can run that will let me know whether a webcam is on/off or recording/not recording, etc. Maybe a way to see if any programs are currently accessing it would work as well. If there is no command line option, I'm not opposed to writing a small c or c++ program to do this, but I haven't been able to find a way to do that either.


title: How to make bidirectional pipe between two programs?

text: Everyone knows how to make unidirectional pipe between two programs (bind `stdout` of first one and `stdin` of second one): `first | second`. But how to make bidirectional pipe, i.e. cross-bind `stdin` and `stdout` of two programs? Is there easy way to do it in a shell?


title: GNU Radio prerequisite libraries on armhf

text: After several attempts, I have managed to compile GNURadio on the Raspberry Pi. However, I am just not able to meet the prerequisites for the gnuradio build script on the Pandaboard (Linaro 12.04) or the BeagleBoard (Ubuntu 12.04) This is what I see -               Failed to find package 'libqwtplot3d-qt4-dev' in known package repositories     Perhaps you need to add the Ubuntu universe or multiverse PPA?     see https://help.ubuntu.com/community/Repositories/Ubuntu     exiting build      I have tried adding all kinds of repositories to get this to work. What repository do I get `libqwtplot3d-qt4-dev` from for the armhf architecture? Can I mix armfh and armel packages?


title: Map workspace switch to mouse buttons in cinnamon

text: I want to set up cinnamon to switch workspaces right and left when I press my mouse scroll wheel clicker right or left, but I don't see an option in the cinnamon settings. Is there any way to accomplish this?


title: enable apache mod rewrites to load clean-urls

text: In CentOS, `a2enmod rewrite` results in “command not found” but `httpd -M` lists rewrite module as listed and shared. I'm trying to enable it so can then have these rewrite rule apply so I can switch back to "clean-urls" on my cms. As it stands my site will only load pages that are `/?=page` instead of `/page`. My changes are in `/etc/httpd/conf/httpd.conf`. changed NONE to ALL:               <Directory />     Options FollowSymLinks     AllowOverride ALL     </Directory>      Then added the following after               #     # This should be changed to whatever you set DocumentRoot to.     #     <Directory "/var/www/html/mycms">     <IfModule rewrite_module>     RewriteEngine on     RewriteBase /mycms     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]     </IfModule>     </Directory>      After restart I get :               Starting httpd: httpd: Syntax error on line 354 of /etc/httpd/conf/httpd.conf: </Directory> without matching <Directory> section                                                            [FAILED]      ![edits to settings.php](http://i.stack.imgur.com/WnLci.jpg) ![edits to .htaccess](http://i.stack.imgur.com/XoYok.jpg) ![edits to httpd.conf](http://i.stack.imgur.com/I2nhE.jpg) ![edits to mynamed.conf](http://i.stack.imgur.com/x6JC8.jpg)


title: variable assignment and IFS

text: Per Greg's Wiki the `IFS` variable is used:   * In the `read` command, if multiple variable-name arguments are specified, `IFS` is used to split the line of input so that each variable gets a single field of the input.   * When performing WordSplitting on an unquoted expansion, `IFS` is used to split the value of the expansion into multiple words.    * When performing the `"$*"` or `"${array[*]}"` expansion,the first character of `IFS` is placed between the elements in order to construct the final output string.    * When doing `"${!prefix*}"`, the first character of `IFS` is placed between the variable names to make the output string.   * `IFS` is used by `complete -W` under programmable completion So my question is, why should `IFS` have to come into play in variable assignment? Per the below, bash is applying word-splitting on the string on the right(`a:b:c:d`).               $ IFS=: s=a:b:c:d     $ echo $s     a b c d


title: Realtek audio issues on OpenBSD 5.2

text: I am running OpenBSD/amd64 5.2 stable on a new machine, using a gigabyte motherboard with a realtek alc898 audio chipset. When I try to play any audio (sources include `mpd`, `aucat`, and `cat > /dev/audio`), I always end up with the system playing a grinding sound, not quite the same as white noise. I have been able to get the system to play audio under other operating systems, so the hardware is not at fault. Following the FAQ, `audioctl` and `mixerctl` are not muted and are at reasonable volumes. Following the debugging instructions gave the following:               $ cat > /dev/audio < /dev/zero &     [1] 19598     $ audioctl play.{seek,samples,errors}     play.seek=48000     play.samples=3350400     play.errors=0     $ audioctl play.{seek,samples,errors}      play.seek=48000     play.samples=3696000     play.errors=0     $ audioctl play.{seek,samples,errors}      play.seek=48000     play.samples=3984000     play.errors=0     $ kill %1     $ fg %1        cat > /dev/audio < /dev/zero      Terminated      This produces the same grinding noise, even though the FAQ states that this should not produces any noise. `cat /dev/urandom > /dev/audio` produces the same result. Looking for relevant information in `dmesg`, I found the following:               $ dmesg | grep -i audio     azalia0 at pci0 dev 27 function 0 "Intel 7 Series HD Audio" rev 0x04: msi     audio0 at azalia0     azalia0 at pci0 dev 27 function 0 "Intel 7 Series HD Audio" rev 0x04: msi     audio0 at azalia0     $ dmesg | grep -i realtek     azalia0: codecs: Realtek/0x0899, Intel/0x2806, using Realtek/0x0899     azalia0: codecs: Realtek/0x0899, Intel/0x2806, using Realtek/0x0899      Is it possible to change the codec to `Intel/0x2806`? Otherwise is there anything else I can try to resolve the issue? Any suggestions would be appreciated. It seems that there have been issues for this chipset on linux, but the solution of an upgraded driver from realtek is not helpful to me.


title: Grep 'OR' regex problem

text: I am trying to use grep with a regex to find lines in a file that match 1 of 2 possible strings. Here is my grep:               $ grep "^ID.*(ETS|FBS)" my_file.txt      The above grep returns no results. However if I execute either:               $ grep "^ID.*ETS" my_file.txt        or               $ grep "^ID.*FBS" my_file.txt        I do match specific lines. Why is my OR regex not matching? Thanks in advance for the help!


title: how to get a variable's definition file

text: I'm trying to find the original definition declaration of a variable. What linux commands or actions will output environment variable's source definition file and all files that have changed that variable? Is there a way to trace the bin bash command echo down to it's source in BASH? How does echo work in bash? Where is echo getting the value for a variable?


title: Move video files to directory by width

text: I'm trying to move video files to directory by width of that video file. For example I have               ./xxx/pr0n.mkv     ./pokemon.mkv      After running script               ./xxx/1920/pr0n.mkv     ./1920/pokemon.mkv      If I run script again another width directory is not created.   * Match common video extensions   * Do **not** match if file's parent directory is only digits (because that's the width) I've come up with this so far but it doesn't work:               find . -type f \( -iname "*.mkv" -o -iname "*.avi" -o -iname "*.mov" -o -iname "*.mpg" -o -iname "*.mpeg" -o -iname "*.wmv" -o -iname "*.mp4" \) -a -regex '.*\/[^0-9]+\/\.*$' -exec bash -c 'echo "Processing {} .."; WIDTH=$(mediainfo "--Inform=Video;%Width%" "{}") && DIR=$(dirname "{}") && mkdir -p "$DIR/$WIDTH" && mv "{}" "$DIR/$WIDTH"' \;


title: zsh autocompletion for symlinks

text: Say I have a folder `parent` with a subfolder, `subfolder` and a symbolic link `symbolic_link`. I noticed that if my current working directory `subfolder` and I try to do `cd ../sym[TAB]`, it will not autocomplete to `cd ../symbolic_link`. How can I enable this type of autocompletion in Zsh?


title: Dynamic search and replace in Ksh

text: Machines at work follow a constant naming pattern: **host[domain]_[id]** where [domain] is either "d" for dev machines and "p" for production machines, and [id] is a 2-digit string that is different for each machine. For example: 'hostp_a1' or 'hostd_g5'. Now due to new company policies, we have separated the two domains and we have to append a suffix ".dev" for dev machines and ".prd" for production ones. My previous machines are now called 'hostp_a1.prd' and 'hostd_g5.dev' I don't want to change my old habits, so I am wondering if there's a way for Ksh to do this for me dynamically. Here's a sed script that would do it for me:               sed -e 's/host\([dp]\)_\(..\)/host\1_\2.\1/' -e 's/p$/prd/' -e 's/d$/dev/'      Here are some solutions I thought of:   * Regex alias:  If I could do something like `alias host[dp]_..='....`.   * Triggers: The trigger would execute the sed each time a command is entered. Might hurt performance a bit, but I don't care since it's only interactive. Is there any way Ksh could do that? It probably doesn't help that I'm using an old version `Version M-11/16/88i`. Can maybe other shells do this? (as long as we're at it, I'm currently learning `sed` so if anyone has a better sed command to suggest, please do. Thanks).


title: Why does curl fail while using this export?

text: I'm doing some stuff with Facebooks FQL at the moment, and I'm using `curl` on the command line to test some of the responses of it. I'm also using `export` to keep the params seperated for easy editing. But I'm doing something wrong, and I can't see what. This produces a perfectly fine result (even with the export):               export FB_TOKEN="the_access_token"     curl -F access_token=$FB_TOKEN -F query="SELECT first_name FROM user WHERE uid=12345678910123" https://api.facebook.com/method/fql.query      But this does mess up:               export FB_TOKEN="the_access_token"     export FB_QUERY="SELECT first_name FROM user WHERE uid=12345678910123"     curl -F access_token=$FB_TOKEN -F query=$FB_QUERY https://api.facebook.com/method/fql.query      and produces the following output:               curl: (6) Couldn't resolve host 'first_name'     curl: (6) Couldn't resolve host 'FROM'     curl: (6) Couldn't resolve host 'user'     curl: (6) Couldn't resolve host 'WHERE'     curl: (6) Couldn't resolve host 'uid=100001273321556'     <?xml version="1.0" encoding="UTF-8"?>     (...further response that the request was invalid here...)      I don't see anything I forgot to escape. Why does `curl` insist on interpreting these as hosts? _Used software versions:   curl 7.21.3; bash 4.2.8(1)_


title: What is the "Online Certificate Status Protocol"?

text: I use privoxy. In the user.action file i have a redirect rule and a few websites:               { +redirect{s@http://@https://@} }     .twitter.com     .facebook.com      Ok! it's working great, e.g.: if i visit any "*twitter.com" URL it gets redirected to HTTPS! But: with wireshark i can see some OCSP (Online Certificate Status Protocol) packets. Question: What are these packets? Why aren't there in HTTPS? Is my redirection method with privoxy is secure? Thank you for any tips/opinions!


title: Modifying a squashfs,

text: Obviously I don't want to actually modify a squashfs. What I would like to do though is take an existing squashfs, a set of files and create a new squashfs which is identical to the old one except that the files in the set either replace similar files in the squasfs or are just added if there is no similar files. Ok that last part sounded wierd. So let me give an example: there is a squashfs called mfs.squash. Inside it there is a file ./a/foo. I want to crewate a new squashfs which is identical to the old squashfs -- except that there is a new file a/b and I overwrite the ./a/foo with one of my specification.


title: Not able to ssh in to remote machine using shell script in Crontab

text: Below is the script which i am trying to run, which runs without any issue               for i in `seq 200 2100`     do       usr=(`ssh -t -t -o ConnectTimeout=60 machine$1 finger | tail -1 | awk '{print$1}'`)        echo $usr     done      But once I add it to crontab, it doesn't give me the user.               22  12  *  *  *  sh /home/subrahmanyam/Scripts/who.sh      Please give your thoughts..... may be cron demon is running, so we need to include some binaries...?


title: where to put some script to run before VM Suspend?

text: I have run one shell script before the vm suspend. How to do this? Where to put this shell script so that it will run before the VM suspend .


title: Display tasks in GNOME Shell Calendar

text: Is it possible to make my Evolution tasks show up in the GNOME Shell Calendar? When I pull down the calendar by clicking on the clock at the top of the screen (I'm using Fedora 20), it shows me the items I have entered into the calendar in Evolution. But it doesn't show me the tasks I have in Evolution. For example, I have a task scheduled as due on 7 March. But when I click on 7 March in the GNOME Shell Calendar, it shows up with nothing scheduled. Is it possible to have the tasks displayed as well?


title: mke2fs difference between -i and -I options

text: sudo mke2fs     Usage: mke2fs [-c|-l filename] [-b block-size] [-C cluster-size]         [-i bytes-per-inode] [-I inode-size] [-J journal-options]         [-G flex-group-size] [-N number-of-inodes]         [-m reserved-blocks-percentage] [-o creator-os]         [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory]         [-O feature[,...]] [-r fs-revision] [-E extended-option[,...]]         [-t fs-type] [-T usage-type ] [-U UUID] [-jnqvDFKSV] device [blocks-count]      `[-i bytes-per-inode] [-I inode-size]` what are the differences between these 2? To me, "bytes per inode" and "inode size", do not see difference at all


title: mount --bind other user as myself

text: I'm using fstab to bind a folder that belongs to another user in one of my own directories. I know that I can map users when I mount an SSHFS, I've been doing some research and I can't find a `mount --bind` equivalent. Is there any way I can mount another user's folder and files as my own? Update: It doesn't necessarily _have_ to be `mount --bind`. It just has to do something similar while mapping users, and can be done on startup.


title: How do I share a mounted sftp drive?

text: My friend has a public server that he's given me read access to with SFTP. I've successully mounted it in Mint 17 with the command               sshfs user-name@file-server:/location/I/want /mount/point/I/want -o port=portNumber      Now I'd like to share the folder with the people I live with, but I don't want them to set anything up themselves. Instead, I want them to see a network share that contains the SFTP share. I've set up a shared folder using Nautilus, and I set my mount point inside of it. It works fine from my local machine and my own user. However, when my friends point their Windows machines at my shared folder it appears empty. How do I make the mount visible to them?


title: How to test Disk IO on VMs with iozone?

text: I want to test the disk IO performance like read, write, random read, random write and so on both in physical machine and VMs (with aufs file system). Also I want to test the throughput performance in a single bare machine and VMs running on the hypervisor to get how much performance loss in Virtual machine (KVM). I used this command before, but it wasn't enough,and it just tested 1 process! (you can see the output here)               $ iozone -Mce -I -+r -r 256k -s 2g -f iozone_$i.dat$$ -i0 -i1 -i2      What command should I use?


title: Saving individual output lines into variables

text: I'm using `find -mtime -2` to find files modified in the past 24 hours or less. The output looks like this.               /home/user/logs/file-2014-08-22.log     /home/user/logs/file-2014-08-23.log      I need to save the first line of the output to a variable and then save the second line to a separate variable. I can't just pipe it. I know you might suggest `| grep 22` or `23` but this is part of a bash script that will run many times, there will be a different set of files with different names next time so `grep` would be too specific. Could `awk` accomplish this? If so, how? .


title: How to disable menu under ALT+1 binding in Linux-Mint

text: I want to disable the menu in Linux-Mint which is showing when you press `ALT`+`1`. I can't even capture the screen when the menu is showing so I've attached a photo. I tried everything and I didn't find the answer how to disable it. Any sugestions? ![enter image description here](http://i.stack.imgur.com/puHDX.jpg) EDIT: The solution posted below by @tohuwawohu works perfect on Linux Mint 15 and 16, but doesn't work on my computer with Mint 13 (Maya). I'm still looking for a way to disable the menu.


title: How do I use sftp to get a directory and all its contents?

text: When I try to use the command `get` from sftp, I get the error saying that it is not a normal file. Is there a way around this?


title: How to speed up X over fast connection ? (especially over ssh)

text: What are recommendations on speeding up X applications over local **fast** (gigabit) connections? (similar question for slow connections) Currently I'm running over `ssh -Y`, which is fine, but I wonder if turning off compression could speed it up. If so, how do I turn off compression, encryption, and setup whatever you recommend:   * without changing default sshd behaviour when modifying the configuration on the server side   * preferably using command line options on client side


title: Unable to capture trace with -w option

text: I am not able to capture trace with the -w option on my fedora machine. Please see the log below :               [root@localhost home]# tcpdump -w /home/trace.cap -i eth2 -s 0     tcpdump: listening on eth2, link-type EN10MB (Ethernet), capture size 65535 bytes     58 packets captured     58 packets received by filter     0 packets dropped by kernel     [root@localhost home]# ls -lrt | grep trace     -rwxrwxrwx 1 root   root      0 2014-08-25 17:23 trace.cap     [root@localhost home]#       The size of the trace file created is 0 bytes, and when I open the file with wireshark, it doesnt contain anything. The fedora machine I am is :               [root@localhost home]# uname -r     2.6.23.1-42.fc8     [root@localhost home]#      What am i doing wrong here?


title: rexecd daemon for Ubuntu

text: How to start rexecd daemon/server on ubuntu-11.10 ? If I try to run the command `/usr/sbin/in.rexecd` then an error appears as `rexecd: getpeername: Socket operation on non-socket` rexecd is remote execution server


title: Why is FreeBSD deprecating GCC in favor of Clang/LLVM?

text: So I was surfing the net and stumbled upon this article. It basically states that FreeBSD, starting from Version 10 and above will deprecate GCC in favor of Clang/LLVM. From what I have seen around the net so far, Clang/LLVM is a fairly ambitious project, but in terms of reliability it can not match GCC. **My question is:** _Are there any **technical** reasons FreeBSD are choosing LLVM as their compiler infrastructure, or does the whole matter boil down to the eternal GNU/GPL vs. BSD licenses?_ **[EDIT]:** This question has (somehow) relevant information about the usage of GCC in FreeBSD


title: Append same text to many files using cat or echo?

text: How can I write the same content to many text files by using `cat` or `echo` in only one command? For example I want to write "hello" to file1 and file2. I tried:               echo "hello" >> file1 file2      but it didn't work. How can I do it?


title: Does it matter what state I set if both locations are in the same timezone

text: Is there any difference if I set the timezone to   * timezone: "America/New_York" verses   * timezone: "America/Detroit" Both States are in the same timezone but other than identifying exactly where you are in the timezone, what functionality does it offer? UPDATE and FYI: geonames.org does off the Timezone Id lookup which returns America/Detroit instead of America/New_York


title: replace all dots in filenames with underscore

text: I have a directory with some subdirectories with filenames and directorynames that contain some dots:               $ ls -R     .:     dir  file.with.dots          ./dir:     subdir.with.dots          ./dir/subdir.with.dots:     other.file      I really struggle to catch all these files with `find` because I don't want to rename the current folder `.` and `..` itself. I also read how to Replace dots with underscores in filenames, leaving extension intact, but that doesn't really fit here, because the main problem is the recursive selection of the files. I tried to replace the dots with `find` and `tr`:               find $(pwd) -depth -name '*.*'|while read f; do mv -iv "$f" '"'$(echo $f|tr '.' '_')'"' ; done      but this would give errors if in both, the path to the file and the file itself, contains dots How do I rename and replace all occurrences of a dot with an underscore?


title: Bind DNS rate-limit and values for responses-per-second and window

text: In my DNS server's named.conf I see                   rate-limit {                 responses-per-second 5;                 window 5;         };      What does this actually mean? And can it cause DNS clients problems? Is this too tight a configuration?


title: Remove files from tar archive

text: I have a large file `foo.tar.xz` that contains a lot (say 200000) of files. I figured out that this archive contains some (around 5000) files I don't want. I don't have sufficient disk space to decompress the whole thing onto my disk; additionally, I fear attributes / rights might get lost if I do so. I have enough space to host two copies of the _compressed_ archive though. Is there a tool to remove some of the files from the archive (specified with a regex on the filename) on-the-fly, i.e. without unpacking the archive into individual files?


title: Logger command - how to store logs in given file?

text: Please explain what below command does.               logger_cmd="logger -p local0.info ${program-name}[$$]:"          $logger_cmd "There is some files missing in ${dest-dir}"      How can I write any message in log file? I wrote below a command, but it didn't show any message in llog.txt. Help me.                logger -s "any message" -t "WARNING" -f ~/llog.txt


title: Arch Linux how to close tty

text: I've opened several ttys and I don't know what key combination to use to close a tty. I'm using Arch Linux.


title: Change screen resolution on Linux Mint

text: I have just installed Linux Mint 14 and I cannot change the screen resolution. The appropriate resolution 1920 x 1200, just isn't among the options. I have tried this solution but it reports:               xrandr: cannot find output "VGA1"      I have also tried this, but it reports:               Fatal server error:     Server is already active for display 0         If this server is no longer running, remove /tmp/.X0-lock         and start again.     (EE)      Please consult the The X.Org Foundation support           at http://wiki.x.org      for help.       **Edit1** My graphics card information:               Graphics:  Card: NVIDIA GF108 [GeForce GT 440] bus-ID: 01:00.0 X.Org: 1.13.0 driver: nvidia Resolution: 640x480@59.9hz                 GLX Renderer: GeForce GT 440/PCIe/SSE2 GLX Version: 4.3.0 NVIDIA 313.26 Direct Rendering: Yes      Running `sudo lshw -class` outputs:               *-display                           description: VGA compatible controller            product: GF108 [GeForce GT 440]            vendor: NVIDIA Corporation            physical id: 0            bus info: pci@0000:01:00.0            version: a1            width: 64 bits            clock: 33MHz            capabilities: pm msi pciexpress vga_controller bus_master cap_list rom            configuration: driver=nvidia latency=0            resources: irq:16 memory:fa000000-faffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:e000(size=128) memory:fb000000-fb07ffff       *-display            description: Display controller            product: 2nd Generation Core Processor Family Integrated Graphics Controller            vendor: Intel Corporation            physical id: 2            bus info: pci@0000:00:02.0            version: 09            width: 64 bits            clock: 33MHz            capabilities: msi pm bus_master cap_list            configuration: driver=i915 latency=0            resources: irq:57 memory:fb400000-fb7fffff memory:b0000000-bfffffff ioport:f000(size=64)      **Edit2** Running xrandr command in terminal outputs:               Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192     DVI-I-1 disconnected (normal left inverted right x axis y axis)     HDMI-3 disconnected (normal left inverted right x axis y axis)     VGA-2 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm        1024x768       60.0*         800x600        60.3     56.2          848x480        60.0          640x480        59.9        This is without nvidia driver installed. **Edit3** After executing command `xrandr --newmode "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync` it reports:               X Error of failed request:  BadName (named color or font does not exist)       Major opcode of failed request:  140 (RANDR)       Minor opcode of failed request:  16 (RRCreateMode)       Serial number of failed request:  29       Current serial number in output stream:  29      **Edit4** When I try solution from here running `sudo Xorg -configure`, I get:               Fatal server error:     Server is already active for display 0         If this server is no longer running, remove /tmp/.X0-lock         and start again.          (EE)      Please consult the The X.Org Foundation support           at http://wiki.x.org      for help.      (EE)       Can you please guide me on how to proceed? Also please see the comments in Dave's answer below.


title: How to reduce Volume Group size in LVM?

text: [root@localhost ~] vgdisplay       --- Volume group ---       VG Name               vg_root       System ID                    Format                lvm2       Metadata Areas        1       Metadata Sequence No  7       VG Access             read/write       VG Status             resizable       MAX LV                0       Cur LV                3       Open LV               0       Max PV                0       Cur PV                1       Act PV                1       VG Size               297,59 GiB       PE Size               4,00 MiB       Total PE              76182       Alloc PE / Size       59392 / 232,00 GiB       Free  PE / Size       16790 / 65,59 GiB       VG UUID               XXXXXXXXXX      PV:               [root@localhost ~] pvdisplay            --- Physical volume ---       PV Name               /dev/mapper/udisks-luks-uuid-ASDFASDF       VG Name               vg_root       PV Size               297,59 GiB / not usable 2,00 MiB       Allocatable           yes        PE Size               4,00 MiB       Total PE              76182       Free PE               16790       Allocated PE          59392       PV UUID               YYYYYYYYYYY      So I have a VG with 65 GByte free space. But when I want to shrink this Volume Group about ~50 GByte:               pvresize -tv --setphysicalvolumesize 247G /dev/mapper/udisks-luks-uuid-ASDFASDF       Test mode: Metadata will NOT be updated and volumes will not be (de)activated.         Using physical volume(s) on command line         Test mode: Skipping archiving of volume group.         /dev/mapper/udisks-luks-uuid-ASDFASDF: Pretending size is 517996544 not 624087040 sectors.         Resizing volume "/dev/mapper/udisks-luks-uuid-ASDFASDF" to 624087040 sectors.         Resizing physical volume /dev/mapper/udisks-luks-uuid-ASDFASDF from 0 to 63231 extents.       /dev/mapper/udisks-luks-uuid-ASDFASDF: cannot resize to 63231 extents as later ones are allocated.       0 physical volume(s) resized / 1 physical volume(s) not resized         Test mode: Wiping internal cache         Wiping internal VG cache      So the error message is:               cannot resize to 63231 extents as later ones are allocated.      **Q:** How can I defrag the vg_root so I can remove the unneeded part of it? p.s: I already found out that I only need to resize the PV to resize the VG, or are there any better commands to do the VG resize (ex.: what can I do if I would several VG's on a PV? ...)?


title: Attach to different windows in session

text: I have a pretty simple tmux session running with two open windows; one of them for local hacking and one of them for work. What I'd like to do is to simply connect to the hacking window while leaving the work window open in another terminal. However, as soon as I connect to tmux, all commands are sent to both windows, so if I switch to another window, the same thing happens in the other terminal and vice-versa. Is there a way for me to simply connect to each window separately?


title: FreeBSD CPU frequency scaling on AMD Sempron 2100

text: I have FreeBSD 9.0-RC3 installed on an HP Thin Client that has a Mobile AMD Sempron(tm) Processor 2100+. I am trying to get cpufreq and powerd to manage the frequency of the processor, but I'm not having any luck. Here's some lines from dmesg:               FreeBSD 9.0-RC3 #0: Sun Dec  4 08:56:36 UTC 2011         root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64     CPU: Mobile AMD Sempron(tm) Processor 2100+ (997.52-MHz K8-class CPU)       Origin = "AuthenticAMD"  Id = 0x60fc2  Family = f  Model = 6c  Stepping = 2       Features=0x78bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2>       Features2=0x2001<SSE3,CX16>       AMD Features=0xea500800<SYSCALL,NX,MMX+,FFXSR,RDTSCP,LM,3DNow!+,3DNow!>       AMD Features2=0x119<LAHF,ExtAPIC,CR8,Prefetch>          module_register: module cpu/ichss already exists!     Module cpu/ichss failed to register: 17     module_register: module cpu/est already exists!     Module cpu/est failed to register: 17     module_register: module cpu/hwpstate already exists!     Module cpu/hwpstate failed to register: 17     module_register: module cpu/p4tcc already exists!     Module cpu/p4tcc failed to register: 17     module_register: module cpu/powernow already exists!     Module cpu/powernow failed to register: 17          powerd: lookup freq: No such file or directory      Also, `sysctl dev | grep freq` returns no hits. Any suggestions on how to get CPU frequency management working?


title: Grub and boot loader

text: What effect does setting a partition to active still have with common boot loaders. For instance if you install grub on the mbr, do you still need to specify the /boot as active, or does grub just select it anyway. I am asking because it say old bootloaders would load the volume boot record of the active partition. Is it still done this way with linux and grub, depending on where you install grub? This question was posted under superuser before in case any one was looking for it, but I felt it was more appropriate to move it here


title: Meta key does not open "Activities" menu in Gnome 3

text: I've started using the Gnome 3 packages that just came through the Debian testing repositories, and encountered a problem. Hitting the `Super`/`Meta`/`Windows` key would not open "Activities" menu. Other shortcuts (like `Alt`+`Tab`, etc.) work as expected. Can you help me find the reason (and a solution)?


title: vga_switcheroo not in /sys/kernel/debug in 2.6.35-22 (kubuntu maverick)

text: I have a sony VPCZ12 laptop. It has those dual video cards that are a pain to get working in linux. The new 2.6.35 kernel is supposed to support that with the vga_switcheroo module which is supposed to be located in /sys/kernel/debug on >2.6.35. The problem is that when I boot my laptop, it freezes at a blackscreen unless I boot with options `i915.nomodeset=0`. It won't boot into X, but I can get to a terminal which is fine. But then vga_switcheroo isn't in `/sys/kernel/debug`. Is this a ubuntu bug on how the kernel is compiled? Or is it because I have to boot with `i915.nomodeset`? The livecd boots into X just fine, but I've never found a way to get X working on the installation. There's a lot of information about linux on the z12 but most of it is either outdated, doesn't work, or just plain doesn't make any sense


title: Linux distribution with 'yum' package manager

text: I hope that this question is appropriate for this site (if not, please accept my apologies). I am a professional statistician who uses the statistical programming language R. I'm currently building my own desktop computer and would like to run Linux as my operating system. Instead of base R, I'd like to use Revolution R Enterprise which lists Redhat Enterprise Linux as the required Linux distribution (more specifically, I was told by Revolution Analytic's technical support that "Since our installer requires the 'yum' package manager, Revolution R Enterprise for Linux is currently supported by Redhat Enterprise Linux"). I've run Ubuntu on my Mac OS X computer and liked Ubuntu. While Ubuntu does not use the 'yum' package manager, can I install Revolution R Enterprise on a computer with Ubuntu? If not, do I need to have Redhat Enterprise Linux or can I use another Linux distribution? **ADDITIONAL INFORMATION: The archive file provided by Revolution has file format tar.gz. From the installation manual: 2.1 System Requirements Revolution R Enterprise for Red Hat Enterprise Linux has the following system requirements: Processor 64-bit processor with x86-compatible architecture (variously known as AMD64, Intel 64, x86-64, IA-32e, EM64T, or x64 chips). Itanium-architecture chips (also known as IA-64) are not supported. Multiple-core chips are recommended. Operating System Red Hat Enterprise Linux 5.4 or 5.5. Memory A minimum of 1GB of RAM is required; 4GB or more are recommended. Disk Space A minimum of 500MB of disk space are required. 2.2 Package Dependencies Revolution R Enterprise, like most Linux applications, depends upon a number of Linux packages. The first of these, listed in Table 2.1, require manual installation, and must be installed before you run the automated script. While the list of dependencies may look daunting, it actually involves installing just six packages: • rpmlib • glibc • libICE • libgcc • libstdc++ • unixODBC


title: What happened to my free space

text: On my _Amazing **2GB** EeePC Surf_, I have no more space left! This is quite normal, and it happens every now and then. Just delete a few large, unneeded files and everything should be good, right? So I go and find a **2MB** file in /tmp, and `rm -rf` it. Check free space again, and... still nothing?! I had to remove about **30MB** of files before it registered some free space. Now, my question is, whats up with this strange behaviour?


title: How to move window in GNU Screen

text: I have a window called 'Codes' in window 1, and I want to move it to window 7, is it possible?


title: How to split window vertically in GNU Screen?

text: I saw some body split their window to 2x2, I just want to know how to do that? I know the 'split' command in Screen can only split the window horizontally.


title: Unix executable file permission vs runtime user's permissions

text: I have heard that it is good practice to run an executable as a user with a completely different privilege set than the owner of the task. In fact I heard that it is best to run it as a different user with exactly the opposite privilege set. I can understand limiting the privileges of a run time user, but can't this be achieved by the `setuid` feature?


title: Monitor single process to logfile perodicly

text: Based on this question, I would like to log the performance of a specific process, with a frequency of say one second, to a `csv` (comma separated value) log file. Something like:               timestamp(unix),cpu_activity(%),mem_usage(B),network_activity(B)     1355407327,24.6,7451518,345     1355407328,27.6,7451535,12     1355407329,31.6,7451789,467     ...


title: Package Installation log creation

text: I have written a script for installing packages on Linux(Ubuntu). So I want to create a log file for installation of packages for troubleshooting if any problem occur during installation.So please suggest me a way to how to go for it??


title: Is my apt-get dependency tree corrupted?

text: I wanted to uninstall the `libboost` libraries. I wrote in the console:               sudo apt-get remove libboost-*      But looking more precisely at the console output, I noticed `apt-get` was ready to remove several packages that looks _completely_ unrelated to `libboost` Although I may not use once in a month `compiz`, `ubuntu-desktop`, or `unity`, I don't want them to be removed. And I can't understand they are programmed for removal ? So I am wondering if there could be a mess in the dependence tree, and if there were any operation to put the situation back to normal ? More precisely the end of the console output is:               The following packages were automatically installed and are no longer required:       libtorque2 texlive-fonts-recommended libopenmpi1.3 libibverbs-dev tipa mpi-default-dev lyx-common libnuma1 gccxml texlive-fonts-recommended-doc libibve       libicu-dev gwibber libopenmpi-dev     Use 'apt-get autoremove' to remove them.     The following packages will be REMOVED:       akonadi-server aptitude compiz compiz-fusion-plugins-extra compiz-fusion-plugins-main compiz-plugins compiz-plugins-extra compiz-plugins-main compiz-pl       kdepim-runtime libboost-all-dev libboost-date-time-dev libboost-date-time1.46-dev libboost-date-time1.46.1 libboost-dbg libboost-dev libboost-doc libbo       libboost-filesystem1.46-dev libboost-filesystem1.46.1 libboost-graph-dev libboost-graph-parallel-dev libboost-graph-parallel1.46-dev libboost-graph-par       libboost-graph1.46-dev libboost-graph1.46.1 libboost-iostreams-dev libboost-iostreams1.46-dev libboost-iostreams1.46.1 libboost-math-dev libboost-math1       libboost-mpi-dev libboost-mpi-python-dev libboost-mpi1.46-dev libboost-mpi1.46.1 libboost-program-options-dev libboost-program-options1.46-dev libboost       libboost-python-dev libboost-python1.46-dev libboost-python1.46.1 libboost-regex-dev libboost-regex1.40.0 libboost-regex1.46-dev libboost-regex1.46.1 l       libboost-serialization1.46-dev libboost-serialization1.46.1 libboost-signals-dev libboost-signals1.46-dev libboost-signals1.46.1 libboost-system-dev li       libboost-system1.46.1 libboost-test-dev libboost-test1.46-dev libboost-test1.46.1 libboost-thread-dev libboost-thread1.46-dev libboost-thread1.46.1 lib       libboost-wave1.46-dev libboost-wave1.46.1 libboost1.46-dbg libboost1.46-dev libboost1.46-doc libtorrent-rasterbar6 lyx python-kde4 qbittorrent software       tasksel-data ubuntu-desktop uex unity     0 upgraded, 0 newly installed, 77 to remove and 4 not upgraded.     After this operation, 489 MB disk space will be freed.     Do you want to continue [Y/n]? n


title: Unix command to find files read by specific user

text: I would like to find files accessed by specific user (even just read) within a folder tree. I thought the `find` command had this option, but it actually just searches for owner user. Is there any other command, or command combinations? The `stat` command offers access information, but doesn't display the user who made access.


title: Identify folder in bash

text: I was trying to learn how to identify only folders within a folder on the main level. example:   * main   * -folder 1   * -folder 2   * -folder 3 I started with this script:               #!/bin/bash          LOCATION="/mnt/test/build/"          for folder in $(ls $LOCATION); do              echo "$folder"     done      However when I run the script it will echo the entire contents and if a folder has a space within it the name will be added to two lines. If I change the echo line from `"$folder"` to `'$folder'` it will only echo folder. Any suggestive articles would be great, too.


title: attron(A_BLINK) using Ncurses does nothing

text: I'm using Ubuntu 14.04, gcc 4.8.2 and Ncurses 5.9.20140118; whenever I run any code like               attron(A_BLINK);     printw("Hi");     refresh();      the text that gets printed to the terminal doesn't blinks (or do hoola-hoops)- it's just regular text that would have been printed by               printw("Hi");     refresh();      I have tested it on xterm, default ubuntu terminal, gnome terminal and Guake with the same result. Do I need some special fonts with "Blink Support" or something for it?


title: Simulate an unkillable process in D state

text: For catastrophe testing scenarios on out server environment we're looking for an easy way to make a process stuck in D (uninterruptible sleep) state. Any easy ways? An example C sample code would be a plus :) **Edit** - the first answer is semi-correct, as the process is shown to be in D state, but it still receives signals and can be killed


title: AWK how to add all columns beginning with specific row

text: I have this output:                 Count Process         238 0          1 1124027          1 1124065          1 1124066          1 1124069          1 1124072          1 1124073          1 1547365          1 1547366      I wanted to add all Count except for the first line (238). How do I do this on awk? so far I have this   `awk 'NF == 1 {for (i=2;i<=FNR;++i) sum += i print $i}'`   but its an error. Any help is greatly appreciated. Thanks # Edit I am trying to parse the output of this command:               cat /proc/8920/maps | awk '{print$5}' | sort | uniq -c |`awk 'NF == 1 {for (i=2;i<=FNR;++i) sum += i print $i}'`       Everything works fine until uniq -c, but after that I have problem with awk script to add all lines in first columns except for the first line which is 238. I hope this clears things up. Hauke Laging's answer and I came up with this script               cat /proc/8920/maps | awk '{print$5}' | sort | uniq -c | awk 'NR>1 { sum+= $1} END  {print sum}'      now its working. Thanks very much!


title: pipe Windows windows to Xserver on my linux host

text: Is it possible to pipe a native graphical Windows application to Xserver? I would like to run a virtual machine on my Linux host and access the application directly. (Something like the seamless function from VirtualBox)


title: Cancel and resume a duplicity backup

text: Is there a way to cancel `duplicity` (running over `rsync` and symmetric gpg encryption) without messing up the running backup and resume it later (for example after rebooting the laptop) without problems? Suppose for example that after starting a `duplicity` backup on my laptop I notice that it will take too long time and that I have to shutdown the laptop in a few minutes.


title: Browsing bup backup with gitk or gitg

text: I am just playing around with `bup` for my backups and tested it like this:               BUP_DIR=/mnt/TestTarget/bup bup init      Which gave me the message: `Initialized empty Git repository in /mnt/TestTarget/bup/` However in `/mnt/TestTarget` there seems to be not `.git` directory.               bup index -uv /home/user/TestSource     bup save -n buptest1 /home/user/TestSource      Now I want to browse the repository with `gitk`, I did `cd /mnt/TestTarget/bup` and `gitk` but it doesn't display anything. `gitg` gives me `Could not find git repository`. So what's wrong here? How can I use `gitk` or `gitg` to browse my backup?


title: Does Android SDK work in Solaris?

text: I want to compile my Android app in a Solaris server. Though, from Android Developers all I can see are Windows/MacOS/Linux versions. Does anyone know if I can install and use the Linux binaries in a Solaris machine? If not, are there alternatives?


title: get info about package update in openSuSE

text: Is there any way to get information about an available package update via zypper? I can get info about a patch with:               zypper info -t patch pachNameHere      and I can obtain the patch name via:               zypper list-patches      I want to do something similar with `zypper list-updates` to get info about those updates like release notes, bugfixes, etc in order to know how important they are. I am also using the zypper nagios plugin (nagios-plugins-zypper) Any suggestion?


title: How to print Unicode glyph names for input string?

text: I'd like to be able to run               unicode-names 'abç'      and see the corresponding Unicode character names:               LATIN SMALL LETTER A     LATIN SMALL LETTER B     LATIN SMALL LETTER C WITH CEDILLA      Printing a string as a series of Unicode glyph names would be useful in several cases:   * Distinguish easily confused characters such as "i" and "í".   * Explain what a literal string actually contains (for example non-printable or unassigned, zero-width characters).


title: apt-proxy replacement/alternative on Debian

text: I missed that apt-proxy is not available anymore. What are my alternatives? Google didn't give me anything useful expect years old stuff.


title: can I run xvfb on a console-only debian system

text: I am developing a console-only debian-based rescue cd loosly based on thfixed spelling.e live-system's rescue cd. One of the things I need for my livecd is to be able to run firefox for some testing, and I want ot run it using xvfb. The command I have been using to run it on my regular debian system is:               $ xvfb-run firefox &      But on my livecd, after running this command it exits almost immediately and I don't see xvfb running when I do:               $ ps -ef | grep -i 'xvfb"      Are there some special packages I need to include on my livecd other than gtk2.0-0, atk1.0-0 and xvfb?


title: I opened a port with iptables but still doesnt work

text: I have a CentOS installation as a guest VM with VirtualBox. I have two ethernet interfaces, eth0 with NAT and DHCP, and eth1 with Host-only adaptor and static IP. I have oracle installed in this CentOS and I want to open the port of the database 1521 and the port of the oracle manager (which depends on the db...in this example 5500). So my                   # Firewall configuration written by system-config-firewall         # Manual customization of this file is not recommended.         *filter         :INPUT ACCEPT [0:0]         :FORWARD ACCEPT [0:0]         :OUTPUT ACCEPT [0:0]         -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT         -A INPUT -p icmp -j ACCEPT         -A INPUT -i lo -j ACCEPT         -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT         -A INPUT -m state --state NEW -m tcp -p tcp --dport 1521 -j ACCEPT         -A INPUT -m state --state NEW -m tcp -p tcp --dport 1158 -j ACCEPT         -A INPUT -m state --state NEW -m tcp -p tcp --dport 5500 -j ACCEPT         -A INPUT -m state --state NEW -m tcp -p tcp --dport 465 -j ACCEPT         -A INPUT -j REJECT --reject-with icmp-host-prohibited         -A FORWARD -j REJECT --reject-with icmp-host-prohibited         COMMIT      And `sudo iptables -nvL` in the guest VM shows:                           Chain INPUT (policy ACCEPT 0 packets, 0 bytes)          pkts bytes target     prot opt in     out     source               destination          266K  103M ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED             1    84 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0          4749  285K ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0             3   192 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22             0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:1521             0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:1158          1001  143K REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited              Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)          pkts bytes target     prot opt in     out     source               destination             0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited              Chain OUTPUT (policy ACCEPT 220K packets, 92M bytes)          pkts bytes target     prot opt in     out     source               destination      It looks like there iptables shows less entries than the ones I have defined in the file. `sudo netstat -apnt | grep 5500` shows that the process is indeed running in 5500:                   tcp        0      0 192.168.56.11:25500         192.168.56.11:1521          ESTABLISHED 3332/emagent         tcp        0      0 :::5500                     :::*                        LISTEN      3323/java         tcp        0      0 ::ffff:192.168.56.11:1521   ::ffff:192.168.56.11:25500  ESTABLISHED 3891/oraclesampleDM      I did several `telnet oracleserver XXX`. It could connect with 22 and 1521. Which seem to be the first 2 that I added in the iptables. It refused to connect in all the rest...it seems it is using an old version of the file... But from my host machine, if I open a browser and type `https://oracleserver:5500/em/` I get a an error... I have already done `sudo iptables restart` after having modified the file, and even reboot the OS. I have commented the reject lines (to see if there could be a routing problem), and even `service iptables stop`. I still have the same problem. What is funny is that ssh works from host to guest..... `route -n` in the guest VM outputs:                   Kernel IP routing table         Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         10.0.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0         192.168.56.0    0.0.0.0         255.255.255.0   U     0      0        0 eth1         169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0         169.254.0.0     0.0.0.0         255.255.0.0     U     1003   0        0 eth1         0.0.0.0         10.0.2.2        0.0.0.0         UG    0      0        0 eth0      Anything weird?


title: How can I find broken symlinks

text: Is there a way to find all symbolic links that don't point anywere? `find ./ -type l` will give me all symbolic links, but makes no distinction between links that go somewhere and links that don't. I'm currently doing: `find ./ -type l -exec file {} \; |grep broken` But I'm wondering what alternate solutions exist.


How do I install CLang on Ubuntu, using precompiled binaries of CLang that I downloaded? Here's how I downloaded CLang: "LLVM Download Page" -> "Download LLVM 3.2" -> "Clang Binaries for Ubuntu-12.04/x86_64" ( http://llvm.org/releases/3.2/clang+llvm-3.2-x86_64-linux-ubuntu-12.04.tar.gz .) Then, I expanded the archive into a folder on my Ubuntu 12.04 LTS 64-bit machine. The contents of the expanded folder look like this:               $ ls clang+llvm-3.2-x86_64-linux-ubuntu-12.04     bin  docs  include  lib  share      Question: What do I do next? Do I have to copy these into some folders myself, and if so, which ones exactly? Most instructions I found online are for building CLang from source, which doesn't apply here. I am a newbie to most of these tools. I created a basic hello-world C++ program, and was able to compile and run it, using GCC and autotools. Now, I want to compile the same program with CLang. Also asked on StackOverflow: How to install CLang using precompiled binaries?: http://stackoverflow.com/questions/17045954/how-to-install-clang-using- precompiled-binaries .


title: How can I fix this SSH hostname tab completion script?

text: I found the following script (for bash) that enables me to get tab completion for any hostname I've connected to (from `~/.ssh/known_hosts`):               complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\["`;)" ssh      However, the problem is that the tab completion doesn't work after I've typed a username. How can I improve this so if I type...               ssh myusername@my       and expect it to complete "myhostname.com" it will be able to do so? It would be even better if it could tab whole strings (user@hostname) as well, but I can live with either option. Without the first, this isn't much use unless my host username matches the local username.


title: BackTrack 5 gui won't load after Installation

text: I Have installed BackTrack 5. It works fine on a live bootable USB, but once I installed a gui it is not loading. Using the command shell, it works fine, but when I type `startx` in root login, a black screen appears which remains forever. I have tried many things, such as creating non-root users, then `startx`, but it doesn't help. My laptop is a Lenovo G650. I have assigned 29GB to BackTrack with 4GB swap. I have an Intel Core2duo processor with integrated card and 3GB ram.


title: Is there an Arch based live persistant distribution?

text: I'm currently installing Archlinux on my new computer but Windows seems to be installed using UEFI and I'm quite in a rush right now and I don't have time to install Archlinux using EFISTUB or something like that (it seems very painfull to perform).   So here is my question : **Is there a live persistant distribution based on Archlinux (and quite easy to install) ?**   Except FaunOS because I can't find it anywhere on the internet (it seems that the project has been discontinued). In the best case I would like to have a Gnome3 desktop. Can someone help me ? =)


title: Why does sftp hide the log from stdout?

text: I have a script `a.sh`, which has an `sftp` command:               echo "Starting to sftp..."     sftp xxx@xxx.xxx.xxx.xx << END_SCRIPT     ls     mput *.csv.gz     bye          END_SCRIPT     echo "Sftp successfully."      If I run it interactively, the log output from `sftp` is shown. However, if I set it in a crontab and redirect the stdout to a file using `>`, there will be only the output from the two `echo` statements. How can I get the log from the `sftp` command? EDIT: I tried the following forms and it didn't work too. sftp -b batch_file.txt xxx@xxx.xxx.xx.xx ( redirect from cron ) sftp -b batch_file.txt xxx@xxx.xxx.xx.xx >> some_file.log ( redirect from cron + redirect from this line ) I think the problem should be related to the nature of sftp that it is supposed to be run interactively, as stated in the man page. But I cannot find the solution. **My distribution** : `Red Hat Enterprise Linux AS release 3 (Taroon Update 2)` **the crontab entry** :               52 14 * * * sh /home/xxx/testing/xxx.sh > /home/xxx/testing/xxx_`date +\%Y\%m\%d`.log      And the log is created with a time matching the crontab entry. **ssh version** :               OpenSSH_3.6.1p2, SSH protocols 1.5/2.0, OpenSSL 0x0090701f      EDIT: I found that if I redirect the output of sftp in the script file to an text file, the message from sftp is logged. Then I remove the log file and scheduled it with cron. After the cron execution, the log file is generated but have no message from sftp. Instead, it only contain log from other statement inside the script file. If I redirect the output of sftp in script file and run it interactively, the log are perfectly fine. However if I scheduled it with cron ( no redirect in the crontab entry, just simply schedule it ), the log from sftp is gone too.


title: How do I stop the root user from deleting a file?

text: I'd like to know if I can prevent the root user from deleting a file. Is it possible?


title: Expansion with numbers in human readable format

text: So, I want to play some MP3s in a console player that takes file names as inputs. I have the following files, as given by `ls -1 *` where `*` get expanded by my shell (zsh):               1 - Main title.mp3     10 - End title.mp3     2 - Intro.mp3      ...      But clearly, how I actually want them to be ordered is like so:               1 - Main title.mp3     2 - Intro.mp3      ...     10 - End title.mp3      What shell expansion magic do I need to make it so? I know I could get the same thing with some clever pipes and `sort -h` but that's not really an option _because I am a lazy typist_. So, unless I wrote a small shell script to add song, I'd just rather do `nyxmms2 add /path/to/dir/*.mp3` thus why I am looking at how to do the filtering within zsh's expansion... Also, I want to know if this is possible because it applies to a lot of other situations as well -- for example, log files or revisions or ...


title: How to check whether firewall opened for a port but not listening on the port

text: We will be deploying a new application to a Server and the application will be listening on port 8443. We have asked Network team to open the firewall for the port 8443 on that server before deploying the application. There is no application currently listening on that particular port on the server. Is there anyway i can make sure the firewall is opened for the port 8443 OS: Solaris 10 10/09 s10s_u8wos_08a SPARC


title: Disable Bluetooth device on Ubuntu

text: I run Kubuntu Quantal on a Macbook 8-2 and want to disable the Bluetooth device. Yeah, disable, not just hide or stop a deamon, but shut off the damn hardware. I know it can be done on Lenovos using `echo 0 > /sys/devices/platform/thinkpad_acpi/bluetooth_enable` but for Macbooks? Someone briefly told me about `-bt 0` but couldn't really remember ... and that string is certainly hard to google.


title: rsyslog drops messages excessively

text: We have a CentOS machine acting as our syslog server. I recently noticed that the machine has been dropping large numbers of syslog messages at times. We have over 250 routers and switches, as well as firewalls logging every connection open / close. I can see the messages get to the ethernet NIC... for instance, suppose I go into config mode on one of our routers and then exit... this generates a syslog message, and I sniff to demonstrate that it gets to the syslog server...               [mpenning@uglylogger net]$ sudo tshark -V udp and port 514 and host 214.110.12.246     Running as user "root" and group "root". This could be dangerous.     Capturing on eth0     Frame 1 (151 bytes on wire, 151 bytes captured)         Arrival Time: Apr 26, 2013 06:05:33.490721000         [Time delta from previous captured frame: 0.000000000 seconds]         [Time delta from previous displayed frame: 0.000000000 seconds]         [Time since reference or first frame: 0.000000000 seconds]         Frame Number: 1         Frame Length: 151 bytes         Capture Length: 151 bytes         [Frame is marked: False]         [Protocols in frame: eth:ip:udp:syslog]     Ethernet II, Src: 50:57:a8:9f:68:3c (50:57:a8:9f:68:3c), Dst: Supermic_30:4a:07 (00:30:48:30:4a:07)         Destination: Supermic_30:4a:07 (00:30:48:30:4a:07)             Address: Supermic_30:4a:07 (00:30:48:30:4a:07)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Source: 50:57:a8:9f:68:3c (50:57:a8:9f:68:3c)             Address: 50:57:a8:9f:68:3c (50:57:a8:9f:68:3c)             .... ...0 .... .... .... .... = IG bit: Individual address (unicast)             .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)         Type: IP (0x0800)     Internet Protocol, Src: 214.110.12.246 (214.110.12.246), Dst: 214.110.16.4 (214.110.16.4)         Version: 4         Header length: 20 bytes         Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)             0000 00.. = Differentiated Services Codepoint: Default (0x00)             .... ..0. = ECN-Capable Transport (ECT): 0             .... ...0 = ECN-CE: 0         Total Length: 137         Identification: 0x0096 (150)         Flags: 0x00             0.. = Reserved bit: Not Set             .0. = Don't fragment: Not Set             ..0 = More fragments: Not Set         Fragment offset: 0         Time to live: 250         Protocol: UDP (0x11)         Header checksum: 0xcf52 [correct]             [Good: True]             [Bad : False]         Source: 214.110.12.246 (214.110.12.246)         Destination: 214.110.16.4 (214.110.16.4)     User Datagram Protocol, Src Port: 63873 (63873), Dst Port: syslog (514)         Source port: 63873 (63873)         Destination port: syslog (514)         Length: 117         Checksum: 0x1ed8 [validation disabled]             [Good Checksum: False]             [Bad Checksum: False]     Syslog message: LOCAL7.NOTICE: 187: .Apr 26 06:05:32.476 CDT: %SYS-5-CONFIG_I: Configured from console by admin on vty0 (214.110.26.29)         1011 1... = Facility: LOCAL7 - reserved for local use (23)         .... .101 = Level: NOTICE - normal but significant condition (5)         Message: 187: .Apr 26 06:05:32.476 CDT: %SYS-5-CONFIG_I: Configured from console by admin on vty0 (214.110.26.29)          ^C1 packet captured     [mpenning@uglylogger net]$      However, that message does not show up in the syslog (even though another message sent at 05:37:05 does)... Only one of of seven or eight of those messages show up in the log file...               [mpenning@uglylogger net]$ pwd     /var/log/net     [mpenning@uglylogger net]$     [mpenning@uglylogger net]$ grep CONFIG network.log     Apr 26 05:08:59 somedevice.company.local 779476: Apr 26 05:08:58.604      CDT: %SYS-5-CONFIG_I: Configured from console by cbutler on vty0 (214.110.31.65)     Apr 26 05:37:05 w9-idf-lab 182: .Apr 26 05:37:04.452 CDT:      %SYS-5-CONFIG_I: Configured from console by admin on vty0 (214.110.26.29)     [mpenning@uglylogger net]$      I have tried many things to make this server log correctly...   * Removed all extraneous files from the partition   * Checked the NIC for discards / errors   * Reloaded rsyslogd   * Reloaded the system   * `yum update`   * Started a caching nameserver   * Checked iostat (load is quite reasonable, see below)   * Checked vmstat (load again, is quite reasonable) I'm running out of ideas... how can I stop this server from bleeding syslogs? * * * # MISC Output Directory listing               [mpenning@uglylogger net]$ ls -al     total 3292356     drwxr-xr-x   3 root root      20480 Apr 26 05:17 .     drwxr-xr-x. 13 root root       4096 Apr 21 03:39 ..     drwxr-xr-x   2 root root       4096 Apr 19 04:22 daily     -rw-r--r--   1 root root  185081020 Apr 26 06:21 fw1.log     -rw-r--r--   1 root root 1936049300 Apr 26 04:15 fw1.log-20130426     -rw-r--r--   1 root root    7629110 Apr 26 06:21 fw2.log     -rw-r--r--   1 root root  160792210 Apr 26 04:17 fw2.log-20130426     -rw-r--r--   1 root root     118327 Apr 26 06:20 network.log     -rw-r--r--   1 root root    1572210 Apr 26 04:17 network.log-20130426     -rw-r--r--   1 root root      73108 Apr 26 06:21 wireless.log     -rw-r--r--   1 root root     686104 Apr 26 04:17 wireless.log-20130426     [mpenning@uglylogger net]$      `rsyslog.conf`               $ModLoad imudp     $UDPServerRun 514               $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat          $IncludeConfig /etc/rsyslog.d/*.conf          if $msg contains 'APF-3-RCV_UNSUPP_MSG' then /dev/null     &~          if $msg contains 'FWSM-2-106007' then /dev/null     &~               if $fromhost-ip=='214.110.225.201' then /var/log/net/fw1.log     &~     if $fromhost-ip=='214.110.225.202' then /var/log/net/fw1.log     &~          if $fromhost-ip=='214.110.19.246' then /var/log/net/fw2.log     &~     if $fromhost-ip=='214.110.19.253' then /var/log/net/fw2.log     &~          if $fromhost-ip=='214.110.5.10' then /var/log/net/fw_other.log     &~          if $fromhost-ip=='214.110.6.254' then /var/log/net/fw_other.log     &~     if $fromhost-ip=='214.110.6.253' then /var/log/net/fw_other.log     &~          if $fromhost-ip=='214.110.46.254' then /var/log/net/fw_other.log     &~     if $fromhost-ip=='214.110.46.253' then /var/log/net/fw_other.log     &~          if $fromhost-ip=='214.110.19.42' then /var/log/net/fw_other.log     &~          if $fromhost-ip=='214.110.3.203' then /var/log/net/fw_other.log     &~          if $fromhost-ip=='214.110.84.2' then @214.110.16.6     if $fromhost-ip=='214.110.84.2' then /var/log/net/wireless.log     &~     if $fromhost-ip=='214.110.84.4' then @214.110.16.6     if $fromhost-ip=='214.110.84.4' then /var/log/net/wireless.log     &~     if $fromhost-ip=='214.110.70.8' then @214.110.16.6     if $fromhost-ip=='214.110.70.8' then /var/log/net/wireless.log     &~     if $fromhost-ip=='214.110.70.12' then @214.110.16.6     if $fromhost-ip=='214.110.70.12' then /var/log/net/wireless.log     &~     if $fromhost-ip=='214.110.70.16' then @214.110.16.6     if $fromhost-ip=='214.110.70.16' then /var/log/net/wireless.log     &~     if $fromhost-ip=='214.110.16.6' then /var/log/net/wireless.log     &~          if $fromhost-ip startswith '214.110' then /var/log/net/network.log     &~     if $fromhost-ip startswith '214.111' then /var/log/net/network.log     &~     if $fromhost-ip startswith '214.112' then /var/log/net/network.log     &~               *.info;mail.none;authpriv.none;cron.none                /var/log/messages          authpriv.*                                              /var/log/secure          mail.*                                                  -/var/log/maillog               cron.*                                                  /var/log/cron          *.emerg                                                 *          uucp,news.crit                                          /var/log/spooler          local7.*                                                /var/log/boot.log          $template SpiceTmpl,"%TIMESTAMP%.%TIMESTAMP:::date-subseconds% %syslogtag% %syslogseverity-text%:%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"          :programname, startswith, "spice-vdagent"       /var/log/spice-vdagent.log;SpiceTmpl      `iostat 5`... these numbers are typical... the load doesn't spike that much...               [mpenning@uglylogger net]$ iostat 5     Linux 2.6.32-358.2.1.el6.i686 (uglylogger.local)  04/26/2013      _i686_  (4 CPU)          avg-cpu:  %user   %nice %system %iowait  %steal   %idle                2.25    0.05    0.80    0.37    0.00   96.52          Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn     sda              10.67       364.09       536.25  995468936 1466172104     dm-0             33.82        15.35       268.50   41981146  734110616     dm-1              0.00         0.00         0.00       3056          0     dm-2              2.21         0.05        17.60     132282   48114080     dm-3             33.07       348.68       250.14  953334658  683895008          avg-cpu:  %user   %nice %system %iowait  %steal   %idle                0.05    0.00    0.00    0.15    0.00   99.80          Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn     sda               1.00         0.00         8.00          0         40     dm-0              0.80         0.00         6.40          0         32     dm-1              0.00         0.00         0.00          0          0     dm-2              0.00         0.00         0.00          0          0     dm-3              0.20         0.00         1.60          0          8          avg-cpu:  %user   %nice %system %iowait  %steal   %idle                0.00    0.00    0.05    0.30    0.00   99.65          Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn     sda               1.00         0.00        33.60          0        168     dm-0              0.00         0.00         0.00          0          0     dm-1              0.00         0.00         0.00          0          0     dm-2              0.00         0.00         0.00          0          0     dm-3              4.20         0.00        33.60          0        168          avg-cpu:  %user   %nice %system %iowait  %steal   %idle                1.05    0.00    0.30    0.20    0.00   98.44          Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn     sda               1.20         0.00         8.00          0         40     dm-0              0.80         0.00         6.40          0         32     dm-1              0.00         0.00         0.00          0          0     dm-2              0.00         0.00         0.00          0          0     dm-3              0.20         0.00         1.60          0          8          avg-cpu:  %user   %nice %system %iowait  %steal   %idle                1.40    0.00    0.30    0.15    0.00   98.14          Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn     sda               0.80         0.00         6.40          0         32     dm-0              0.80         0.00         6.40          0         32     dm-1              0.00         0.00         0.00          0          0     dm-2              0.00         0.00         0.00          0          0     dm-3              0.00         0.00         0.00          0          0          avg-cpu:  %user   %nice %system %iowait  %steal   %idle                0.05    0.00    0.05    0.25    0.00   99.65          Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn     sda               5.40         0.00        46.40          0        232     dm-0              0.00         0.00         0.00          0          0     dm-1              0.00         0.00         0.00          0          0     dm-2              0.00         0.00         0.00          0          0     dm-3              5.80         0.00        46.40          0        232          avg-cpu:  %user   %nice %system %iowait  %steal   %idle                0.00    0.00    0.05    0.15    0.00   99.80          Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn     sda               0.80         0.00         4.80          0         24     dm-0              0.60         0.00         4.80          0         24     dm-1              0.00         0.00         0.00          0          0     dm-2              0.00         0.00         0.00          0          0     dm-3              0.00         0.00         0.00          0          0          avg-cpu:  %user   %nice %system %iowait  %steal   %idle                3.71    0.00    1.05    0.10    0.00   95.14          Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn     sda               1.20         0.00        19.20          0         96     dm-0              1.40         0.00        11.20          0         56     dm-1              0.00         0.00         0.00          0          0     dm-2              0.00         0.00         0.00          0          0     dm-3              1.00         0.00         8.00          0         40          avg-cpu:  %user   %nice %system %iowait  %steal   %idle                0.05    0.00    0.00    0.35    0.00   99.60          Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn     sda               3.40         0.00       102.40          0        512     dm-0              1.40         0.00        11.20          0         56     dm-1              0.00         0.00         0.00          0          0     dm-2              0.00         0.00         0.00          0          0     dm-3             11.40         0.00        91.20          0        456          ^C     [mpenning@uglylogger net]$      `vmstat 5`...               [mpenning@uglylogger net]$ vmstat 5     procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----      r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st      0  1      0 240408  50068 3506120    0    0    46    67    2    2  2  1 97  0  0      0  0      0 240400  50068 3506152    0    0     0    19 1312   37  0  0 100  0  0      1  0      0 239160  50084 3508648    0    0     0    18 3943 2320 20  6 74  0  0      1  0      0 242632  50100 3510084    0    0     0   212 3561 2718 14  5 81  1  0      0  0      0 238168  50116 3510336    0    0     0    58 1612 2537  1  1 98  0  0      0  0      0 235440  50124 3510340    0    0     0   510 1340 1333  0  0 100  0  0      0  0      0 235564  50132 3510340    0    0     0    19 1470   37  0  0 100  0  0      0  0      0 235564  50140 3510344    0    0     0    28 1348   40  0  0 100  0  0      0  0      0 235440  50156 3510340    0    0     0    17 1497   37  0  0 100  0  0      0  0      0 235564  50156 3510348    0    0     0    70 1522   38  0  0 100  0  0      `df -h`...               [mpenning@sasmars net]$ df -h     Filesystem            Size  Used Avail Use% Mounted on     /dev/mapper/vg_uglylogger-LogVol01                            73G   17G   56G  23% /     tmpfs                 2.0G     0  2.0G   0% /dev/shm     /dev/sda1             985M  126M  809M  14% /boot     /dev/mapper/vg_uglylogger-LogVol00                            20G  655M   18G   4% /home     /dev/mapper/vg_uglylogger-LogVol03                           592G  4.9G  557G   1% /var     [mpenning@uglylogger net]$      `netstat -s`...               [mpenning@uglylogger net]$ netstat -s | head     Ip:         452407434 total packets received         0 forwarded         0 incoming packets discarded         449256489 incoming packets delivered         156718754 requests sent out         150 reassemblies required         75 packets reassembled ok     Icmp:         2423436 ICMP messages received     [mpenning@uglylogger net]$      `ifconfig eth0`...               [mpenning@uglylogger net]$ ifconfig eth0 | grep -E "dropped|collisions"               RX packets:466065257 errors:0 dropped:0 overruns:0 frame:0               TX packets:252751047 errors:0 dropped:0 overruns:0 carrier:0               collisions:0 txqueuelen:1000     [mpenning@uglylogger net]$      `ethtool -S eth0|grep -vw 0`...               [mpenning@uglylogger net]$ sudo ethtool -S eth0|grep -vw 0     NIC statistics:          rx_packets: 5206242266          tx_packets: 255859804          rx_bytes: 1205016281115          tx_bytes: 180592917566          rx_broadcast: 15001736          tx_broadcast: 2648          rx_multicast: 7518499          tx_multicast: 50236          multicast: 7518499          rx_no_buffer_count: 103          tx_restart_queue: 1          tx_tcp_seg_good: 10107428          rx_long_byte_count: 1205016281115          rx_csum_offload_good: 5189768707          rx_csum_offload_errors: 5     [mpenning@uglylogger net]$      `lspci`...               [mpenning@uglylogger net]$ sudo lspci     00:00.0 Host bridge: Intel Corporation E7501 Memory Controller Hub (rev 01)     00:00.1 Unassigned class [ff00]: Intel Corporation E7500/E7501 Host RASUM Controller (rev 01)     00:02.0 PCI bridge: Intel Corporation E7500/E7501 Hub Interface B PCI-to-PCI Bridge (rev 01)     00:03.0 PCI bridge: Intel Corporation E7500/E7501 Hub Interface C PCI-to-PCI Bridge (rev 01)     00:1d.0 USB controller: Intel Corporation 82801CA/CAM USB Controller #1 (rev 02)     00:1d.1 USB controller: Intel Corporation 82801CA/CAM USB Controller #2 (rev 02)     00:1d.2 USB controller: Intel Corporation 82801CA/CAM USB Controller #3 (rev 02)     00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 42)     00:1f.0 ISA bridge: Intel Corporation 82801CA LPC Interface Controller (rev 02)     00:1f.1 IDE interface: Intel Corporation 82801CA Ultra ATA Storage Controller (rev 02)     00:1f.3 SMBus: Intel Corporation 82801CA/CAM SMBus Controller (rev 02)     01:1c.0 PIC: Intel Corporation 82870P2 P64H2 I/OxAPIC (rev 04)     01:1d.0 PCI bridge: Intel Corporation 82870P2 P64H2 Hub PCI Bridge (rev 04)     01:1e.0 PIC: Intel Corporation 82870P2 P64H2 I/OxAPIC (rev 04)     01:1f.0 PCI bridge: Intel Corporation 82870P2 P64H2 Hub PCI Bridge (rev 04)     02:01.0 RAID bus controller: 3ware Inc 7xxx/8xxx-series PATA/SATA-RAID (rev 01)     03:02.0 Ethernet controller: Intel Corporation 82546EB Gigabit Ethernet Controller (Copper) (rev 01)     03:02.1 Ethernet controller: Intel Corporation 82546EB Gigabit Ethernet Controller (Copper) (rev 01)     04:1c.0 PIC: Intel Corporation 82870P2 P64H2 I/OxAPIC (rev 04)     04:1d.0 PCI bridge: Intel Corporation 82870P2 P64H2 Hub PCI Bridge (rev 04)     04:1e.0 PIC: Intel Corporation 82870P2 P64H2 I/OxAPIC (rev 04)     04:1f.0 PCI bridge: Intel Corporation 82870P2 P64H2 Hub PCI Bridge (rev 04)     05:02.0 Serial controller: 3Com Corp, Modem Division 56K FaxModem Model 5610 (rev 01)     07:01.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Rage XL (rev 27)     [mpenning@uglylogger net]$      `uname -a`...               [mpenning@uglylogger net]$ uname -a     Linux uglylogger.local 2.6.32-358.2.1.el6.i686 #1 SMP Tue Mar 12 21:42:46 UTC 2013 i686 i686 i386 GNU/Linux     [mpenning@uglylogger net]$


title: Add text to end of every line

text: I have tried a lot of commands, like this:               sed -i '' "s/$/<@string>/" txt.txt > txt2.txt      This makes txt2.txt empty, why?!?               sed 's/$/<@string>/' txt.txt > txt2.txt      This does absolutely nothing and tells me that the path `<string>` doesn't exist. So what do i do, I'm using bsd sed because I'm on OS X.


title: Proper way to deploy my service on linux

text: I have a service that I wish to deploy on a Linux server. The service will be in the form of a number of executables that are started and stopped like a service using upstart of similar. Also, the service will have a number of configuration files and resource files that it needs to access at run time. I need to have the permissions such that a "maintainer" user can upgrade the software without root permissions but a "user" can only start and stop the service. Ideally, the executables can be upgraded without touching the configuration (assuming binary compatibility). How do I structure the file system? Are there any recommendations for this?


title: How to debug whether restarts are caused by software or hardware?

text: A newly build Linux debian 2.6.32-5-amd64 #1 SMP Sun Sep 23 10:07:46 UTC 2012 x86_64 GNU/Linux server suffers numerous restarts. '`last -x`' output shows:               root     pts/0        192.168.254.11   Sat Dec 15 13:13   still logged in        runlevel (to lvl 2)   2.6.32-5-amd64   Sat Dec 15 13:10 - 13:17  (00:06)         reboot   system boot  2.6.32-5-amd64   Sat Dec 15 13:10 - 13:17  (00:06)         runlevel (to lvl 2)   2.6.32-5-amd64   Sat Dec 15 12:53 - 13:10  (00:17)         reboot   system boot  2.6.32-5-amd64   Sat Dec 15 12:53 - 13:17  (00:23)         runlevel (to lvl 2)   2.6.32-5-amd64   Sat Dec 15 12:36 - 12:53  (00:17)         reboot   system boot  2.6.32-5-amd64   Sat Dec 15 12:36 - 13:17  (00:40)         runlevel (to lvl 2)   2.6.32-5-amd64   Sat Dec 15 12:19 - 12:36  (00:17)         reboot   system boot  2.6.32-5-amd64   Sat Dec 15 12:19 - 13:17  (00:57)         root     pts/0        192.168.254.11   Sat Dec 15 12:04 - crash  (00:14)         runlevel (to lvl 2)   2.6.32-5-amd64   Sat Dec 15 12:01 - 12:19  (00:17)         reboot   system boot  2.6.32-5-amd64   Sat Dec 15 12:01 - 13:17  (01:15)         runlevel (to lvl 2)   2.6.32-5-amd64   Sat Dec 15 11:44 - 12:01  (00:17)         reboot   system boot  2.6.32-5-amd64   Sat Dec 15 11:44 - 13:17  (01:32)         root     pts/0        192.168.254.11   Sat Dec 15 11:36 - crash  (00:08)         runlevel (to lvl 2)   2.6.32-5-amd64   Sat Dec 15 11:26 - 11:44  (00:18)         reboot   system boot  2.6.32-5-amd64   Sat Dec 15 11:26 - 13:17  (01:50)         runlevel (to lvl 2)   2.6.32-5-amd64   Sat Dec 15 11:08 - 11:26  (00:17)         reboot   system boot  2.6.32-5-amd64   Sat Dec 15 11:08 - 13:17  (02:08)         runlevel (to lvl 2)   2.6.32-5-amd64   Sat Dec 15 10:51 - 11:08  (00:17)         reboot   system boot  2.6.32-5-amd64   Sat Dec 15 10:51 - 13:17  (02:25)         runlevel (to lvl 2)   2.6.32-5-amd64   Sat Dec 15 10:34 - 10:51  (00:17)         reboot   system boot  2.6.32-5-amd64   Sat Dec 15 10:34 - 13:17  (02:42)         root     pts/0        192.168.254.11   Sat Dec 15 02:41 - crash  (07:53)         runlevel (to lvl 2)   2.6.32-5-amd64   Sat Dec 15 02:32 - 10:34  (08:02)         reboot   system boot  2.6.32-5-amd64   Sat Dec 15 02:32 - 13:17  (10:45)         runlevel (to lvl 0)   2.6.32-5-amd64   Sat Dec 15 02:12 - 02:32  (00:19)      Output of '`top`' command less then 0.1 seconds before a crash/reboot occurred:               top - 15:14:04 up 16 min,  2 users,  load average: 0.00, 0.00, 0.01     Tasks: 163 total,   1 running, 162 sleeping,   0 stopped,   0 zombie     Cpu0  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st     Cpu1  :  0.0%us,  8.3%sy,  0.0%ni, 91.7%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st     Cpu2  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st     Cpu3  :  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st     Mem:   8191048k total,    87356k used,  8103692k free,     2432k buffers     Swap:        0k total,        0k used,        0k free,    20120k cached            PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                2296 root      20   0 19072 1432 1032 R    9  0.0   0:10.25 top                                                                                1 root      20   0  8356  820  684 S    0  0.0   0:00.79 init                                                                                2 root      20   0     0    0    0 S    0  0.0   0:00.00 kthreadd                                                                                3 root      RT   0     0    0    0 S    0  0.0   0:00.00 migration/0                                                                                4 root      20   0     0    0    0 S    0  0.0   0:00.03 ksoftirqd/0                                                                                5 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/0                                                                                6 root      RT   0     0    0    0 S    0  0.0   0:00.00 migration/1                                                                                7 root      20   0     0    0    0 S    0  0.0   0:00.00 ksoftirqd/1                                                                                8 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/1                                                                                9 root      RT   0     0    0    0 S    0  0.0   0:00.00 migration/2                                                                             '`Sensors`' output in minute 16 shows:               temp1:       +37.0 C  (high = +60.0 C, hyst = +55.0 C)  sensor = thermistor     temp2:       +75.0 C  (high = +95.0 C, hyst = +92.0 C)  sensor = diode     temp3:       +32.0 C  (high = +75.0 C, hyst = +70.0 C)  sensor = thermistor      **Update #2** :   * When running `top` the issue occurs often in the 16th minute of uptime.   * When having less load attached (60 instead of 74 SATA drives) to the Corsair 1050HX PSU the issue does never occur.   * Having 74 SATA drives connected, in minute 14 the "watts up?" meter all of a sudden starts measuring an increased power consumption value: 435 Watt instead of 326 Watt.   * The sudden power increase in minute 14 does also occur in other bpo.3 and bpo.4 kernel versions where storage modules are not loaded into the kernel (no /dev/sdb etc.) **Update #3** : all drives are not partitioned, not formatted and not mounted except for one boot drive. **Update #4** : the issue where Hitachi/Toshiba HDS5C drives are starting to consume more considerably - 5.34W instead of 3.5W without any read/write activity - more power after 15 minutes doesn't seem OS (Software) related because `cat /proc/diskstats | grep " sd"` returns 224 sectors read and 0 sectors written after boot, and that number stays identical when the power consumption starts spiking. The question is how to find out whether these restarts are caused by:   * Software   * Hardware (for instance a short situation kicking in the over current protection on the power supply) ?


title: Debugging without using source file in LLVM

text: LLVM debugger (`lldb`) uses a source file for debugging (e.g. for breakpoint). I want to use `lldb` without having source files, only with intermediate representation files (`.ll` files). Is it possible? If not, can I do that with `gdb` debugger? Is there another idea?


title: Checking for the existence of files against a list

text: I have a "command" text file that issues a data file download command on each line. I send the command file to bash. However, a small percentage of the downloads fail. Here is the algorithm I use to find out what's missing:   1. After downloading, I go back through the command file and check if each download file exists.   2. If the download doesn't exist, I copy the command line into a new command file.   3. I am left with a new command file for the remaining downloads. Here is the bash script I implemented the algorithm with:                 1 #!/bin/bash       2 while read line       3 do       4         for item in $line       5         do       6                 if [[ $item == *out_fname* ]]; then        7                         splitline=(${item//=/ })          8                         target_file=${splitline[1]}       9                         if [ ! -f $target_file ]; then      10                                 echo $line >> stillneed.txt      11                         fi      12                 fi      13         done      14 done < "$@"      Question: This works well, but is there a better algorithm or implementation (maybe using something other than bash)? What I did was just have bash do what a human would have to do. But it seems Unix always has a better way of doing things...


title: Live USB Stick of directory

text: I had created one file-system by following LFS. Now I want to create it's LiveCD and put it on USB-pendrive. So that, I can use whenever and wherever I want. What is the procedure to do so ? Google pointing link to distribution specific link. Is there any distribution-independent way to do so ? ( i.e. from scratch ) It will be preferable if I can add persistent storage to LiveCD


title: How can I install the `ll` command on Mac OS X?

text: I'm using Mac OS X. When I SSH into servers I find the `ll` command useful, but it's not available on my local machine. How can I install it?