Suppose I want to clone my hard drive (hda) to another drive (hdb) in the same computer. As I see it, there's two easy, rough and do-it-yourself ways:
cat /dev/hda > /dev/hdb
and
dd if=/dev/hda of=/dev/hdb
What technical reasons are there to that the latter is often/always said to be better than the former?
under no circumstances tr...
What is the best way to change a user-password remotely in Unix?
This must be performed by the user, in a Web-app or Windows-App, without using SSH or any direct connection between the user and the server (direct command line not allowed).
Thanks
...
How do I use the UNIX tool 'find' to search for files created on a specific date?
...
I'm running autoconf and configure sets SHELL to '/bin/sh'.
This creates huge problems. How to force SHELL to be '/bin/bash' for autoconf?
I'm trying to get this running on osx, it's working on linux. Linux is using SHELL=/bin/bash. osx defaults to /bin/sh.
...
I know it is customary, but why? Are there real technical reasons why any other way would be a really bad idea or is it just based on the history of encoding and backwards compatibility? In addition, what are the dangers of not using UTF-8, but some other encoding (most notably, UTF-16)?
Edit : By interacting, I mostly mean the shell a...
Is there any way so that i can echo password when asked for in unix shell without use of external binaries ? Something like simple function triggered when password prompt is displayed
...
I have multiple branches of a project checked out, each under their own directory (pretty standard).
src/branch1/some/code/directories
src/branch2/some/code/directories
I often find myself wanting to copy selected files from one branch to another. An example would be copying cvsignore files, or intellij module files. The pseudocomm...
I'm maintaining a library that contains compiled objects that need to be linked into
a 3rd party executable. sometimes the executable has been compiled for Solaris, sometimes as a 32bit Linux Application, sometimes its a 64bit linux application.
What I'd love to do is pass one "path" to the library, and have the application then automa...
I can do this:
$ find .
.
./b
./b/foo
./c
./c/foo
And this:
$ find . -type f -exec cat {} \;
This is in b.
This is in c.
But not this:
$ find . -type f -exec cat > out.txt {} \;
Why not?
...
Like most *nix people, I tend to play with my tools and get them configured just the way that I like them. This was all well and good until recently. As I do more and more work, I tend to log onto more and more machines, and have more and more stuff that's configured great on my home machine, but not necessarily on my work machine, or my...
I realize that since UNIX sockets are platform-specific, there has to be some non-Java code involved. Specifically, we're interested in using JDBC to connect to a MySQL instance which only has UNIX domain sockets enabled.
It doesn't look like this is supported, but from what I've read it should be at least possible to write a SocketF...
Has anyone ever heard of a UNIX shell written in a reasonable language, like Python?
...
Is it possible to check a bash script syntax without executing it?
Using Perl, I can run perl -c 'script name', is there any equivalent command for bash scripts?
Thanks.
...
I see this often in the build scripts of projects that use autotools (autoconf, automake). When somebody wants to check the value of a shell variable, they frequently use this idiom:
if test "x$SHELL_VAR" = "xyes"; then
...
What is the advantage to this over simply checking the value like this:
if test $SHELL_VAR = "yes"; then
...
...
I'm looking to call a subprocess with a file descriptor opened to a given pipe such that the open() call does not hang waiting for the other side of the pipe to receive a connection.
To demonstrate:
$ mkfifo /tmp/foobar.pipe
$ some_program --command-fd=5 5</tmp/foobar.pipe
In this case, some_program is not run until some process has ...
Every time I use the "at" command, I get this message:
warning: commands will be executed using /bin/sh
What is it trying to warn me about? More importantly, how do I turn the warning off?
...
I have a very simple TCP server written in C. It runs indefinitely, waiting for connections. On Windows, I use select to check for activity on the socket, and if there isn't any, I have the following code to allow me to quit by hitting 'q' on the keyboard:
if( kbhit() ) {
char c = getch();
if( c == 'q' ) break;
}
This doesn't wo...
Hello everybody.
I need some help from the shell-script gurus out there.
I have a .txt file (log) that traces the IP addresses of clients on several lines, in a format similar to this one:
Line1 - Client IP [192.168.0.1] Other data
Line2 - Client IP [192.168.0.2] Other data
Line3 - Client IP [192.168.0.3] Other data
Line4 - Client IP [...
In this particular case I'm trying to discover if a mylib.a file is 32 or 64 bit compatible. I'm familiar with ldd for shared objects (mylib.so) but how do I inspect a regular .a archive?
...
What's a quick-and-dirty way to make sure that only one instance of a shell script is running at a given time?
...