terminal

How to edit a command output and execute it?

房东的猫 提交于 2019-12-12 06:30:02
问题 It's possible edit a command in standard editor But I don't found how to edit OUTPUT of command and execute it in command line. By example, if I type: remake I obtain: El programa «remake» no está instalado. Puede instalarlo escribiendo: sudo apt-get install remake I like remove de first line, and execute the second one. This is special case because output is fron stderr instead of stout. But in other cases is usefull edit output, add command and execute it. 回答1: I think once you got the

Run a simple C program with Sublime Text 2 in external terminal on Ubuntu

佐手、 提交于 2019-12-12 06:29:37
问题 first steps with building and running C/Cpp with Sublime Text on Ubuntu. I read here and there and I came up with this following working sublime-build: { "cmd": ["g++", "$file", "-o", "${file_path}/${file_base_name}"], "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", "working_dir": "${file_path}", "selector": "source.c, source.c++, source.cxx, source.cpp", "variants": [ { "name": "Run", "shell": true, "cmd": ["gnome-terminal -e 'bash -c \"${file_path}/${file_base_name}; exec bash\"'"]

Gitlab Pages daemon, where is /home/git?

萝らか妹 提交于 2019-12-12 05:40:22
问题 I'm trying to include SSL on my gitlab pages site, and it says I need to first install the Pages daemon. However, I'm not sure where to start: is cd /home/git a home directory on my Mac where I'm supposed to have git installed? When I do git --version it says git version 2.7.4 (Apple Git-66) however I'm not seeing a folder "git" inside my home directory. Any ideas on how I'd get into the /home/git folder? 回答1: \o/ Great! I got this certificate from StartSSL Class 1, check this tutorial to

How to allocate a pseudo-tty in which to run scripts from IDE?

痴心易碎 提交于 2019-12-12 05:25:15
问题 Eclipse (and other IDEs, such as Pycharm/IntelliJ), don't seem to use a proper terminal with which to run programs. This can lead to some problems when a program needs to work with a proper stdin/stdout. For example, the simple python script # Exit upon any keypress import sys import termios import tty fd = sys.stdin.fileno() tty.setraw(sys.stdin.fileno()) while not sys.stdin.read(1): pass Will function perfectly when run directly from bash, but will fail with the following error when from

Is there a typeahead buffer for key presses in Linux terminal?

大兔子大兔子 提交于 2019-12-12 05:19:13
问题 Does Linux buffer keys typed in terminal so that you can read them later one key at a time ? I am asking because I want to catch ESC and arrow key presses and can't find a way to reliably read the codes. I put terminal in non-canonical mode and want program to block if there is no input, but if there is, I want to fetch only one key press for processing. Update 2 : Arrow keys is just an example. I need to identify key presses even for the keys with unknown escape sequences for my program.

Print duplicate count without removing duplicates in Terminal

瘦欲@ 提交于 2019-12-12 05:11:33
问题 I am new to working with the Terminal on mac and have a large .tsv file that consists of a list of items, and two values next to it. I would like to be able to print the number of duplicates next to the first occurrence of the item Without removing additional data. I am aware of cut -f 1 | sort | uniq -c but this removes a lot of valuable data I would like to keep for analysis. I'm reading about awk and grep but I think I could use a little help. This is an example of the file I'm trying to

Running terminal commands throug java

余生长醉 提交于 2019-12-12 05:06:35
问题 I have to execute two commands in terminal from my java program. Here is the java code that I am using : import java.io.BufferedReader; import java.io.InputStreamReader; public class Runterminal { public static void main(String[] args) { Process proc; Process procRun; String compileCommand = "aarch64-linux-g++ -std=c++14 hello.cpp"; String runCommand = "aarch64-linux-objdump -d a.out"; try{ proc = Runtime.getRuntime().exec(compileCommand); procRun = Runtime.getRuntime().exec(runCommand); //

Temporarily clear the terminal in Linux

折月煮酒 提交于 2019-12-12 04:52:44
问题 I want to write a GUI/Terminal based application where I would need to clear the terminal and then write out the gui. But how do I reset the terminal back to normal once the application is finished? 回答1: Terminals (such as xterm and "any" which emulate it) support a feature called the alternate screen. Often, terminal descriptions include switching to/from the alternate screen in the smcup and rmcup capabilities, and it is used by ncurses applications. (The feature is not always used, because

Clear terminal in Python [duplicate]

痴心易碎 提交于 2019-12-12 04:38:36
问题 This question already has answers here : How to clear the interpreter console? (36 answers) Closed 11 months ago . Does any standard "comes with batteries" method exist to clear the terminal screen from a Python script, or do I have to go curses (the libraries, not the words)? 回答1: What about escape sequences? print(chr(27) + "[2J") 回答2: A simple and cross-platform solution would be to use either the cls command on Windows, or clear on Unix systems. Used with os.system, this makes a nice one

Bin Bash Terminal script to resize PNG/CR2/JPG images using Mac SIPS with space saving check

萝らか妹 提交于 2019-12-12 04:36:48
问题 I made a cool little script to take my massive photo collection of JPG/PNG/CR2 (raw files) and convert them into MacBook Pro Retina resolution of 2880px JPEGs. This allows me to have all my pics on my computer while storing the giant originals on an external hard drive. Best of all the pics look fantastic because they're resized to my exact physical screen resolution 2880px wide! You can easily adapt the script to your own needs... OK so on to my question.... My pictures on my external hard