Like the title suggests, I’d like to basically emulate the behavior of git commit where it launches a text editor and when you save the output, it captures the output. Anyone have an idea of how to do this? I tried to look through the git source to copy the solution but didn’t really succeed in fi…
Tag: linux
How can a process try to access other process’s memory in Linux virtual memory system
Just got confused when I am learning the virtual memory system in Linux. Since each process has its own virtual address space and its own page table translating its virtual address to physical address(am I right?), how can it possibly try to falsely access other process’s memory? There should be no entr…
How to find the latest folder in a directory and then make a full path accordingly?
I have a directory which will have some folders and some files within it. Suppose this is my current directory as shown below with pwd command – And I am logged into machineA. This /bat/data/snapshot directory will have some folders and some files within it as shown below – So the two folders I ha…
crontab @reboot does not execute bash script when server is rebooted
I’m using @reboot ~/www/example.com/bin/server in my user’s crontab…but when I reboot the server, the web server (this script) does not come up. (script works fine from command line). My guess is the /home/user directory has not been mounted yet…does anyone know if its possible to get …
mv: cannot overwrite directory with non-directory
Is it possible to get around this problem? I have a situation where I need to move some files to 1 directory below. problem is that the filename inside g/ directory is the same as the directory name and I receive the following error: Example: /home/user/data/doc/version/3766/297534 is a directory, inside ther…
Find the sum of an infinite series
How can I find the sum of an infinite series? Series: My misbehaving example: Is it possible to carry out this method correct calculation or how to resolve this problem in other ways? Answer This series does not converge. It’s called the harmonic series and it’s known to do not converge. Moreover,…
What unit is used to display Redis CPU usage
I ran the command INFO CPU in the Redis CLI and got the output shown below: My question is: what is the unit used for these figures? Is it CPU time, or CPU consumption or something else? Answer It is the CPU time (expressed in seconds) accumulated since the launch of the Redis instance, as reported by the get…
ModEvasive on Ubuntu 12.04 LTS broken?
I’ve installed mod_evasive on ubuntu 12.04 LTS using the instructions here my mod_evasive.conf looks like: Neither DOSEmailNotify or DOSSystemCommand seems to work. If I run the test.pl, the testing script that comes with mod evasive I will get successful connections followed by 403 forbidden,so the mod…
Equivalent lsof -i in Solaris
I have a fast question. I want to know what is the losf -i equivalent command in a Solaris system. I only want to show the files with network connection. Thank you!! Answer Here is a shell script that list all processes having open TCP or UDP ports on Solaris, you can limit it to a given port number by
How to uppercase file name but exclude extension
Is it possible to use rename to uppercase a file but exclude its extension? ie: I want to rename the file foo_bar.ext to FOO_BAR.ext I tried with rename ‘y/a-z/A-Z/’ foo_bar.ext, but the whole file (including extension) gets uppercased FOO_BAR.EXT Answer You are asking rename to convert all the in…