I’m using Linux VPS as a web server (haproxy+nginx+java+mysql+memcached+redis+solr), for security reason, I disabled password login and using key instead. These days, I can’t login to my server, when using VPS console to login, I found some strange public key in the /root/.ssh/authroized_keys, and…
Tag: linux
Unzipping bz2 file
I have the following command to open a tbz file: The compressed file is about 15 GB and when it is expanded it is about 500GB or so. This operation on an ec2-4x-large operation takes roughly 1h40m. Is there a way to optimize this operation? What would be the fastest way to do the above operation? Answer A cou…
log text parsing in linux
I need to select a text from the log and store the field has a column to the new file. For example below is the log format Want to print the output like below i have used awk to print as column wise How to get the value using like, the id as key and inside the double quotes is
Preserve timestamp when editing file
I want to preserve the timestamp of the files I’m editing in a for loop The issue is I need to get a formatted date string from the file so that I can do touch -r to revert the files date back once the loop has completed. stat is not giving the me the format I need. Required Format: YYMMDDhhmm
How can i execute comm Linux command in Python
I want to extract lines from File1 which are not present in File2 File1 File2 so the output should be: One possible command in bash is: And it works perfectly well in bash, but I don’t know how correctly to implement in Python. I’ve tried with And is not working. Any hint? Answer If you must use a…
C segmentation fault on linux with strncmp
This works (‘Y’ must be single quotes): This gives segmentation fault: strncmp must be going off the deep end but not sure why since I’m passing a casted toupper() as (char *). Without the casting, same error. FYI user_input() is (N.B. vars are global): Thank you. Answer The return value of …
Curses snake game not removing cells in linux os
It’s code from a curses tutorial that I’ve been using to get a grasp of it but even though I’ve checked the code multiple times, it’s still not removing the old cells. The guy that wrote the code is on a mac and I’m using linux so would that be a problem? Answer The problem seems…
Use of MONO_IOMAP to cope with a hard-coded file path?
I’m trying to get a Windows .NET binary to run under Linux using Mono. The app runs fine on Windows. It presently fails under Mono because it can’t find a file with a hard-coded path. For testing, I’m using a Fedora 23 VirtualBox VM running under Windows 7. All the files are present on the V…
Cannot write to Hadoop DFS directory mode 775 group permission UserGroupInformation
I’m running Hadoop 2.6.2 on a private cluster with file-system permissions enabled. The cluster has password files with only system users like hadoop, no personal accounts. I’m accessing DFS from a linux edge node that has personal accounts like mine (‘clott’). The problem is that I ca…
Eliminating “File changed on disk” warning in emacs on VirtualBox
I am running Windows 10 with VirtualBox (5.0.10). I have Ubuntu 14.04 installed as a guest OS which accesses the host OS via a vboxfs share. When editing a file saved on the host (Windows) OS via this share, emacs continually gives me a warning that the file I am currently editing has been changed on disk (Fi…