jeudi 26 mars 2015

(Linux - Command) How to disable keyboard's NUMPAD (located right side of the keyboard)


Does anyone knows how to do this?


I want to disable all numpads, the ones located on the right side of the keyboard.


How can I do that? Ofcource, including how to revert it back to re-enable it too?


I have tried different stuff, like remapping:



xmodmap -e "keycode # = """


But I get an error:



xmodmap commandline1: bad keycode value


Did I do it wrong?



How to print file content *and delete printed content* from file?


In Linux bash shell, How can I print file content and delete printed content from file?


I have a program writing texts to a file repeatedly. On a Linux shell prompt, I want to print the contents of the file and then delete printed contents from the file repeatedly, to make my file size small enough.


Do we have bash command lines or combinations to do that?



Keyboard merely plugged in greatly increases kernel boot time


Specs are here. I am using a K65 RGB. I am using the ckb-git package from the AUR to provide basic input functionality.



  • With Keyboard and with driver:


Startup finished in 3.100s (firmware) + 5.648s (loader) + 31.800s (kernel) + 5.664s (userspace) = 46.213s



  • Without Keyboard and with driver:


Startup finished in 2.873s (firmware) + 5.652s (loader) + 2.395s (kernel) + 5.855s (userspace) = 16.777s



  • With Keyboard without driver:


Startup finished in 3.120s (firmware) + 5.654s (loader) + 31.735s (kernel) + 5.583s (userspace) = 46.093s



  • Without Keyboard without driver:


Startup finished in 2.879s (firmware) + 5.653s (loader) + 2.279s (kernel) + 6.008s (userspace) = 16.821s


As you can see, the pure act of having the keyboard plugged into the computer causes the kernel to boot about 30 seconds slower. This is kindof rediculous.


While the kernel is booting it just says:



starting version 218


if I dont have it plugged in. I believe this is referring to the kernel booting.


If the keyboard is plugged in, then it says:



starting version 218
[ random number] usbhid 3-2:1.1: can't add hid device: -110
worker [66] /devices/pci0000:00/0000:00:14.0/usb3/3-2 is taking a long time
[ random number about times two] usbhid 3-2:1.2: can't add hid device: -110


Then it boots to arch.


It is good to note that if I plug in the keyboard after it boots to arch, it takes about 30 seconds for the keyboard to be recognized (but I can still use my old keyboard).



How to find whether a file exists in a directory or sub-directory or not


Try to write a code which indicates whether a named file exists or not in your home directory or any of its subdirectories. Any help??



Does the inode change when renaming or moving a file?


in PHP the fileinode() functions returns the inode of a file. I was wondering if I can use it to determine if a file was renamed, moved or modified.


I did some tests and it seems the inode stays the same after rename. Is this behavior consistent? Does it work for any type of file, on any linux distribution?



2 monitors works as wide one (xorg.conf, intel+nvidia)


I have 3 monitors (1 intel + 2 nvidia). After some magic with xorg.conf they started to work, but nvidia monitors works as one wide monitor (any fullsize window half/half seperated).



Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
Screen 2 "Screen2" RightOf "Screen0"
Screen 1 "Screen1" RightOf "Screen2"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
Option "Xinerama" "on"
EndSection

Section "Device"
Identifier "Card0"
Driver "intel"
BusID "PCI:0:2:0"
EndSection

Section "Device"
Identifier "Card1"
Driver "nvidia"
BusID "PCI:1:0:0"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection

Section "Monitor"
Identifier "Monitor1"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection

Section "Monitor"
Identifier "Monitor2"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"

EndSection

Section "Screen"
Identifier "Screen1"
Device "Card1"
Monitor "Monitor1"
Option "TwinView" "0"
EndSection

Section "Screen"
Identifier "Screen2"
Device "Card1"
Monitor "Monitor2"
Option "TwinView" "0"
EndSection


I'm so sorry for my English and idiotic xorg.conf :)



Combine lines of file to string [on hold]


I am trying to have a file inputted by my script and put into a string to be put into another file.



./script.sh -u uuids.txt -s servers.txt


Each file will have a list with each value being on it's own line and where each line on each file belong together each time the string is made.



user:UUID:*:SERVER


That is an example of the string with the variables put into it.


I have the getops part right and I am able to print out the file contents correctly. I am asking for a way to add the lines one by one to the string to be added to a new line in another file.


I was thinking having awk split the lines within a loop that runs how ever many times for the lines in the files this would then save the overall string (pictured above) to a new line of a file with the >>.




I would like run remote ssh commands and have them always load server-side startup files by default. I am looking for a solution that does not require:



  • configuration by root

  • adding extra boiler plate to the command each time

  • duplicating environment variables across multiple files


I am not looking to transport local environment variables to the remote shell. I want to run a remote command using the vanilla ssh <host> <command> syntax and have it run using the same environment a remote login session would get.


Background


The below assumes bash is being used for simplicity


By default, remote ssh commands start a non-interactive, non-login shell. Quoting the man page:



If command is specified, it is executed on the remote host instead of a login shell.



You can see this more explicitly on the shell by running:



# the lack of 'i' indicates non-interactive
$ ssh localhost 'echo $-'
hBc

$ ssh localhost 'shopt login_shell'
login_shell off


But what if your remote command needs certain environment variables set? Being a non-interactive, non-login shell means neither .bash_profile or .bashrc will be sourced.


This is problematic, for example, if you're using tools like perlbrew or virtualenv and want to use your custom interpreter in the remote command:



$ which perl
/home/calid/perl5/perlbrew/perls/perl-5.20.1/bin/perl

$ ssh localhost 'which perl'
/usr/bin/perl


Solutions that do not satisfy the requirements above


Explicitly invoke a login shell in the remote command


$ ssh localhost 'bash --login -c "which perl"'


Requires extra boiler plate each time


Explicitly source your profile before the command


$ ssh localhost 'source ~/.bash_profile && which perl'


Requires extra boiler plate each time


Set environment variables in ~/.ssh/environment


Requires root to enable this functionality on the server


Duplicates environment variables already set in server startup files


Set ENV and BASH_ENV


Does not work: .bash_profile and .bashrc aren't sourced


Setting in ~/.ssh/environment works, but requires root access to enable


Preface the command with the environment variables you need


Requires extra boiler plate each time (potentially a lot)


Duplicates environment variables already set in server startup files


Related posts


http://ift.tt/1N8Y1Bc


http://ift.tt/1E0cPR3


dot file not sourced when running a command via ssh



In bash .* equals to upper directories


Someone of our team wanted to recursively change the user permissions on all hidden directories in a users home directory. To do so he executed the following command:



cd /home/username
chown -R username:groupname .*


We were pretty surprised when we realized, that he actually recursively changed the permissions of all user directories in /home, because .* equals to .. as well. Would you have expected this behavior in Linux though?



Configured terminal window size does not create terminal windows of correct size


With my Xubuntu 12 with xfce I have configured a standard 80x24 window size for my terminals. But opening a window results in a smaller 79x24 window. (To me this looks like a bug - at least my former Xubuntu system did not show that behaviour -, but in case I missed something I welcome pointers.)


What can I do to get the window size I configured through my profile setting?


Additional information (in case it matters): Some additional configuration for terminal windows I have done is; activating vertical scroll bar, changing the font size to a larger font, and using a bold face font. (I think that none of that should result in a reduction of the configured dimension which is defined in units of to be displayed characters, or so I think.) And I also already looked into the configuration file ~/.config/Terminal/terminalrc (as proposed in another SE question), but there's also just the things visible that I configured by the GUI, specifically the 80x24 setting.)


(In case it's a bug I'd also welcome hints for alternatives.)



Help me: HTTP POST Request with Curl


I want to generate a HTTP request with CURL: enter image description here


The purpose is that, I could make such request without need to "acctually click on a webpage".








enter image description here


Do you guys think this is correct?


curl --data "GENERATE_SNAPSHOT=Generate Snapshot" http://ift.tt/1yfM2Jh



Binder warned not to be used outside Android


I am reading an article from lwn and it mentions the following:



Binder has a number of serious security issues when used outside of an Android environment, he said, so he stressed that it should never be used by other Linux-based systems.



Does anyone know which issues this author is referring to ?



What is the meaning of read -r ?


in order to understand another answer:



find / -type d -print0 | while read -r -d ''; do ls -ltr "$dir" | sed '$!d'


the first step is to understand the usage of the option -r of the read command.


First, I thought, it would be sufficient to simply execute



man read


to lookup the meaning of the -r option , but I realized the man page does not contain any explanation for option at all, so I googled for it got some read -t , read -p examples but no read -r .



Encrypted FileSystem in VirtualBox


I'm looking for any information regarding how secure an encrypted Linux file system is when contained in a VirtualBox virtual drive on a Windows host? Specifically I'm looking for answers to the following questions:



  1. Does the fact it is hosted as a guest system expose the encrypted data to any new attack vectors?

  2. Aside from the threat of key loggers on the Host OS, malware etc., when the virtual machine is turned on is there the threat of a rogue host process accessing the virtual machine's file system on the fly?

  3. When both the Host and Guest OSes are turned off and the data is at rest on a storage device, is it any easier/harder to retrieve the encrypted file system?



Porting Binder IPC to Linux


Android provides a device driver based IPC mechanism called Binder. I see it as one of the staging drivers in Linux. Although I can have a linux kernel running with this device driver, if I want to use it for IPC between applications in my desktop Linux, what other steps do I need to complete ?


Any reference would be helpful.



Dynamic linking of library to another process using C Program


Lets say I have two process A and B.I have a library called libsample.so. The question is, Can I load libsample.so dynamically to process B using Process A. If I can , How can I do it?



Check for hardware damage (GPU)


I need to check for damage to my graphics card. I suspect I have done damage to my gpu through overclocking. Now, whenever I do anything graphically intensive my screen will flash various colours and then turn off. The system is also then unresponsive.


Here you can find the Dmesg and Xorg logs after such an event.


My question is, what should I be looking for in the system logs to confirm this? Also are there other tools that can give me more diagnostic information about the hardware?



chown .bash_aliases


I need to append would be aliases to the .bash_aliases file through the echo command


For example I echoed this command echo 'cp -r .git ls | grep -v .gitignore ~/env/' >> ~/.bash_aliases to the .bash_aliases file and later created the alias alias uu=cp -r .git ls | grep -v .gitignore ~/env/ (note escape characters missing)


I was not able to echo onto the .bash_aliases file until I made the below permission changes:



sudo chmod 660 .bash_aliases
chown tech-ministry:tech-ministry .bash_aliases


The resulting permission changes:



-rw-r----- 1 tech-ministry tech-ministry 231 Mar 26 02:05 .bash_aliases


Previously the file was owned by root and I was unable to echo onto the .bash_aliases file as I was told I did not have sufficient privileges. I even tried with the sudo command, but I was still unable to append. Thus I changed permissions as stated.


Now whenever I open a terminal shell I see this:



bash: alias: -r: not found
bash: alias: .git: not found
bash: alias: 2my_comp.sh: not found
bash: alias: cron_vs_sudo.txt: not found
bash: alias: cust_packages.txt: not found
bash: alias: Desktop: not found
bash: alias: Documents: not found
bash: alias: Downloads: not found
bash: alias: env: not found
bash: alias: examples.desktop: not found
bash: alias: morning-ravine-7736: not found
bash: alias: Music: not found
bash: alias: my_computer.sh: not found
bash: alias: pack_me_in: not found
bash: alias: Pictures: not found
bash: alias: Public: not found
bash: alias: skype-install.deb: not found
bash: alias: Templates: not found
bash: alias: Videos: not found


I used chown to revise the permissions back to root:root and I sourced the file, but I still see the above 'bash: alias:' dump every time I open a terminal shell.


What have I done and how could I repair? Does the .bash_aliases file NEED to be root?



How to make backticks accept variables as variables?


In my bash script I have the following line


[backtick]mosquitto_pub -t '/$location/[backtick]


With this I want to 'publish' to the MQTT stream. The publishing part works great but it takes the variable name $location literally, and doesn't substitute $location with the initialized value for like NYC,Paris or Tokyo.


Q: How can make it so that the assigned value/string gets substituted to $location when the code is executed



Several hard-links with different metadata in Linux using Ext4


Is it possible for Ext4 file systems (or maybe another one understood by Linux) to assign different metadata (like modification time, owner, access rights) to several hard-links that refer to the same data. (I know that for the size this is impossible, of course).


Rationale: I want to create a simple de-duplicated archive. It can (and often will) happen, that files contain precisely the same data, but the metadata differ. My idea was to create a hard-link per file and then set the metadata accordingly. But changing one hard-link seems to also change the others. (Or maybe there's another solution to my problem?)



Why are files and directories colored in different ways? [duplicate]



This question already has an answer here:




On Ubuntu 14.04, in bash under gnome terminal, Why are files especially directories colored in different ways?


enter image description here


The green colors hide the text to me (How about to you?). Is it done by terminal or bash? Is it a design for some purpose?


Can we change the color that hide the text?



Increase the number of lines scrolled by a mouse wheel tick, everywhere


When I use the mouse wheel, I want to be able to configure it to scroll by multiple lines at a time, e.g. each tick would scroll 5 lines. In Windows you can increase or decrease the number of lines scrolled with the mouse wheel. As far as I know this is also possible in OSX. This is a OS setting that changes it for each application. I want the same thing under Linux.


In Chrome, I increase the number of lines scroller per wheel tick with an add-on, but I do not want to find a add-on for each application I use. I want a global solution.


I've tried imwheel but it's a hack that removes other functionality. For example, with Sublime, the imwheel solution changes the working of the scroll wheel completely.


Why has this not been a default feature in Linux? I've been looking for this for over 10 years.



How to set the core dump file location (and name)?


I am on CentOS 6, trying to enable core dumps for an application I am developing. I have put:



ulimit -H -c unlimited >/dev/null
ulimit -S -c unlimited >/dev/null


in to my bash profile, but a core dump still did not generate (in a new terminal).


I have also changed my /etc/security/limits.conf so that the soft limits is zero for all users.


How do I set the location of the core files to be output? I wanted to specify the location and append the time the dump was generated, as part of the file name?



How could we allow non-root users to control a system.d service?


With sysvinit, a sudoers entry like this would suffice:



%webteam cms051=/sbin/service httpd *


This would allow for commands such as:



  • sudo service httpd status

  • sudo service httpd restart


Now, with systemd, the service name is the final argument. I.e., the service restart would be done with:



systemctl restart httpd.service


Naturally, I thought defining the command as systemctl * httpd.service would work but that would allow something like systemctl restart puppet.service httpd.service which is not the desired effect.


With that being considered, what would be the best way allow non-root users to control a system.d service then? This doesn't need to be sudoers; perhaps a file permission change may be sufficient?



find and grep pipeline returning nothing


I have files named lect1.txt, lect2.doc, and lect3.doc.


I want to get a file which is a .txt file, and contains lect as the filename.


I tried



find *.txt | grep lect*


and it returned nothing.


but when I did



find *.txt | grep "lect*"


it returned lect1.txt.


What's the difference between these two expressions?



How to remove duplicate files using bash


I have a folder with duplicate (by md5sum (md5 on a Mac)) files, and I want to have a job scheduled to remove any found.


However, I'm stuck on how to do this. What I have so far:



md5 -r * | sort


Which outputs something like this:



04c5d52b7acdfbecd5f3bdd8a39bf8fb gordondam_en-au11915031300_1366x768.jpg
1e88c6899920d2c192897c886e764fc2 fortbourtange_zh-cn9788197909_1366x768.jpg
266ea304b15bf4a5650f95cf385b16de nebraskasupercell_fr-fr11286079811_1366x768.jpg
324735b755c40d332213899fa545c463 grossescheidegg_en-us10868142387_1366x768.jpg
3993028fcea692328e097de50b26f540 Soyuz Spacecraft Rolled Out For Launch of One Year Crew.png
677bcd6006a305f4601bfb27699403b0 lechaustria_zh-cn7190263094_1366x768.jpg
80d03451b88ec29bff7d48f292a25ce6 ontariosunrise_en-ca10284703762_1366x768.jpg
b6d9d24531bc62d2a26244d24624c4b1 manateeday_row10617199289_1366x768.jpg
ca1486dbdb31ef6af83e5a40809ec561 Grueling Coursework.jpg
cdf26393577ac2a61b6ce85d22daed24 Star trails over Mauna Kea.jpg
dc3ad6658d8f8155c74054991910f39c smoocave_en-au10358472670_1366x768.jpg
dc3ad6658d8f8155c74054991910f39c smoocave_en-au10358472670_1366x7682.jpg


How can I process based on the MD5 of the file to remove duplicates? I don't really care which "original" I keep - but I only want to keep one.


Should I be approaching this in a different manner?



How to convert all odt files in a folder into microsoft word files ?


I have a folder with a lot of odt files from LibreOffice, I could open each one by hand and save it as a microsoft word file, but that would take a long time, is it possible to reach this goal using the command line ?



Which format in office libre writer to choose in order to omit problems when opening in word on windows ?


I have written a document in Libre Office Writer, it is crucial to me to keep the documents format. Now I am clueless in which format to save it, since there is a plethora of options, even different formats for windows.



ls or find option to exclude binary files


How can I list only files that aren't compiled code in the current directory?


I'm reviewing the custom scripts and code on several HPUX and Linux servers before transferring them to a newer system. I get tired of seeing PuTTYPuTTYPuTTYPuTTYPuTTY when I encounter a file that is compiled.


I would like to sort them so that I can skip over the compiled software and come back to them at a later time.



What is a hotplug event from the interface?


According to Debian Network setup document allow-hotplug <interface_name> stanza in /etc/network/interfaces file starts an interface when the kernel detects a hotplug event from the interface. What is this hotplug event?



Linux environment variable using non-fullpath


I'm setting the environment variable LD_PRELOAD to a shared library file I created, in order to let LD_PRELOAD to point to my created shared library file, I need to give the full path like this:



export LD_PRELOAD=full/path/to/file.so


but if I point the LD_PRELOAD to a shared library under /usr/lib/, I don't need to give the full path, I don't have root privilege so I cannot put my shared library file to /usr/lib/, in such case, how can I set the environment variable LD_PRELOAD using non-fullpath like this:



export LD_PRELOAD=file.so


Yellow appears as brown in konsole


For some reason, the yellow color color (ANSI Esc. code 33), appears for normal fonts as orange/brownish in my terminal (yakuake, konsole). For example, the command echo -e "\\033[33mhello world\\033[0m" returns an orange/brownish text hello world. Bold yellow, however, appears as expected. In the following, small, sccreenshot, the hostname is on top of a yellow background, which is the escape code \e[43m.


<code>echo -e</code> examples in the terminal


Another example, is the output of the command terminal-colors -o. It gives the output as seen in the larger screenshot below.


<code>terminal-colors -o</code>


I work with Funtoo-Linux and KDE. Though I have set some transparency (23%) I don't think this is a misleading of the eye issue. How can I troubleshoot this?


Relevant details




  • In Funtoo, the default bashrc, under /etc/bash/, contains:



    38:# Set colorful PS1 only on colorful terminals.
    63: PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\]'
    65: PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '



  • echo $TERM returns xterm-256color




  • echo $PS1 is set to



    \[\e[0;30m\e[45m\] \u \[\e[0;35m\e[43m\] \[\e[0;30m\e[43m\]@\H \[\e[0;33m\]\[\e[0;32m\] \w\a\[\e[0;32m\] → \[\e[0m\]


  • the font used is irrelevant, as I have tried various ones


  • if useful, dircolors returns:



    LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.pdf=00;32:*.ps=00;32:*.txt=00;32:*.patch=00;32:*.diff=00;32:*.log=00;32:*.tex=00;32:*.doc=00;32:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:';


    export LS_COLORS




  • strangely, there is a table in the post BASH Shell: Change The Color of My Shell Prompt Under Linux or UNIX, which describes the color code 0;33 as Brown!





can we get sorted grep output


I have same: 1.txt with apple written in it, 2.txt with mango written in it, 3.txt with apple written in it, 4.txt with mango written in it.


grep -e apple -e mango *.txt will give result as:



1.txt: apple
2.txt: mango
3.txt: apple
4.txt: mango


But I need output as:



1.txt: apple
3.txt: apple
2.txt: mango
4.txt: mango


Is it possible with just grep command ? -- without using any other command like sort or so



Store stdout and stderr in file, then recreate the output later


I've redirected output to a file like so:



$ ./test.bash 2> >(sed 's/^/stderr: /' >> output) > >(sed 's/^/stdout: /' >> output)
$ cat output
stdout: Hello World!
stderr: error


I would like to precisely reproduce the output of the original command ./test.bash. This is what I tried:



$ cat output | tee >(grep '^stdout: '|sed 's/^stdout: //') >(grep '^stderr: '|sed 's/^stderr: //' 1>&2) >/dev/null 2>&1 | cat
error
Hello World!


Obviously, I would like the output to be in the right order. What is the best way to go about doing this?



How to remotely send a keypress to an X11 application?


I've got an X11 program (Mathematica/Linux) running which contains unsaved data (calculated after I left; unfortunately I didn't have the foresight to programmatically save the data). Now I've gotten an email that the power will be switched off, unfortunately before I'm back. Therefore I want to save the data, which I could do by simply sending a Ctrl-S to the right window (I know how to find the window ID). Unfortunately there's no xdotool or autokey installed, and I don't have root rights to install one of them. So is there a way to do it?


Of course one way would be to write a C program to do it (since the functionality must be there, or those other programs couldn't work), but I've never written anything for X11, so I don't think I'll get it written in time ...


I've got access to the machine with ssh, and can access the display (I can do a screenshot - which shows the lock screen - and I can obtain a window list using xwininfo). So all I need is a way to send a single Ctrl-S to a specific window without previously installing something.



PXE Boot iSCSI wait time


I am deploying a single Laptop via PXE boot over a wired network.


It runs perfectly, DHCP connects, TFTP finds and loads config data, scsi sends over the boot partition. Then it pauses for a minute


Looking at the dmesg logs, there is a 62 second gap before the scsi initiator starts to try to load the root partition. This happens every time. The other scsi-ahci connections have started up fine, but the iscsi initiator just hangs. Looking at tcpdump, there is no communication during this period.


What is going on here? Can I remove this waiting period?


The host server is running RHEL Server 7, and it the only other thing on the network besides the laptop (literally a single copper cable).



Error: Syntax error: "(" unexpected (expecting "done")


This is my code,



#!/bin/sh

condition_while_one=true

while $condition_while_one
do
first_awk_variables=`tail -n1 /my/file/start_up_job/some_csv_file.csv | awk -F, '{print $3, $4, $5, $7, $10 }'`
first_awk_variables_value_array=($first_awk_variables) #turns contents of 'first_awk_variables' into an array 'first_awk_variables_value_array'
done #


I get the following error Syntax error: "(" unexpected (expecting "done")


What am I doing wrong?



What happens if I pass too few parameters to a shell function?


I would like to ask about passing parameters into functions. I tried this:



function_name $var1 $var2


but usually (sometimes it printed error) it didn't make any difference whether I passed them or not. I mean it perfectly worked when I called it only with function_name. So my question is: Is it necessary to give there these parameters like in example above?



tar unused files then delete them


I have folder with subfolders and sessions logs. I need some commands or script to tar this folder without usage files and then delete it. I have this construction, but I'm not sure if this leave files with handling.



tar -zcvf /srv/log/prod/dms/espis/documentum/log/00029392-$(date +%F).tar /srv/log/prod/dms/espis/documentum/log/0002939
cd /srv/log/prod/dms/espis/documentum/log/00029396
rm -R *


Any ideas?



How to setup the quota for NIS user


I have 3 VM's and configured NIS server one VM, user account created for client access also done. NIS client configured remaining two VM's. I am able to login through what I created username in NIS server side.


Now I want to allocate the quota for that nis user. How to allocate quota



Command substitutions vs backslash escapes in a quoted string


Consider a double-quoted command substitution with backslash escapes inside it, like this:



echo "$(echo '\\')"


It prints out \\, whereas I would have expected it to print out only one backslash. My thinking (which is incorrect) was that it went through the whole string, replacing all backslash escapes, and then it would do the command substitution. Evidently, the order is opposite.


However, if we do



echo "$(echo '\')$"


it prints out \$. I would've expected that if it's doing the command substitutions first and then evaluating that string's backslash escapes, that the \ and the $ might combine to make a single $ in the end. But it doesn't.


Where do backslash escapes fit into the order of things?


(The context for this question is that I'm working on something that will properly escape regex characters in a string for insertion into a sed command.)



Roots Directory in OSX


What is stored in root's home directory on OSX? What happens if you delete it on accident?


Heres whats in my current root home folder.



OSX:~ root# ls -lash
total 8
0 drwxr-x--- 5 root wheel 170B Nov 14 03:40 .
0 drwxr-xr-x 25 root wheel 850B Nov 14 11:42 ..
8 -rw-r--r-- 1 root wheel 3B Nov 14 03:40 .CFUserTextEncoding
0 -r--r--r-- 1 root wheel 10B Jun 28 2014 .forward
0 drwx------ 10 root wheel 340B Mar 21 10:13 Library


Heres whats in the Library



OSX:~ root# ls -lash Library
total 0
0 drwx------ 10 root wheel 340B Mar 21 10:13 .
0 drwxr-x--- 5 root wheel 170B Nov 14 03:40 ..
0 -r--r--r-- 1 root wheel 0B Aug 24 2013 .localized
0 drwx------+ 3 root wheel 102B Dec 11 16:22 Application Support
0 drwxr-xr-x 11 root wheel 374B Dec 11 16:21 Caches
0 drwxr-xr-x 3 root wheel 102B Mar 21 10:14 Cookies
0 drwxr-xr-x 3 root wheel 102B Nov 14 03:43 Dictionaries
0 drwx------ 3 root wheel 102B Mar 21 10:13 Logs
0 drwx------ 24 root wheel 816B Mar 26 15:13 Preferences
0 drwx------ 2 root wheel 68B Nov 14 11:34 Saved Application State


How to list only the last line of each directory?


I learned thanks to you, how to display only the last line of a listing,e.g.



ls -ltr | sed '$!d'


Now I thought, how to combine it with the find command, in order to repeat this onto each directory exitent, but I got only to a false solution:



find / -type d | xargs ls -ltr | sed '$!d'


If i read it right, this would not display the last line of each directory, but only the last line of all listings of all directories.


How to do it right ?



How can I do an rsync that asks for a confirmation for each individual file?


I have a small number of files to sync from one server to another, however there are some files I want to exclude from being synced.


I'd rather not have to add them to a --exclude pattern if I can just confirm for each file instead. Is it possible to get a prompt for each file saying something like "Sync this file? (y/N)"



How to display only the last line of a listing ?


Supposed I make a listing and sort the files by its temporal attribute:



ls -ltr

-rwxrwxrwx 1 bla bla 4096 Feb 01 20:10 foo1
-rwxrwxrwx 1 bla bla 4096 Feb 01 20:12 foo2
.
.
.
-rwxrwxrwx 1 bla bla 4096 Mar 05 13:25 foo1000


What should I add behind the ls -ltr in a pipe chain in order to obtain only the last line of the listing ? I know there are sed and awk, but I do not know how to use them, I only know what they can do.



CSV Units Conversion


I've got a CSV file that looks like the following:



miami,20,in
lansing,2,cm
austin,3,mm
chicago,5,miles
phoenix,2,feet


The first field is the name, the next field is the numeric value and the third field indicates the units. I've listed all the units that my dataset currently has however it is not limited to these as I expect the dataset to change and require different units of measurement over time.


I want to be able to process this CSV file in a script so that all my values are converted to one common unit, inches, and are listed alongside the name. So it should look something like this:



miami,20
lansing,0.78740157
austin,0.11811024
chicago,316800
phoenix,24


I've figured out that there's a unit conversion tool units which is precisely what I'm looking for to use to convert my units as my data contains a mixture of metric and imperial units.


For example, if I wanted to convert my last line of data into inches I would do this



units 2cm in -t


Which would give me



0.78740157


What I'm currently seeking help on is how to go about using this command in a script and outputting it in the format I described (2nd code block). The CSV data is currently stored in a variable called $citydata in a bash script. It is currently a string.


​​​



Is it possible to make a key word search of all existing channels of all the irc networks from the command line ?


I am new to IRC (internet relay chat), as I understand it, an IRC network has a unique name like DALnet, is made of a chain of servers, a person can connect to one of them in order to connect to the whole IRC network, one of the servers is not connected to people but to bots of whom each one provides a service like keeping memory of a nickname, another bot provides a service which enables creating channels. There are many of this IRC networks, each has an own name and slightly different rules.


enter image description here


Now is it possible to go through each channel that exists in all irc networks and search for a certain keyword , like "ancient Chinese ghost stories" or one without spaces?



Debian installation


I have a Toshiba Satellite S50-B-131 and I would like to know if I will have problems with my wifi driver if I install Debian. Thanks in advance.



how to create custom shortcuts for scrot and gnome-screenshot interactive mode


I want to add command scrot -s as custom shortcuts via gnome-control-center keyboard. The accelerator key was Super+S.


enter image description here


but it didn't works.


If i remove -s or try other interactive command like xkill, they works fine.


Also, scrot -e 'mv $f ~/Pictures/scrot/' is works fine too.


So my question, why scrot -s didn't work and how can i fix it.


My distro is fedora 21, gnome version is 3.14.2, and scrot version 0.8


[UPDATE] gnome-screenshot -a is failed too.


[UPDATE 2] The default shortcut "Save a screenshot of an area to Pictures" is working fine, but i'm still curious why it didn't work when i set it to custom shortcuts. enter image description here


[UPDATE 3] The following is the error log results from custom shortcut command strace -v -s 1000000 -o /tmp/gnomescr.log gnome-screenshot -a:



$ grep -ni CRITICAL /tmp/gnomescr.log
2660:write(2, "\n(gnome-screenshot:8700): Gdk-CRITICAL **: gdk_pixbuf_get_from_surface: assertion 'width > 0 && height > 0' failed\n", 115) = 115
2686:write(2, "\n(gnome-screenshot:8700): Gtk-CRITICAL **: gtk_window_resize: assertion 'width > 0' failed\n", 91) = 91
2748:write(2, "\n** (gnome-screenshot:8700): CRITICAL **: Unable to capture a screenshot of any window\n", 87) = 87
$


Why won't my python scripts run without the python command when moved from Windows to Linux?


I have some Python files that I wrote on my Windows PC and then sent over to a Linux machine using pscp. They work as intended on Windows, but when I try to execute them on the Linux machine, I always get an error message.


I use the following process to run the code after importing the file "test.py":


First, I add the shebang line at the top of test.py:



#!/usr/bin/python

# rest of code


Then I modify permissions and try to run the script:



chmod +x test.py
./test.py


which gives me the error message



./test.py: Command not found.


If I create a file from scratch on the Linux machine and type in the exact same program text, the program will run just fine. Also, if I type the following code, the program runs just fine:



python test.py


Can anyone explain what is happening here? Thanks.



How to image certain portions of hard drive only


I have a failed hard drive which I need to extract data from. My dd kung fu is failing me right now. I know that the drive is failing at sector 60515007 to 60517093 (512b per sector), and multiple other locations. and I need to skip that area. How do I do it in dd? And I need to compress it on the fly (piping maybe?). Can you recommend a good compression algorithm for that?



Linux Mint: "Move to monitor 2": but I don't have a second monitor. How do I fix this?


I have a fresh install (about a week old) of Linux Mint 17.1 Rebecca (love the name!), Cinnamon edition on my laptop.


If I right click on a tab, I get the option "Move to monitor 2". The problem is that I don't have a monitor 2. Here's a screenshot.


Screenshot of "Move to monitor 2"


Also oddly, if I take a screenshot, it shows two screens (one I'm unable to access). See below:


A full screenshot



Q: How do I fix this? I only want one monitor (the laptop monitor).



There doesn't seem to be anything relevant in System Settings. I'm a new user (after switching from Ubuntu), so I might be missing something obvious.



Make /less/ not exit on G command


I am currently migrating an application from Solaris to Linux. Most of the time I am happy with the change, but using LESS command became a real pain.


I have managed to make LESS keep an output to the console by using:



less -X <file>


command. But when I use G (shift + g) command to scroll to the end of the file, less does the scroll and quits to the console immediately. How to prevent that?



Skype/Spotify Installation Error: Cannot Install libssl1.0.0:i386


OpenSLL has been giving me a lot of gripe lately with some pieces of software such as spotify and skype. I include both apps because I think it's the same issue causing both to stop installing, although the error log is somewhat different in both.


Spotify:



The following packages have unmet dependencies:
spotify-client : Depends: libnss3-1d but it is not going to be installed
Recommends: libavcodec53 but it is not installable or
libavcodec52 but it is not installable or
libavcodec-extra-53 but it is not installable or
libavcodec-extra-52 but it is not installable
Recommends: libavformat53 but it is not installable or
libavformat52 but it is not installable or
libavformat-extra-53 but it is not installable or
libavformat-extra-52 but it is not installable

Skype:



The following packages have unmet dependencies:
skype-bin:i386 : Depends: libssl1.0.0:i386 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Doing my own research the solution I found to the broken packages issue was to use 'sudo apt-get -f install' but that just returns:



Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Any help is greatly appreciated as this is kinda a last resort after trying solutions to similar problems for a number of hours.



Several hard-links with different metadata in Linux using Ext4


Is it possible for Ext4 file systems (or maybe another one understood by Linux) to assign different metadata (like modification time, owner, access rights) to several hard-links that refer to the same data. (I know that for the size this is impossible, of course).


Rationale: I want to create a simple de-duplicated archive. It can (and often will) happen, that files contain precisely the same data, but the metadata differ. My idea was to create a hard-link per file and then set the metadata accordingly. But changing one hard-link seems to also change the others. (Or maybe there's another solution to my problem?)



How can I identify if a binary file is set-user-ID?


In Linux, how can I identify if a binary file is set-user-ID?


Can I use ls -l?



XML Microsoft Word Document


I have a .xml file generated by someone with MS Word and I cannot manage to open it with LibreOffice or other app or change its format.


I tried to save a LibreOffice document as "Word 2003 xml" and able to reopened it later, so I think it might be created with Word 2007+ and seems LibreOffice cannot open it.


I reproduce first xml tag:



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?mso-application progid="Word.Document"?>
<w:wordDocument xmlns:aml="http://ift.tt/1nItFeN"
xmlns:wpc="http://ift.tt/JiuBoL"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:mc="http://ift.tt/pzd6Lm"
xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:w10="urn:schemas-microsoft-com:office:word"
xmlns:w="http://ift.tt/SWWr8G"
xmlns:wx="http://ift.tt/1iw9Noq"
xmlns:wne="http://ift.tt/JiuB8g"
xmlns:wsp="http://ift.tt/1p0MYio"
xmlns:sl="http://ift.tt/1p0MYiq"
w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no"
xml:space="preserve">


Write text on last line of document


If I have this document

aaa

bbb

ccc


And I want to add " ddd" on the last line. My document should look like this:

aaa

bbb

ccc ddd


How can I do this? If I prefer awk or sed but i'm open to your proposals. Thanks



tar not use files and delete it


I have folder with subfolders and sessions logs. I need some commands or script to tar this folder without usage files and then delete it. I have this construction, but I'm not sure if this leave files with handling.



tar -zcvf /srv/log/prod/dms/espis/documentum/log/00029392-$(date +%F).tar /srv/log/prod/dms/espis/documentum/log/0002939
cd /srv/log/pred/klid/espis/documentum/log/00029396
rm -R *


Any ideas?


Thanks Michell



mercredi 25 mars 2015

grep command with pipes, how to implement in script?


I'm new to expect scripting and trying to get below script to work. The script logs in to a server and reads a config file ($val in the script) for the values of "cps" and then presents a total value, but got stuck when sending a long "grep" command which I split into 2 parts.



set cmd1 "grep -A200 \"_ims\""

set cmd2 { | grep -B3 "calledUserDescriptor" | grep "cps" | grep -v "//cps" | awk '{ SUM += $3} END { print "total sip cps = "SUM}' >> cps.txt}


The execution stops at:

exp_send "$cmd1 $val $cmd2\r" where only the 1st part ($cmd1 $val) is executed,

the 2nd part ($cmd2) sends as a separate command and fails at "|"

with message: bash: syntax error near unexpected token |'

The
grep` command works OK if executed directly on Linux.

I suppose there is an error (syntax ?) in the exp_send line but haven't

figured out how to do it in a proper way, there is for sure a better way to do it.



#!/usr/bin/expect -f
set lnk1 "Traffic_ims.cfg"
set cmd1 "grep -A200 \"_ims\""
set cmd2 { | grep -B3 "calledUserDescriptor" | grep "cps" | grep -v "//cps" | awk '{ SUM += $3} END { print "total sip cps = "SUM}' >> cps.txt}

set file1 "/tmp/cps.txt"
set cmd3 "cd /home/traffic/"
set cmd4 "readlink"
set passwd "xxxxx"
log_user 1
spawn rm -rf $file1
spawn ssh user@192.24.135.166
expect {
-re ".*Are.*.*yes.*no.*" {
send "yes\n"
exp_continue
}
"*?assword:*" {
send $passwd
send "\n"
}
}
expect "*\$ "
exp_send "$cmd3\r"
expect "$cmd3\r"
expect -re $
exp_send "$cmd4 $lnk1\r"
expect "$cmd4 $lnk1\r"
expect -re "(Titan.*)\r"
set **val** $expect_out(0,string)

**exp_send "$cmd1 $val $cmd2\r"**

expect -re "(.*)\r"
set output [open "/tmp/cps.txt" "a+"]
set outcome $expect_out(buffer)
send "\r"
puts $output $outcome
close $output

exp_send "exit \r"
exit 0


Problems in using GRUB2 - Manjaro


I hope you are well!


I use Manjaro x64_86, using GRUB2 and EFI.


I made a large error after coming home from a night shift. I accidentally removed my boot partition when attempting to format an external hard drive for my girlfriend. I followed instructions from the Manjaro wiki to reinstall grub.


Some steps are confusing, specifically at the start it asks you to mount your boot partition to /mnt/boot:


mount /dev/sda1 /mnt/boot


Then later in the EFI section, it asks you to mount the boot partition to /boot/efi:


sudo mount /dev/sda1 /boot/efi


I wonder if this has contributed.


I happily updated grub using update-grub, without any major hitches:


sudo update-grub


Unfortunately whenever I need to update grub, it does not work. It appears that my computer is using /boot/efi/grub/grub.cfg rather than the /boot/grub/grub.cfg that is automatically updated when I update my kernel/run the update-grub command from inside my currently running Manjaro install.


I have attempted to read through various wikis about GRUB2 and EFI, but each one is asking me to read more and more information. Is there any chance I can change this so it updates automatically again? I promise I'll never use gparted when I'm tired again! :)


Thank you in advance.


EDIT: Specifically my problem now is that when I use sudo update-grub, it only changes


/boot/efi/grub/grub.cfg


and when I turn on my pc and grub loads, it appears to be using


/boot/grub/grub.cfg


instead, which isn't being updated.



Can I re-login a disconnected session?


For some network reasons, my previous SSH sessions to server have disconnected. When I create a new session, I find the previous session still exist:



[root@localhost ~]# who
root pts/0 2015-03-25 21:35 (10.1.1.1)
root pts/1 2015-03-25 21:36 (10.1.1.1)
root pts/2 2015-03-26 01:44 (10.1.1.1)


The pts/0 and pts/1 are previous session terminals. And there are still some progresses running on them, such as vim:



root 2953 2906 0 Mar25 pts/0 00:00:01 vim getpasswd.sh


I want to re-login pts/0 to continue running vim progress, Is it possible? How can I do it?



Find result used in if statement


How can I use the result of a find command in an if statement and compare with true or false?


Something like this:



if [ `find . -name test.txt -size 156c`="true" ]; then echo Found; fi


This is the whole script:



1 #!/bin/bash
2 if [ $# -ne 2 ]
3 then
4 echo Not enough params
5
6 fi
7
8 if [ `find . -name $1 -size $2c | grep -q .` -eq 0 ]
9 then
10 echo OK
11 fi


Impossible to browse web after configuring iptables


I'm trying to configure iptables on my ubuntu computer. These are my rules:



Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:domain
ACCEPT tcp -- anywhere anywhere tcp dpt:ftps-data
ACCEPT tcp -- anywhere anywhere tcp dpt:ftps

Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:domain

Chain OUTPUT (policy ACCEPT)
target prot opt source destination


Unfortunately, when I try to use the web explorer, it can not connect. Just a blank page continuously trying to load. I tried sending a ping to www.google.com, but the connection can not be established. Maybe should I leave more ports open?


Thank you very much for you help!!!



sound not working in Ubuntu 14-04: suddenly stopped


The sound suddenly stopped working in my Ubuntu, so I googled and followed this link but it doesn’t work to me.


Output of aplay -l:



**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC662 rev1 Analog[ALC662 rev1 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC662 rev1 Digital [ALC662 rev1 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0


Output of cat /proc/asound/version:



Advanced Linux Sound Architecture Driver Version k3.13.0-24-generic.


How exactly does perl's -0 option work?


According to man perlrun:



-0[octal/hexadecimal]
specifies the input record separator ($/) as an octal or
hexadecimal number. If there are no digits, the null character is
the separator.


and



The special value 00 will cause Perl to slurp files in paragraph
mode. Any value 0400 or above will cause Perl to slurp files
whole, but by convention the value 0777 is the one normally used
for this purpose.


However, given this input file:



This is paragraph one

This is paragraph two.


I get some unexpected results:



$ perl -0ne 'print; exit' file ## \0 is used, so everything is printed
This is paragraph one.

This is paragraph two.

$ perl -00ne 'print; exit' file ## Paragraph mode, as expected
This is paragraph one.


So far, so good. Now, why do these two seem to also work in paragraph mode?



$ perl -000ne 'print; exit' file
This is paragraph one.

$ perl -0000ne 'print; exit' file
This is paragraph one.


And why is this one apparently slurping the entire file again?



$ perl -00000ne 'print; exit' file
This is paragraph one.

This is paragraph two.


Further testing shows that these all seem to work in paragraph mode:



perl -000
perl -0000
perl -000000
perl -0000000
perl -00000000


While these seem to slurp the file whole:



perl -00000
perl -000000000


I guess my problem is that I don't understand octal well enough (at all, really), I am a biologist, not a programmer. Do the latter two slurp the file whole because both 0000 and 00000000 are >= 0400? Or is there something completely different going on?



How to setup the quota for NIS user


I have 3 VM's and configured NIS server one VM, user account created for client access also done. NIS client configured remaining two VM's. I am able to login through what I created username in NIS server side.


Now I want to allocate the quota for that nis user. How to allocate quota



How to Automount a CIFS share after WiFi connects on Raspbian


I've got Raspbian running on RaspberryPi 2. I've a WIFI dongle, configured network/interfaces to automatically connect to my home network... all works great.


I've a windows share on my LAN that I want to mount on raspbian. I edited /etc/fstab file. My added line works fine when I use Ethernet cable, it automatically mounts the share on boot. However, when on WiFi it doesn't. I'm guessing it runs fstab too early before the WiFi connects.... also if I run sudo mount -a, it reads the rule from fstab and applies it just fine...


My question is, how can I get the system to automount AFTER there is an available connection? or after it acquires an IP maybe?


I looked at udev rules but I'm not sure if that's the way to go...



Difficulty converting from binary to hexadecimal using bc


I read how to calculate using the command line calculator and a HERE-document, but nevertheless I do not get what I expected and can not find my error, what I did in the shell was:



bc << HERE
>ibase=2
>obase=16
>1001
>HERE
100


I expected to get 9 as result since binary 1001 is hexadecimal 9, but I got 100.



append file with history line number values


Is there a way to append my_computer.sh with the command on line 330 by only referencing the line number? or with the fewest keystrokes possible?



326 pip install -U pip
327 man pip
328 cat >> ~/my_computer.sh
329 pip -V
330 sudo pip install virtualenv
331 ls
332 vi .gitignore
333 ll
334 virtualenv ENV
335 ll
336 vi .gitignore
337 source bin/activate
338 cd ENV/
339 source bin/activate
340 history


how to send output of curl request to 2 separate commands


I'm piping the output of a curl request to gawk so that I can pull some data. The gawk code is already working if I'm searching through the html file which curl request produces. However, I was hoping to simply edit in place, as I just need to allocate 2 date variables. I've been looking at using tee and process substitution. Is there any way to somehow fork the output of the curl request in order to assign 2 different variables, both using gawk and command substitution.


Here's a snippet of my code, I've hidden the full details of the curl request, but it is going to pull an html report which will contain: Oldest Sequence, date and Newest Sequence, date on separate lines. The gawk has already been tested on the data.



curl -k -q "https://user:password@ipaddress/report"


I want the output of the above command to be piped or otherwise to the two commands below



date1="$(date -d $(gawk '/Newest Sequence/ {print $3,$4}') +%s)"
date2="$(date -d $(gawk '/Oldest Sequence/ {print $3,$4}') +%s)"


Is this possible without creating a file? I will be running the request at frequent intervals and sending the result to a socket, I'd rather avoid unnecessary files if possible



Store stdout and stderr in file, then recreate the output later


I've redirected output to a file like so:



$ ./test.bash 2> >(sed 's/^/stderr: /' >> output) > >(sed 's/^/stdout: /' >> output)
$ cat output
stdout: Hello World!
stderr: error


I would like to precisely reproduce the output of the original command ./test.bash. This is what I tried:



$ cat output | tee >(grep '^stdout: '|sed 's/^stdout: //') >(grep '^stderr: '|sed 's/^stderr: //' 1>&2) >/dev/null 2>&1 | cat
error
Hello World!


Obviously, I would like the output to be in the right order. What is the best way to go about doing this?



How to add a dm-cache to an already existing luks setup?


I've got two physical devices, a fast SSD and a large HDD. The SSD is in VG ssd and ends up serving as mountpoint /, the HDD is in VG dump and serves as mountpoint /home. Both go through LUKS for encryption, both are formatted as ext4. I could easily spare 40gb on the SSD to serve as a cache for the HDD and I'm wondering if I can change my LV-setup without reformatting.


Is it possible to reduce the size of the root filesystem, then reduce the size of the LV, add two new LVs for cache and metadata and attach the newly created cache-pool to serve the HDD? Remind me on how to setup in such a way, that unencrypted data does not leak to the cache...



Remove paragraph from file


I have a file (file.php) like this:



...
Match user foo
ChrootDirectory /NAS/foo.info/
ForceCommand internal-sftp
AllowTcpForwarding no
GatewayPorts no
X11Forwarding no



Match user bar
ChrootDirectory /NAS/bar.co.uk/
ForceCommand internal-sftp
AllowTcpForwarding no
GatewayPorts no
X11Forwarding no



Match user baz
ChrootDirectory /NAS/baz.com/
ForceCommand internal-sftp
AllowTcpForwarding no
GatewayPorts no
X11Forwarding no


I am trying to write a bash script to delete one of the paragraphs.




So say I wanted delete the user foo from the file.php. After running the script, it would then look like this:



...
Match user bar
ChrootDirectory /NAS/bar.co.uk/
ForceCommand internal-sftp
AllowTcpForwarding no
GatewayPorts no
X11Forwarding no



Match user baz
ChrootDirectory /NAS/baz.com/
ForceCommand internal-sftp
AllowTcpForwarding no
GatewayPorts no
X11Forwarding no


How could I go about doing this. I have thought about using sed but that only seems to be appropriate for one liners?



sed -i 's/foo//g' file.php


And I couldn't do it for each individual line as most of the lines withing the paragraph are not unique! Any ideas?



Command substitutions vs backslash escapes in a quoted string


Consider a double-quoted command substitution with backslash escapes inside it, like this:



echo "$(echo '\\')"


It prints out \\, whereas I would have expected it to print out only one backslash. My thinking (which is incorrect) was that it went through the whole string, replacing all backslash escapes, and then it would do the command substitution. Evidently, the order is opposite.


However, if we do



echo "$(echo '\')$"


it prints out \$. I would've expected that if it's doing the command substitutions first and then evaluating that string's backslash escapes, that the \ and the $ might combine to make a single $ in the end. But it doesn't.


Where do backslash escapes fit into the order of things?


(The context for this question is that I'm working on something that will properly escape regex characters in a string for insertion into a sed command.)



gcc installation on CentOS 6.6: configure issue


I'm trying to build/install gcc on CentOS6.6, following this instructions:


http://ift.tt/1BNiDq7


After the auto-config err'ed out:



[felix@localhost objdir]$ /home/felix/workspace/gcc-4.8.4/configure --prefix=$HOME/gcc-4.8.4
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... no
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
checking for version 0.10 of ISL... no
checking for version 0.11 of ISL... no
checking for version 0.12 of ISL... no
checking for version 0.14 of ISL... no
checking for default BUILD_CONFIG...
checking for bison... bison -y
checking for bison... bison
checking for gm4... no
checking for gnum4... no
checking for m4... m4
checking for flex... flex
checking for flex... flex
checking for makeinfo... no
/home/felix/workspace/gcc-4.8.4/configure: line 7993: /missing: No such file or directory
checking for expect... no
checking for runtest... no
checking for ar... ar
checking for as... as
checking for dlltool... no
checking for ld... ld
checking for lipo... no
checking for nm... nm
checking for ranlib... ranlib
checking for strip... strip
checking for windres... no
checking for windmc... no
checking for objcopy... objcopy
checking for objdump... objdump
checking for readelf... readelf
checking for cc... cc
checking for c++... c++
checking for gcc... gcc
checking for gcj... no
checking for gfortran... gfortran
checking for gccgo... no
checking for ar... ar
checking for as... as
checking for dlltool... no
checking for ld... ld
checking for lipo... no
checking for nm... nm
checking for objdump... objdump
checking for ranlib... ranlib
checking for readelf... readelf
checking for strip... strip
checking for windres... no
checking for windmc... no
checking where to find the target ar... host tool
checking where to find the target as... host tool
checking where to find the target cc... host tool
checking where to find the target c++... host tool
checking where to find the target c++ for libstdc++... host tool
checking where to find the target dlltool... host tool
checking where to find the target gcc... host tool
checking where to find the target gcj... host tool
checking where to find the target gfortran... host tool
checking where to find the target gccgo... host tool
checking where to find the target ld... host tool
checking where to find the target lipo... host tool
checking where to find the target nm... host tool
checking where to find the target objdump... host tool
checking where to find the target ranlib... host tool
checking where to find the target readelf... host tool
checking where to find the target strip... host tool
checking where to find the target windres... host tool
checking where to find the target windmc... host tool
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
config.status: error: cannot find input file: `Makefile.in'

But Makefile.in is present



[felix@localhost gcc-4.8.4]$ ls Makefile.*
Makefile.def Makefile.in Makefile.tpl

Any help is much appreciated!



Switch-case block inside define keyword in a single logical line in a makefile


This is the code excerpt from ghc.mk, part of Haskell source compilation. I find it different, because the author has chosen to write one function block in a single line. Is it a common practice in writing makefiles?


And I like to put echo statements in each one of the case handles for debugging, but with the current setup, I am not able to and make interprets my echo statements as shell commands.



define installLibsTo
$(call INSTALL_DIR,$2)
for i in $1; do \
case $$i in \
*.a) \
$(call INSTALL_DATA,$(INSTALL_OPTS),$$i,$2); \
$(RANLIB_CMD) $2/`basename $$i` ;; \
*.dll) \
$(call INSTALL_PROGRAM,$(INSTALL_OPTS),$$i,$2) ; \
$(STRIP_CMD) $2/`basename $$i` ;; \
*) \
$(call INSTALL_DATA,$(INSTALL_OPTS),$$i,$2); \
esac; \
done
endef


Issues with arecord command


I'm having some mixed results with the arecord command in the terminal. The hardware I'm using consists of the Cirrus Audio Card for the Raspberry Pi. I'm trying to record a 24-bit 192kHz sound (from the onboard MIC) into a WAV file, and then play it back (through the headeset). First I make sure to enable the MIC and headset:



$ ./Record_from_DMIC.sh
$ ./Playback_to_Headset.sh


Then I tried multiple commands, and got mixed results.



$ arecord -f S24_LE -r 192 -d 20 test.wav
Recording WAVE 'test.wav' : Signed 24 bit Little Endian, Rate 192000 Hz, Mono
$ arecord: set_params:1087: Channels count non available
# So I set the number of channels to 1 (even though it is that, by default)
$ arecord -c 1 -f S24_LE -r 192 -d 20 test.wav
Recording WAVE 'test.wav' : Signed 24 bit Little Endian, Rate 192000 Hz, Mono
arecord: set_params:1087: Channels count non available


Still get the same error. I got rid of the rate (192kHz), and let it default:



$ arecord -d 10 -c 1 -f S24_LE -t wav test.wav
Recording WAVE 'test.wav' : Signed 24 bit Little Endian, Rate 8000 Hz, Mono
$ arecord: set_params:1087: Channels count non available


Still getting the same error. So I just used an example run of the command I found online (http://ift.tt/1Gpaw9M):



$ arecord -d 10 -f cd -t wav test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo


This worked. But clearly used different values than from what I wanted. I also had trouble playing at 192kHz:



$ aplay -c 1 -r 192000 test.wav
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo


I try to play at 192kHz, but it goes down to 44.1kHz. Does anyone have any idea as to why I'm getting all these weird errors and results?



Can Enlightenment be a fancy alternative to the i3 WM with same keyboard productivity?


So, the i3 WM is a great WM in productivity matter. It's primary focus is to allow users to do a lot of things without need to touch mouse:



  • easily navigate between windows, and workspaces

  • easily organize windows:

    • create container(tabs,vertical/horizontal layout)

    • move windows between containers, and to another workspace




I work mostly with applications controlled via keyboard. I use a lot of workspaces. So, things mentioned above help allows me to work much faster.


However, sometimes I work only using a mouse and I would like to have WM/DE that is also mouse-friendly.


Is it possible to setup Enlightenment that it keeps all "keyboard features" of i3 WM? (+ mouse friendliness and fancy look)



FTP: get the latest file in sever


This is really really pain in the ass. I have a ftp server running, and it irregularly generates the latest file. The file is store as:


Home->T22:30:10->new.txt, and the latest one would be (a new folder)


Home->T23:10:25->new.txt (note that this is a new folder with latest time)


I need to implement something (it could be anything, C code, bash script, etc) in a Linux machine that pull the latest file over.


I have look into two options:


Option 1. Use libcurl, pass the directory listing, and select the latest file. This is really pain in the ass and time-consuming and I still can't find a easy way to do this.


Option 2. Use lftp, at initiazation, remove all the files in the server, so that each time when I call lftp to download something, it would be the latest one. (This method is only idealization and I haven't tried in real life).


Is there any easier option?



Debian - get all dependencies updated when they 'wont be installed'


I've been trying to install Percona Toolkit onto my Debian (wheezy) server. I downloaded it as per the instructions: wget http://ift.tt/1cQaERv


then installed it sudo dpkg -i percona-toolkit.deb


But it told me there were missing dependencies that weren't installed, and wouldn't be installed.


I have been downloading these one by one, but each one seems to have a missing dependency of it's own. I've also noticed that most of these are installed, but the toolkit requires a later version. In one case the only version I could find suggested it was designed for the next release of Debian.


So far I have downloaded:



libio-socket-ssl-perl_2.002-2_all.deb
libnet-ssleay-perl_1.65-1+b1_amd64.deb
libterm-readkey-perl_2.30-4+b2_amd64.deb


and now it wants



perl (>= 5.20.0-4)
perlapi-5.20.0
libc6 (>= 2.14)


Is there an easy way to get the system to download / install all of these in one go, and is it likely to cause stability issues if I install versions higher than the default that are already installed?




UPDATE - output from apt-get -f install:



sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
libio-socket-ssl-perl libnet-ssleay-perl percona-toolkit
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 7,319 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 26051 files and directories currently installed.)
Removing percona-toolkit ...
Removing libio-socket-ssl-perl ...
Removing libnet-ssleay-perl ...
Processing triggers for man-db ...


HTTP: and how regularly click a tab on a webpage?


In one application, I could have to manually go to a webpage, and click a tab call "Generate Daily Trends" (as shown in the picture below). This would have to be clicked every 1 minute.


I am wondering, is there any way (script, or code) that can automatically "click" the tab for me, every 1 minute? (Is this called http request?). This needs to be done inside a Linux machine.


enter image description here



How to boot Android x86 iso with grub ( usb multiboot )?


I would like to add android x86 iso, I don't want to install it, to my usb multi boot, already booting:



  • Ubuntu

  • Hiren's BootCD

  • Rescue Cd

  • ...


What could be a suitable way ?



Debian..Can't format and mount external HDD


I have been trying to format my 640GB external Hard Drive in command-line and can't seem to get it working.


I have done the following in order:


sudo fdisk /dev/sda


(Deleted any partitions, created a new partition, toggled partition type (tried multiple, but not sure the best?), then wrote the partition and printed to make sure it was correct.


I then created the ext4 filesystem using: sudo mkfs.ext4 /dev/sda1


I tried to mount the partition using: sudo mount -t ext4 /dev/sda1 /mnt/640-hdd -o gid=XXXX,uid=XXXX


I then was given a mount error:



mount: wrong fs type, bad option, bad superblock on /dev/sda1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so


Any recommendations?



One-liner for getting an IP address of an internal DNS name?


I have an internal DNS name for which I'd like to get the IP address. Is there a nice Bash one-liner I can issue to convert internalip1.mydomain.com into 10.10.10.10?



Its possible use special characters in a shell function name?


I have to create the function in shell script, that function name must contain the special characters. like



>()
{
echo $1 $2
}


Here my function name is >, If its possible how can I give, Like above I tried that But it will through the error



List running processes without procfs


I'd like to list running process (like using ps or top), but there is no procfs mounted.


The procfs not being mounted is intentional, and is made to prevent malicious user to access systems informations.


Is there a way I could still list running process, or is that plain impossible ?


I'm running Linux 3.16.



Installing latest wireshark impossible?


It looks like installing a later version of wireshark is near impossible on redhat 6. I've searched the web extensively and can't find any questions where someone has said their issue was resolved. Don't care how I do it. Here's what I have tried:



yum install wireshark <-- works but version too old
yum localinstall xxx <-- works only with an rc2 of v10 and gives error
./configure <-- "Need a working C++ compiler to build Wireshark with Qt"


The first method is out as the version is too old and it does not have a ipv6 option we need.


The second method appears to install and actually work but gives me an error about a missing library when I run it. I'm also concerned about installing a release candidate. If I try the non release candidate rpm then it gives me an error about missing libraries when trying to install.


The final method gives me an error about qt but qt 4.6 is installed.


Has anyone actually got this to work? Need v1.10 at least.



EDIT: Qt libs installed:
yum list installed | grep qt
qt.x86_64 1:4.6.2-28.el6_5 @base
qt-devel.x86_64 1:4.6.2-28.el6_5 @base
qt-sqlite.x86_64 1:4.6.2-28.el6_5 @base
qt-x11.x86_64 1:4.6.2-28.el6_5 @base


EDIT: This is output from ./configure:



checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '0' is supported by ustar format... yes
checking whether GID '0' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking dependency style of g++... none
checking how to run the C preprocessor... gcc -E
checking if gcc is Clang... no
checking if g++ is Clang... no
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1966080
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for shl_load... no
checking for shl_load in -ldld... no
checking for dlopen... no
checking for dlopen in -ldl... yes
checking whether a program can dlopen itself... yes
checking whether a statically linked program can dlopen itself... yes
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking whether g++ is a C++ compiler... no
checking for perl... /usr/bin/perl
checking for python... /usr/bin/python
checking whether /usr/bin/python is Python 2.5 or later... yes
checking for bison... bison -y
checking for bison... /usr/bin/bison
checking for flex... flex
checking lex output file root... lex.yy
checking lex library... none needed
checking whether yytext is a pointer... no
checking for flex... /usr/bin/flex
checking for pod2man... /usr/bin/pod2man
checking for pod2html... /usr/bin/pod2html
checking for xdg-open... no
checking for htmlview... no
checking for doxygen... no
checking for doxygen... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for LIBGNUTLS... no
GnuTLS >= 3.1.10 not found
checking for LIBGNUTLS... no
GnuTLS >= 1.2.0, < 3.0 not found
GnuTLS with compatible license not found, disabling SSL decryption
checking for libgcrypt-config... no
checking for LIBGCRYPT - version >= 1.1.92... no
libgcrypt not found, disabling ipsec decryption
checking whether to use libnl for various network interface purposes... yes
checking for LIBNL3... no
checking for LIBNL2... no
checking for LIBNL1... no
checking if nl80211.h is new enough... yes
checking for NL80211_SET_CHANNEL... yes
checking for libsmi >= 2... not found
checking for a2x... no
checking for a2x... no
checking for elinks... no
checking for elinks... no
checking for fop... no
checking for fop... no
checking for lynx... /usr/bin/lynx
checking for lynx... yes
checking for w3m... no
checking for w3m... no
checking for xmllint... /usr/bin/xmllint
checking for xmllint... yes
checking for xsltproc... no
checking for xsltproc... no
checking for desktop-file-install... no
checking for pkgproto... no
checking for pkgmk... no
checking for pkgtrans... no
checking for rpm... yes
checking to see if we can redefine _topdir... yes
checking for dpkg-buildpackage... no
checking for xcodebuild... no
checking for hdiutil... no
checking for bless... no
checking whether the compiler fails when given an unknown warning option... yes
checking whether the compiler fails when given an warning option not supported for C++... yes
checking whether we can add -Wall -W to CFLAGS... yes
checking whether we can add -Wall -W to CXXFLAGS... no
./configure: line 22271: test: ) expected, found -W
checking whether we can add -Wextra to CFLAGS... yes
checking whether we can add -Wextra to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -Wdeclaration-after-statement to CFLAGS... yes
checking whether we can add -Wendif-labels to CFLAGS... yes
checking whether we can add -Wendif-labels to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -Wpointer-arith to CFLAGS... yes
checking whether we can add -Wpointer-arith to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -Wno-pointer-sign to CFLAGS... yes
checking whether we can add -Warray-bounds to CFLAGS... yes
checking whether we can add -Warray-bounds to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -Wformat-security to CFLAGS... yes
checking whether we can add -Wformat-security to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -fwrapv to CFLAGS... yes
checking whether we can add -fwrapv to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -fno-strict-overflow to CFLAGS... yes
checking whether we can add -fno-strict-overflow to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -fno-delete-null-pointer-checks to CFLAGS... yes
checking whether we can add -fno-delete-null-pointer-checks to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -Wold-style-definition to CFLAGS... yes
checking whether we can add -Wshorten-64-to-32 to CFLAGS... no
checking whether we can add -Wstrict-prototypes to CFLAGS... yes
checking whether we can add -Wjump-misses-init to CFLAGS... no
checking whether we can add -Wvla to CFLAGS... yes
checking whether we can add -Wvla to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -Waddress to CFLAGS... yes
checking whether we can add -Waddress to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -Wattributes to CFLAGS... yes
checking whether we can add -Wattributes to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -Wdiv-by-zero to CFLAGS... yes
checking whether we can add -Wdiv-by-zero to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -Wignored-qualifiers to CFLAGS... yes
checking whether we can add -Wignored-qualifiers to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -Wpragmas to CFLAGS... yes
checking whether we can add -Wpragmas to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -Wno-overlength-strings to CFLAGS... yes
checking whether we can add -Wno-overlength-strings to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -Wwrite-strings to CFLAGS... yes
checking whether we can add -Wwrite-strings to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -Wno-long-long to CFLAGS... yes
checking whether we can add -Wno-long-long to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -Wc++-compat to CFLAGS... yes
checking whether we can add -Wheader-guard to CFLAGS... no
checking whether we can add -Wheader-guard to CXXFLAGS... no
checking whether we can add -Wshadow to CFLAGS... yes
checking whether -Wshadow warns about variables in function declarations shadowing other variables... no
checking whether we can add -Wlogical-op to CFLAGS... yes
checking whether -Wlogical-op generates warnings from strchr()... yes
checking whether we can add -fexcess-precision=fast to CFLAGS... no
checking whether we can add -fexcess-precision=fast to CXXFLAGS... no
checking whether we can add -fvisibility=hidden to CFLAGS... yes
checking whether we can add -fvisibility=hidden to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -Wl,--as-needed to LDFLAGS... yes
checking whether we can add -fPIE to CFLAGS... yes
checking whether we can add -fPIE to CXXFLAGS... no
configure: WARNING: gcc and appear to be a mismatched pair
checking whether we can add -fPIE -pie to LDFLAGS... yes
checking whether -D_FORTIFY_SOURCE=... can be used (without generating a warning)... yes
checking whether we should treat compiler warnings as errors... no
checking for platform-specific compiler flags... none needed
checking for platform-specific linker flags... none needed
checking whether make supports nested variables... (cached) yes
checking whether to use /usr/local for headers and libraries... yes
checking for sed... (cached) /bin/sed
checking for GNU sed as first sed in PATH... yes
checking if profile builds must be generated... no
configure: error: Need a working C++ compiler to build Wireshark with Qt


I have done a yum install on gcc, bison, flex, qt4-devel and libstdc++.