command-line

Best resource on learning Linux command line?

Someone asked me recently what is the best resource for learning the Linux shell (she uses Ubuntu) but I really couldn't pinpoint one since I picked it up by just doing over time. But I am sure there are some books or, better yet, internet resources where one can find instructive ways of learning Linux and spreading the good word of *Nix...

IMAP folders diff?

I'd like to "diff" two IMAP folders (on two different servers) to compare spam filters, I'd like to have a command line tool (linux) to get just the headers (not the whole dir, e.g. using 'isync' or similar), something like this: $ imapget --subjects -p=password user@server or this: $ imapget --format "$DATE - $FROM - $SUBJ" -p=passwo...

Can ImageMagick return the image size?

I'm using ImageMagick from the command line to resize images: convert -size 320x240 image.jpg However, I don't know what size ImageMagick is resizing the image too. Since this is a proportionaly image scale, it's very possible that new image is 100x240 ... or 320x90 in size (not 320x240). Can I call the 'convert' command to resize t...

python - get a key press from the linux command line without having to press enter

I'm writing a command line python programme on linux. I want to ask the user to press a single key, and then it should return that key press. I don't want them to have to press enter, so I can't use the builtin raw_input() method. ...

Handle special characters in bash for...in loop

Suppose I've got a list of files file1 "file 1" file2 a for...in loop breaks it up between whitespace, not newlines: for x in $( ls ); do echo $x done results: file 1 file1 file2 I want to execute a command on each file. "file" and "1" above are not actual files. How can I do that if the filenames contains things like spaces ...

How to force a confirmation step before certain perforce command ?

Hi, I am new to Perforce. Is it possible in P4 to have a confirmation step before using some deletion command. E.g.: deleting a workspace has no confirmation step ( P4 client -d workspace_name ) deleting label has no confirmation step ( P4 label -d label_name) Which I found dangerous. Thanks, Thomas ...

Can the Spring Framework be used for batch applications?

My company is switching to Spring for our Java framework, and from what I understand it will work well for that, but we also have many Java batch applications*. Does Spring have adequate support for running batch applications? What features of spring will be useful in this environment, and won't work at all? * Java command line progra...

Fan Programming Language - Help

hey all, I'm creating an FWT application in FAN (http://www.fandev.org/) and every time I run my application, the ms-dos command prompt window appears (as well as my main application form). I don't want this ms-dos window to be shown, but i also don't know how to get rid of it, please help somebody :( it's giving me nightmares ...

Wrapping an interactive command line application in a python script

I am interested in controlling an interactive CLI application from python calls. I guess at the most basic level I need a python script that will start a CLI application on the host OS. Pipe anything from stdin to the cli application, and then pipe any output from the cli application to stdout. From this base It should be pretty straig...

Copying a Directory Tree File by File

My advisor frequently compiles a bunch of software into his /usr/local and then distributes his /usr/local as a tarball. I then extract the tarball onto our lab machines for our use. Until now, this has worked fine, we just replace the old /usr/local with the contents of the tarball. But I have started installing my own software on thes...

How to play audio file on windows from command line?

In Windows, is there a simple way (i.e. something you could type on a single command line) to just play a couple of .mp3 files and then exit on its own? wmplayer, for example, does not seem to exit when finished, forcing the harried user to hunt it down and click it closed every time. (wmplayer 11 also seems to strangely repeat some f...

OSX: Launching multiple instances of an app and passing them command line args

There is a program I need to launch multiple times and pass it different arguments each time. To do this I tried writing a simple python script as follows: import sys, os from os.path import join # This works, but will not launch twice os.system('./AppName.app -AppCommandLineArg') # This allows launching two instances but without comm...

PHP is displaying my source code?

I just upgraded to php5.3 and when I execute: php myfile.php I see the source code for myfile.php. Any idea why this is happening? I've never seen anything like it before! G-Man ...

How do I get the command-line parameters for certain button clicks in a application?

I want to start a program using Delphi code, and "command" it to perform an action, in this case a button click. I know you can start a program using the command line, but I would need the right paramaters for the button click. How or where can I find it? ...

bash and filenames with spaces

The following is a simple bash command line: grep -li 'regex' "filename with spaces" "filename" No problems. Also the following works just fine: grep -li 'regex' $(<listOfFiles.txt) where listOfFiles.txt contains a list of filenames to be grepped, one filename per line. The problem occurs when listOfFiles.txt contains filenames w...

How to get NO context when using svn diff

When I use 'svn diff' from the command line, it prints out the lines that have changed but also the 3 unchanged lines before and after for context. I much prefer seeing only the changed lines with no context. I haven't been able to determine any command line options that will let me make it behave this way. Standard 'diff' and 'cvs diff'...

Using diffstat with subversion?

Hello everyone! Could anyone give me examples, how I could use diffstat with subversion? I mean, using diffstat to analyze and produce statistics about one or multiple commits. NOTE: Linux commandline examples are OK ;) ...

How to create Cron job to backup MySQL and FTP backup to my backup server?

I want to setup a cron job to run so that it will automatically backup my MySQL database, while the database is running, and then FTP that backup to my backup server. I assume I can do this using a bash script. Anyone know of a good way to accomplish this? Thanks in advance. ...

How can I add the "--watch" flag to this TextMate snippet?

I love TextMate as my editor for all things web, and so I'd like to use a snippet to use it with style.less files to automatically take advantage of the .less way of compiling .css files on the fly using the native $ lessc {filepath} --watch as suggested in the less documentation (link) My (thanks to someone who wrote the LESS TM Bun...

Running a command in shell script

Hello I have a shell script file (run.sh) that contains the following: #!/bin/bash %JAVA_HOME%/bin/java -jar umar.jar when i try to run it (./run.sh), it gives me following: umar/bin/run.sh: line 1: fg: no job control However if I run same command directly on shell, it works perfectly. What's wrong with the script file? Thanks ...