terminal

How to get/set the console cursor position in Ruby (Windows)

I'm trying to write a shell in Ruby, and to implement tab completion I am using the WinAPI function getch to read in a character at a time from the user, checking for tabs. The problem with this is the backspace key: It moves the cursor further back than the prompt (eg, with prompt hello> , the user can backspace the cursor on to the...

connect to MYSQL from PHP via terminal

Hay all, i need a little hlep. I'm trying to connect to my localhost MySQL server via php in the terminal. It's outputting that it cannot connect to the host through my socket. My PHP ini install says this MYSQL_SOCKET /tmp/mysql.sock so i used mysql_connect("/tmp/mysql.sock","root","",""); And i get errors Any suggestions? ...

Serial communication terminal alternatives for windows

I'm looking for a winxp terminal tool that will send/receive raw bytes, not just printable ASCII like the hyperterminal that ships with winxp does. Preferably open-source. ...

Mac Terminal.app annoying bug - How to fix it?

Video showing the problem: http://www.mentaframework.org/download/TerminalBug.mov When I am typing on the Terminal.app and reach the end of the line, the next line starts on top of the first line, overwriting everything. Then if I use the delete key everything messes up and disappears. I did a ssh in the same terminal to a different h...

Gnome Terminal Duplication

Very often I need two gnome-terminal sessions at the same location. Is it possible to open a single terminal, get to the directory I need, and make a duplicate of the terminal so I don't have to type in the cd command (which can get lengthy) a second time in the second window? ...

Meta and # in a UK mac terminal

In the mac terminal application there is a setting (preferences -> keyboard) that lets you set "use option as meta key". This is useful as a lot of unix boxes use bash as default shell and that has emacs keybindings M-f and M-b that let you skip words. Problem is that on a Mac with a UK keyboard the # symbol is tricky to get to - norma...

How to view git objects and index without using git

Using the OS X terminal, How an you view the contents of these files as plain text? ...

Selecting text in terminal without using the mouse

If I'm working in a terminal window in Linux, is there a keyboard shortcut I can use to select output displayed on previous lines? If I select something with the mouse I can copy using ctrl-shift-c, but is there a way to select without using the mouse at all. I'm using either gnome terminal or kde konsole in ubuntu desktop. For examp...

how to specify the terminal width in mysql CLI

I'm using the mysql CLI, however the result displays always wraps around on my terminal screen. is there any way to specify to mysql the size of my terminal screen? ...

Cocoa/Objective-c 'system();' acting weird

I'm trying to run an applescript inside my Cocoa app using the system(); function - the string I'm passing to the function works in terminal and the applescript itself is fine, I think it has something to do with NSString - can anyone help? //add to login items NSLog(@"add to login"); NSString *pathOfApp = [[NSBundle mainBundle] b...

Mac OS X Terminal Colors

I'm new to Mac having just got one after working with Ubuntu Linux for some time. Among the many things I'm trying to figure out is absence of colors in my the terminal window - like the ones that are shown (on linux) when you run 'ls -la' or 'git status'... I just can't figure out how to activate them in the actual shell. ...

How to allow a user to edit data in a separate app from the terminal?

I am writing a terminal-based application, but I want the user to be able to edit certain text data in a separate editor. For example, if the user chooses to edit the list of current usernames, the list should open as a text file in the user's favorite editor (vim, gedit, etc.). This will probably be an environment variable such as $MY...

Getting Emacs to respect my default shell + options

I'm trying to get my Emacs shell to mimic that of my standard terminal sessions. Basically I would like it to respect the same PATH as well as the command prompt. So far I have a few issues: PATH isn't found, below is the fix I'm using for that. I'm getting ascii color codes all over the place with another fix I tried. I have the f...

Opening a new terminal tab in OSX(Snow Leopard) with the opening terminal windows directory path

Hi all. I've been Googling for a while looking for a simple way to do this, and I can't find one. I have a custom terminal environment set up (zsh) with various aliases and functions to make things easier. One thing I keep running into is that I will quickly APPLE-t to create a new tab and then type a command relative to the path of th...

graceful degradation for globbing on terminal

Whenever glob pattern match fails, it stops the whole job. For instance, $ mv *.jpg *.png folder1 && blahblah mv: cannot stat `*.jpg': No such file or directory *.png isn't moved to folder1 and blahblah is not run. And the script below works only for the case when both .[A-z]* and * succeed. #!/bin/bash cd $1 du -sk .[A-z]* *| sort...

Count occurrences of a char in plain text file

Is there any way under linux/terminal to count, how many times the char f occurs in a plain text file? ...

Launching server emacs from shell

I'm in a class that uses an implementation of Emacs on a school server. I'm on a mac running snow leopard, and I have my own implementation of Emacs on it. To access the server-Emacs, I ssh into the server and launch Emacs from its location there. I'm relativly new to emacs, and I have a particular problem whenever I try to access the ...

Can one highlight tab characters in the terminal?

Using terminal sequences, I can colour text in a terminal emulator: $ echo -e '\e[37;41m--this is white on red--\e[0m' And this works. The following prints a red rectangle, i.e. space characters have a red background and an empty foreground: $ echo -e '\e[37;41m \e[0m ' But the following prints two red rectangles separated by ...

mysql command line. Empty set, 1 warning (0.01 sec)

How do i view the warning(s) after a SELECT query? The results of one query is Empty set, 1 warning (0.01 sec) I am using mysql via command line on linux. ...

Terminal Command Mac Alter table SQLite3...

What is the terminal command, or where is a good resource to get them, to alter a table. And, do I need to re run the $rake db:migrate after I do this? I am running RoR on Snow Leopard. Last question, can I make an already created column non-null. UPDATE: figured out how to alter, just need to know if I need to rake db:migrate after a...