terminal

how to remove blank lines with grep

I tried grep -v '^$' in Linux and that didn't work. This file came from a Windows file system. ...

Automate Sass execution thru terminal (os x) via script

I started using Haml/Sass thru Rubygems recently, and I'm really liking it (although that doesn't have much to do with my question)... I would like to create a simple script I can throw in the root directory of each of my projects that will launch terminal, cd to my CSS folder, and run sass. so essentially a script that: cd ~/path_to_h...

NSTask NSPipe - objective c command line help

Here is my code: task = [[NSTask alloc] init]; [task setCurrentDirectoryPath:@"/applications/jarvis/brain/"]; [task setLaunchPath:@"/applications/jarvis/brain/server.sh"]; NSPipe * out = [NSPipe pipe]; [task setStandardOutput:out]; [task launch]; [task waitUntilExit]; [task release]; NSFileHandle * read = [out fileHandleForReading]; ...

Sort lines by length with automator?

I have a text document (1MB, TXT file) with a little more than 17,500 lines. What I'm hoping to be able to do is to sort those lines by character length and have it output to either the same file (which is then saved) or a new file entirely. Either one works fine as long as I know ahead of time. Bonus points if I could do it through Aut...

showkey equivalent on mac os x?

I'm debugging an emacs keyboard binding on my mac (C-/ to undo, if you're curious), and I came across a suggestion on EmacsWiki that I could use "showkey" to find the scancode. But it looks like a GNU/Linux-only kinda thing. Didn't find it on MacPorts. Anyone know of an alternative or something I'm missing? ...

Objective C: Terminal output into NSString

Hello! I'm trying to execute "whois search domainname.tld". I'm currently using system("whois search domainname.tld"); however i need to get the output into a NSString variable to output to the user. How can i do this? ...

Make terminal open a file with default editor

Is there a way I can say open file.php in the terminal and have jEdit open the file.php? Now I have to go to a finder window and find the file...which there are too many files and the order of the files keeps changing even though I specify by name. Note: I am working on a remote server. I login via ssh and am using a git repository. I w...

Printing double-size characters with Ncurses

Many terminal emulators (xterm, Konsole) support double-size characters. Ncurses does not support this and as far as I know, ncurses will not print escape characters (\033 will be unescaped and printed in clear text). Is it possible at all to print double-size characters in a ncurses application? ...

How do you tell if the current terminal session is in GNU screen?

I have a command I want to execute in .bashrc only when the current terminal window is managed by GNU screen. How do I tell it? Is there an environment variable for it? I used to have if [ -n "$WINDOW" ]; then command fi but, from what I can tell, $WINDOW may or may not be defined across all screen managed sessions ...

.profile and .bashrc doesn`t work on my Mac

Hi, This problem I have for a long time. After running terminal .profile, and .bashrc file doesn`t work (are not executed). Could you indicate where should I looking form a source of problem? ...

How do I recursively delete all files in a folder that begin with "._"?

As the title states, I'm trying to recursively delete all files in a folder that begin with ._. For each file on my site, there exists a file with the same exact name, but with ._ appended to it. How do I get rid of these pesky buggers? Thanks! ...

Can I get Python debugger pdb to output with Color?

I'm using PDB a lot and it seems it would be even better if I could add systax highlighting in color. Ideally, I'd like to have to the path to the code a lighter color. The line of actual code would be syntax highlighted. I'm using OS X and the Terminal app. Python 2.7 ...

How to rewrite python script output in terminal?

I have a python script and I want to make it display a increasing number from 0 to 100% in the terminal, I know how to print the numbers on the terminal but how can I "rewrite" them so 0 turns into 1, 1 into 2, and so on until 100? ...

What are the most important shell/terminal concepts/commands for novice to learn?

ALthough I've had to dabble in shell scripting and commands, I still consider myself a novice and I'm interested to hear from others what they consider to be crucial bits of knowledge. Here's an example of something that I think is important: I think understanding $PATH is crucial. In order to run psql, for instance, the PostgreSQL fo...

C code changes terminal text color; how to restore defaults? Linux

I have a C file running on Linux. It prints some lines in red (failures) and some in green (passes). As you might expect, it uses escape codes in the printf statements as follows: #define BLACK "\033[22;30m" #define GREEN "\033[22;31m" printf(GREEN "this will show up green" BLACK "\n"); If the BLACK at the end wasn't there, the ter...

Find and kill a process in one line using bash and regex.

I often need to kill a process during programming. The way I do it now is: [~]$ ps aux | grep 'python csp_build.py' user 5124 1.0 0.3 214588 13852 pts/4 Sl+ 11:19 0:00 python csp_build.py user 5373 0.0 0.0 8096 960 pts/6 S+ 11:20 0:00 grep python csp_build.py [~]$ kill 5124 How can I extract the process id ...

Can colorized output be captured via shell redirect?

Various bash commands I use -- fancy diffs, build scripts, etc, produce lots of color output. When I redirect this output to a file, and then cat or less the file later, the colorization is gone -- presumably b/c the act of redirecting the output stripped out the color codes that tell the terminal to change colors. Is there a way to ca...

Have you seen library for flexible working with terminal(Unix like)?

Hi, everyone. Have you seen library for flexible working with terminal(Unix like)? I want to implement autocompletion, history, help params in my console application same operations you can see in the Unix terminals. C#, Mono library. Thanks. ...

How does one send S-RET to Emacs in a terminal?

In org-mode, pressing M-S-RET (meta-shift-return) will create a new TODO on a new line. This key sequence sends M-RET to emacs through my terminal. I've checked this with C-h c ESC-S-RET, which returns M-RET is undefined in the mini-buffer. I'm using Snow Leopard with Emacs 23.2.1 running in Terminal.app. There is no option to define a ...

Can we have a linux terminal chat client for gmail

Does a gmail terminal chat client exist or anyway one can write it? ...