terminal

Alternative Windows shells, besides CMD.EXE? [closed]

一世执手 提交于 2019-12-29 02:32:05
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I don't like CMD.EXE, the built-in Windows terminal. Among its problems: Hard to copy and paste. Hard to resize the window. Hard to open another window (no menu options do this). Seems to always start in C:\Windows\System32, which is super useless. Weird scrolling. Sometimes it scrolls down really far into blank

Python: get output of the shell command 'history'

故事扮演 提交于 2019-12-29 00:50:07
问题 My end goal is capture the previous command executed in the terminal. Since ~/.bash_history doesn't include commands from the current terminal session, I can't simply read that file. From another thread, I found this script: from subprocess import Popen, PIPE, STDOUT shell_command = 'bash -i -c "history -r; history"' event = Popen(shell_command, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT) output = event.communicate() That's pretty close to what I'm looking for, but it also will not

Redirecting command output to a variable in bash fails

那年仲夏 提交于 2019-12-28 13:43:31
问题 I'm trying to redirect command output to a variable: OUTPUT=$(sudo apache2ctl configtest) and then to read it: echo $OUTPUT When running it the output is the following: 19:19:12 user@user ~ OUTPUT=$(sudo apache2ctl configtest) Syntax OK Syntax OK But the variable stays blank. I've tried the same for other commands and everything works fine. OUTPUT=$(ls -l) This writes file list to variable OUTPUT so that it can be read later. What should i do to make it work? 回答1: maybe the output goes to

What is the difference between node vs nodejs command in terminal?

扶醉桌前 提交于 2019-12-28 13:42:10
问题 I have untarred node.js from the tar file given on nodejs.org, but when i try executing my js program through node command nothing happens, but on the other hand nodejs command runs executes the file. So my question is what's the difference between node command and nodejs command as and will it effect my programs as i didn't build from the source code. And i of that is the reason of this discrepancy. 回答1: This is highly dependent on many factors. Mainly, it depends on what node and nodejs in

Python unicode in Mac os X terminal

和自甴很熟 提交于 2019-12-28 11:55:11
问题 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) Since the first tring came out correctly, I reckon my OS X terminal can represent unicode, but it turns out it can't in the second case. Why ? 回答1: >>> print 'абвгд

How to make a scrolling menu in python-curses

纵然是瞬间 提交于 2019-12-28 06:50:11
问题 There is a way to make a scrolling menu in python-curses? I have a list of records that I got from a query in sqlite3 and I have to show them in a box but they are more than the max number of rows: can I make a little menu to show them all without making curses crashing? 回答1: This code allows you to create a little menu in a box from a list of strings. You can also use this code getting the list of strings from a sqlite query or from a csv file. To edit the max number of rows of the menu you

apt like column output - python library

瘦欲@ 提交于 2019-12-28 06:26:32
问题 Debian's apt tool outputs results in uniform width columns. For instance, try running "aptitude search svn" .. and all names appear in the first column of the same width. Now if you resize the terminal, the column width is adjusted accordingly. Is there a Python library that enables one to do this? Note that the library has to be aware of the terminal width and take a table as input - which could be, for instance, [('rapidsvn', 'A GUI client for subversion'), ...] .. and you may also specify

Access Denied for MYSQL ERROR 1045

可紊 提交于 2019-12-28 06:23:24
问题 I just got a new macbook pro (OS X 10.8.2) and am attempting to get mysql set up on it. So far I've been able to get it installed but I cannot get my root user access (or any user for that matter). I plan on using this for Python , on my other computer I only use MYSQL (no MAMP) and I prefer to keep it that way. For reference, I did the following: $ alias mysql=/usr/local/mysql/bin/mysql $ sudo /Library/StartupItems/MySQLCOM/MySQLCOM start $ alias mysqladmin=/usr/local/mysql/bin/mysqladmin

Open new Terminal Tab from command line (Mac OS X)

社会主义新天地 提交于 2019-12-28 04:38:13
问题 Is it possible to open a new tab in Mac OS X's terminal from the command line in a currently opened tab? I know that the keyboard shortcut to open a new tab in Terminal is "CMD+t" but I am looking for a script-based solution executed in the command line. 回答1: Try this: osascript -e 'tell application "Terminal" to activate' -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down' 回答2: Update : This answer gained popularity based on the shell function

Is there any way in the OS X Terminal to move the cursor word by word?

不羁的心 提交于 2019-12-28 04:37:19
问题 I know the combination Ctrl + A to jump to the beginning of the current command, and Ctrl + E to jump to the end. But is there any way to jump word by word, like Alt + ← / → in Cocoa applications does? 回答1: Out of the box you can use the quite bizarre Esc + F to move to the beginning of the next word and Esc + B to move to the beginning of the current word. 回答2: On Mac OS X - the following keyboard shortcuts work by default. Note that you have to make Option key act like Meta in Terminal