command-line

How do I program using cat?

In this xkcd comic: they mention that real programmers use cat. Well, I was asking myself: how could you program using the cat command? ...

Can I copy multiple named files on the Windows command line using a single "copy" command?

I'd like to copy several known files to another directory as a part of a post-build event, but don't want to have lines and lines of "copy [file] [destination] [switches]" in my build event. If possible, I'd like to list out the files I'd like to copy using a similar format: "copy [file 1] [file 2] [file 3] [etc...] [destination] [switch...

MySql Select, MANY FIELDS, how best to display in terminal?

I'm using Putty (Command-line) and running a mysql> SELECT * FROM sometable; The 'sometable' has many fields and this results in many columns trying to be displayed in the terminal. The fields wrap onto the next line so it is very hard to line up Column titles with Field values. What solutions are there for viewing such data in term...

how do I edit a file on command line ?

Hi, I am trying to create a php file that adds a user and create public_html directory in linux using exec() function(php). I can add following code to the php file exec("useradd -d /home/username -m username"); exec("mkdir /home/username/public_html"); now..I have to add public_html to smb.conf to work public_html on windows. is it...

Can spawned Postgresql process be controlled by the spawner PHP script?

I have a PHP CLI script, that processes a csv file, inserting it's content to a table in Postgresql database. This is on an Ubuntu server. I use schedtool to control the affinity of the whole script. Schedtool is used to launch the script itself with the -e option. Unfortunately with htop I see that the database thread is spawned as a co...

How can I compile C/C++ code in PHP on the Windows platform?

Can anyone help me with the compilation of C++ code in PHP on the Windows platform? I am using Microsoft Visual C++ 6.0. I have tried the following options which I knew, but none of them work: system('test.c') exec('test.c') The file 'test.c' has been placed in my php/www/ folder. I need to first compile the code, which makes test....

What's a good way to write batch scripts in C#?

I would like to write simple scripts in C#. Stuff I would normally use .bat or 4NT .btm files for. Copying files, parsing text, asking user input, and so on. Fairly simple but doing this stuff right in a batch file is really hard (no exceptions for example). I'm familiar with command line "scripting" wrappers like AxScript so that gets ...

Django Shell shortcut in Windows

I'm trying to write a bat file so I can quickly launch into the Interactive Shell for one of my Django projects. Basically I need to write a python script that can launch "manage.py shell" and then be able to print from mysite.myapp.models import * The problem is manage.py shell cannot take additional arguments and launching into "mana...

wget WIKI, don't get diff pages (exclude by regex?)

I'm trying to download a static mirror of a wiki using wget. I only want the latest version of each article (not the full history or diffs between versions). It would be easy to just download the whole thing and delete unnecessary pages later, but doing so would take too much time and place an unnecessary strain on the server. There a...

How to script FTP upload and download?

I'm attempting to make a batch file to upload a file to ftp server. If I type it in manually it works fine but when i run the batch file it halts after it's connected... it says connected to domain.com. 220 microsoft ftp server User(domain.com:(none)): then nothing else. What the heck is going on here? Below is my batch file: ftp ...

Can an executable .jar file be called without having to use its full path?

I have a .jar file that I would like to be able to call without having to use a full file path to its location. For example, if the .jar file is located at: /some/path/to/thearchive.jar I'd like to be able to run it with: java -jar thearchive.jar instead of: java -jar /some/path/to/thearchive.jar when I'm elsewhere in the direct...

How do you send the output of ls to mv?

I know you can do it with a find, but is there a way to send the output of ls to mv in the unix command line? ...

edit commandline with $EDITOR in tcsh

Today's Daily Vim says this: Assuming you're using the bash shell, the following can be helpful when composing long command lines. Start typing on the command line and then type Ctrl-x Ctrl-e, it should drop you into your system's default editor (hopefully Vim) and allow you to edit the command line from there. Once finished, sa...

How can I activate an Excel add-in from Perl or the command line?

(Please forgive my ignorance on Excel add-ins, and feel free to correct my teminology where appropriate.) I have an Excel add-in that is used regularly. This add-in inserts a toolbar with a number of buttons. I want to automate the task of opening a spreadsheet in Excel and then "clicking" one of those buttons. In other words, I want...

Console UI in Winform App

We have a legacy application running on UNIX. Our windows users login to the application via a terminal application or commaind prompt. The app looks like one of those car-dealer like application which runs in dos mode interface. I am creating a new winform interface to the application but still want to keep the legacy application onlin...

How do I configure an OSGi environment so that it is possible to use it from the EclipseStarter class?

Hi there! Currently I'm trying to execute some bundles using the capabilities of the EclipseStarter class. If I run my program directly from Eclipse the OSGi service bundle is loaded and I'm able to install and start other bundles. But if I export my java program to a executable jar-file and run it from the command line the environment...

Modify cmd.exe properties using the command prompt

Isn't that nicely recursive? I've got a portable command prompt on my external drive, and it has a nice .bat file to configure some initial settings, but I'd like more! Here's what I know how to set from .bat: Colors = (color XY) where x and y are hex digits for the predefined colors Prompt = (prompt $p$g) sets the prompt to "C:\...

Java: problem running a jar file in command line

Hi! I'm trying to call a class (main method) from command line (Windows) with Java. The class imports other classes (other jars). I always get "class not found exception" from a class that my main program imports. Here's what I tried: Add a CLASSPATH env. var with the path where the referenced lib resides (not working) I tried with ...

How to use the POST command to send a file ?

I would like to send a file using the POST command available on almost all linuxes which include Perl. I'm wondering how.. i would like to do something like : linux:currentdir/$ POST http://www.example.com/upload.php > myFileToUpload I guess i had probably to encode the file, i'm right, it's in base64 ? Isn't it ? I also read in th...

Linux command to list all available commands and aliases

Is there a Linux command that will list all available commands and aliases for this terminal session? As if you typed 'a' and pressed tab, but for every letter of the alphabet. Or running 'alias' but also returning commands. Why? I'd like to run the following and see if a command is available: ListAllCommands | grep searchstr ...