When running a script via sudo or su I want to get the original user. This should happen regardless of multiple sudo or su runs inside of each other and specifically sudo su -. Answer Results: Use who am i | awk ‘{print $1}’ OR logname as no other methods are guaranteed. Logged in as self: Normal sudo: sudo su
Why is this MYSQL statement giving me an error?
The file is there. I even pasted the path into the mysql console. The permissions are correct. In fact, I even tested it on root user and root mysql. Answer Note that when you do LOAD DATA INFILE, MySQL is looking for that file on the server – not on your client machine. If you want to use LOAD DATA
problem when install qt4: no rule to make target “install-strip”
when I finished compiling qt4, I typed gmake install-strip but it doesn’t work either it says” no rule to make target “install-strip” how to solve this problem? Whether I should add some configure options? Answer Just do a make install , it will strip release-mode libraries itself automatically.
Delete files with string found in file – Linux cli
I am trying to delete erroneous emails based on finding the email address in the file via Linux CLI. I can get the files with find . | xargs grep -l email@example.com But I cannot figure out how to delete them from there as the following code doesn’t work. rm -f | xargs find . | xargs grep -l email@example.com
How to download images from “wikimedia search result” using wget?
I need to mirror every images which appear on this page: http://commons.wikimedia.org/w/index.php?title=Special:Search&ns0=1&ns6=1&ns12=1&ns14=1&ns100=1&ns106=1&redirs=0&search=buitenzorg&limit=900&offset=0 The mirror result should give us the full size images, not the thumbnails. What is the best way to do this with wget? UPDATE: I update the solution below. Answer It is quite difficult to write all the script in stackoverflow editor, you can find the script at
real estate linux back up solution [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question
How to obtain the path of Desktop in gnome
I am using gnome/Ubuntu-10.10 in Chinese language and the desktop path is not “~/Desktop” but “~/XXXX” where XXXX stands for the Chinese translation of “Desktop”. So, how to write code to obtain the proper path of desktop regardless of the system language? I noticed Qt SDK properly added a shortcut on the desktop so I guess there is a way.
Linux folder change auto notification
Is there a way that I can programmatically figure out whether a particular file with certain characteristics is being added into say the linux /tmp folder. All I need to create, is a small script that is automatically called every time a new file is added in the tmp folder. Answer These links might be helpful: Inotify and Inotify-tools.
MySQL the command line and pagers
I cant find anything about this from searching here. I use mysql on the command line at work and I work with fairly large tables so I set the mysql pager allowing a more readable result if I run a query, that returns 1000’s of results. I use the command below to set the pager. This suits my needs but
Resetting an ostream, C++
I have 2 different ostreams, one of them cerr, using the same streambuffer, I have some libraries in that might have modified cerr somehow,(flags? format modifiers?). prints: Debugging mystreambuffer I’ve noticed that cerr calls mystreambuffer->sync() every << operation while teststream does not call it at all. If I am correct cerr is just an standard ostream, then, why do I