terminal

why do I get “Suspended (tty output)” in one terminal but not in others?

蓝咒 提交于 2019-12-17 16:27:38
问题 Apparently I've done something strange/wrong in a tcsh shell, and now whenever I start an application in the background which prints to stdout the application is suspended (stopped). Weird thing is, this behavior only happens in this terminal; if I do the same in another terminal, the application just keeps running in the background and prints it output to the terminal. In the "broken" terminal I have to put the suspended application back into foreground (with fg ) to have it continue.

How to run terminal command in Android application?

馋奶兔 提交于 2019-12-17 15:34:50
问题 How to send a command to the terminal through android app and get the output back? For example, sending "ls /" and getting the output to print it in the GUI? 回答1: You have to use reflection to call android.os.Exec.createSubprocess(): public String ls () { Class<?> execClass = Class.forName("android.os.Exec"); Method createSubprocess = execClass.getMethod("createSubprocess", String.class, String.class, String.class, int[].class); int[] pid = new int[1]; FileDescriptor fd = (FileDescriptor

Uploading all of files in my local directory with curl

痴心易碎 提交于 2019-12-17 15:29:10
问题 I want to upload all the files in one directory, and I know how to upload one file using curl like this : curl -T "local/xxx.suffix" -u xxx:psw "ftp://192.168.1.158/public/demon_test/xxx.suffix" How can I upload all the files (subdirectory) in the current directory to an FTP server? 回答1: Use curl with find to recursively upload all files from a specific directory: find mydir -type f -exec curl -u xxx:psw --ftp-create-dirs -T {} ftp://192.168.1.158/public/demon_test/{} \; 回答2: instead of curl,

Why doesn't my terminal output unicode characters properly?

牧云@^-^@ 提交于 2019-12-17 15:28:03
问题 For example, my terminal does this: $ echo -e "\xE2\x98\xA0" ��� I expect it to do this: $ echo -e "\xE2\x98\xA0" ☠ Why? How do I make my terminal output the proper unicode symbols? I'm using Gnome 3's Terminal on Arch Linux. The output of locale shows: LANG=C LC_CTYPE="C" LC_NUMERIC="C" LC_TIME="C" LC_COLLATE="C" LC_MONETARY="C" LC_MESSAGES="C" LC_PAPER="C" LC_NAME="C" LC_ADDRESS="C" LC_TELEPHONE="C" LC_MEASUREMENT="C" LC_IDENTIFICATION="C" LC_ALL= 回答1: I figured it out. I had to make sure I

Get size of terminal window (rows/columns)

白昼怎懂夜的黑 提交于 2019-12-17 15:25:50
问题 Is there any reliable way of getting the number of columns/rows of the current output terminal window? I want to retrieve these numbers in a C/C++ program. I'm looking for a GNU/Linux solution primarily, but also need a Windows solution. 回答1: For Unix(-based), use ioctl(2) and TIOCGWINSZ : #include <sys/ioctl.h> //ioctl() and TIOCGWINSZ #include <unistd.h> // for STDOUT_FILENO // ... struct winsize size; ioctl(STDOUT_FILENO, TIOCGWINSZ, &size); /* size.ws_row is the number of rows, size.ws

Can terminals detect <Shift-Enter> or <Control-Enter>?

我怕爱的太早我们不能终老 提交于 2019-12-17 15:24:01
问题 Is it possible for the terminal to detect ⇧ Shift + Enter↵ or Ctrl + Enter↵ keypresses? I am trying to configure vim to do key mappings that use these sequences, and while they work fine in gvim, they don't seem to work in any terminal console. The curious thing is that although Ctrl + Enter↵ is not detected in vim, mapping Enter↵ to Esc maps properly, but then pressing Ctrl + Enter↵ behaves like Enter↵ ! 回答1: Some terminals send <NL> when <C-Enter> is pressed. This is equivalent to sending

Change default terminal app in Visual Studio Code on Mac

▼魔方 西西 提交于 2019-12-17 15:23:05
问题 I want to change the default terminal app used by Visual Studio Code for Mac. I am thinking it is part of preferences or settings json, but unsure. 回答1: No. But you can vote for this feature here: https://visualstudio.uservoice.com/forums/293070-visual-studio-code 回答2: Here's an example of how to make another terminal the default for VSCode, in this example I've downloaded iTerm2 and copied iTerm2 to Applications. Code (Menu) > Preferences > User Settings Edit settings.json "terminal.external

How to detect that emacs is in terminal-mode?

怎甘沉沦 提交于 2019-12-17 15:07:06
问题 In my .emacs file, I have commands that only makes sense in graphical mode (like (set-frame-size (selected-frame) 166 100) ). How do I run these only in graphical mode and not in terminal mode (i.e. emacs -nw ). Thanks! 回答1: The window-system variable tells Lisp programs what window system Emacs is running under. The possible values are x Emacs is displaying the frame using X. w32 Emacs is displaying the frame using native MS-Windows GUI. ns Emacs is displaying the frame using the Nextstep

Import module works in terminal but not in IDLE

喜你入骨 提交于 2019-12-17 14:53:50
问题 I am trying to import pyodbc module on a windows computer. It works in the terminal, but not the IDLE. The error message in IDLE is: Traceback (most recent call last): File "FilePath/Filename.py", line 3, in <module> import pyodbc ImportError: No module named pyodbc 回答1: This typically occurs when multiple versions of python are installed with different paths. You can check to see if you have multiple installations by opening up the IDLE terminal and using import sys sys.version sys.path

Execute external program from Java

坚强是说给别人听的谎言 提交于 2019-12-17 14:01:56
问题 I am trying to execute a program from the Java code. Here is my code: public static void main(String argv[]) { try { String line; Process p = Runtime.getRuntime().exec( "/bin/bash -c ls > OutputFileNames.txt"); BufferedReader input = new BufferedReader( new InputStreamReader(p.getInputStream())); while ((line = input.readLine()) != null) { System.out.println(line); } input.close(); } catch (Exception err) { err.printStackTrace(); } } My OS is Mac OS X 10.6. If I remove the "> OutputFileNames