terminal

Print Coloured Text to Console in C++

I would like to write a Console class that can output coloured text to the console. So I can do something like (basically a wrapper for printf): Console::Print( "This is a non-coloured message\n" ); Console::Warning( "This is a YELLOW warning message\n" ); Console::Error( "This is a RED error message\n" ); How would I print different...

Erase Safari cookies from Terminal

I am making an application that involves controlling Safari from Applescript. Is there a way in the Terminal (preferred) or Applescript to erase Safari's cookies. Basically I want to the "Reset Safari" item from the menu using the Terminal. Is there a method that can do this? ...

Python unicode in Mac os X terminal

Can someone explain to me this odd thing: When in python shell I type the following Cyrillic string: >>> print 'абвгд' абвгд but when I type: >>> print u'абвгд' Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)...

Unable set colors according to Terminal's support in .screenrc

I would like to have a if-else loop in .screenrc for the following codes such that it is run if my terminal supports 256 colors. Otherwise, it is not run. attrcolor b ".I" # tell screen how to set colors. AB = background, AF=foreground termcapinfo xterm "Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm" termcapinfo xterm-color "Co#256:AB=\E[48;5;%d...

OS X Keychain's Password Assistant feature via Terminal

OS X's Keychain has a Password Assistant feature that suggest passwords based on user criteria (e.g. Length = 18 and FIPS-181 compliant). I want to access this feature via bash. My specific interest is requesting generation of a password with my desired length and complexity attributes, then adding that password item to a specific keyc...

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 ...

Leopard Terminal (and iTerm) Ignores Control Key Combos

I am very used to using ctrl+a, ctrl+e, ctrl+l, etc. as shortcuts to operations (beginning of line, end of line, clear terminal, etc). I cannot for the life of me get this working with either Terminal.app or iTerm on OS 10.5. I know for a fact that it works in Tiger and I even know some other Leopard users who don't have any problems, b...

Windows Terminal - Windows Form to embed cmd

Hi! I'm looking for a way to embed a cmd "Shell" into a Form. I want to build a C# based application that acts as a Terminal, better than the Powershell window (no tabs) or cmd (no nothing). Just start these interpreters in the backend. I guess MS never thought of doing this. Any ideas what From elements I could use? Thanks, i/o ...

python: find out if running in shell or not (e.g. sun grid engine queue)

is there a way to find out from within a python program if it was started in a terminal or e.g. in a batch engine like sun grid engine? the idea is to decide on printing some progress bars and other ascii-interactive stuff, or not. thanks! p. ...

Bind application to several Linux terminals

I have an application which spawns several processes. Is it possible to redirect the output of the children to another hidden terminal so that it does not mix with the parent output and give the ability to the end user to unhide the terminal when needed? Thanks. ...

Running a command in a new Mac OS X Terminal window.

Hi, I've been trying to figure out how to run a bash command in a new Max OS X Terminal.app window. As, an example, here's how I would run my command in a new bash process: bash -c "my command here" But this reuses the existing terminal window instead of creating a new one. I want something like: Terminal.app -c "my command here" Bu...

Text editors with built-in terminal?

I've found Kate when I tried out SUSE; I've become 'addicted' to the built-in terminal feature that no other editor seems to have. The terminal can be automatically synchronized to the built-in file explorer, which I've found very useful. What other editor exists for environments other than KDE with support for a built-in terminal? Like...

reuse vim instance from linux terminal

By making use of the remote feature in vim, is it possible to reuse an instance of vim to load up multiple files as needed. It will be nice to have that facility from within the same terminal instance. I am more keen to have a tab based interface, which available in vim 7+ The scenario should be Open terminal vim file1.cpp Edit - Sav...

Getting terminal width in C?

I've been looking for a way to get the terminal width from within my C program. What I keep coming up with is something along the lines of: #include <sys/ioctl.h> #include <stdio.h> int main (void) { struct ttysize ts; ioctl(0, TIOCGSIZE, &ts); printf ("lines %d\n", ts.ts_lines); printf ("columns %d\n", ts.ts_cols); } ...

re-initialize / reconnect a terminal after network interruption

Hi, I have what is probably a very simple terminal related question. I'm running Ubuntu 8.10 Intrepid Ibex, using Gnome, and I often open a terminal-based ssh session only to have it dropped at some point later on. Once the session is dropped the terminal becomes unusable, obviously because the network connection has been dropped. ...

Looking for a tabbed terminal emulator for windows. Any suggestions?

I've used Hummingbird Exceed as my Xserver on my windows box for years. I've almost always worked out of xterms, but at times the number of open windows can get a bit out of control and hard to manage. Wondering if there is a terminal emulator that runs on WinXP that supports tabbed windows, similar to Konsole on KDE. ...

Prefered terminal scripting language

What language do you prefer writing scripts for common tasks (backup, sync, etc.) and why? I'm not talking about programing web pages or applications. I've got this question when thinking why bash is still popular. For example python looks more comfortable for me. Do you use just because you know it or for some special reasons? ...

Mac os x Terminal.app's buffer and screen command

Hi, I use Mac os x Terminal.app to connect to my remote machine and then use screen on that machine. Is there a way to use the scrollbars on Terminal to scroll back and forth on the screen's buffer. It is painful to do ctrl+a + Esc and then Page Up/Down Thanks Arvind ...

Mac user needs some folder help with applescript. SFW

I Have a folder full of images and I need to create a text file of all the image names with applescript. Is there some way with Applescript to read in all the file names there are about 10k of them and then output this to a text file? Any help would be great! Thanks for reading. ...

Returning the terminal cursor to start-of-line with wrapping enabled

I'm writing a filter (in a pipe destined for a terminal output) that sometimes needs to "overwrite" a line that has just occurred. It works by passing stdin to stdout character-by-character until a \n is reached, and then invoking special behaviour. My problem regards how to return to the beginning of the line. The first thing I thoug...