Showing posts with label shell. Show all posts
Showing posts with label shell. Show all posts

Feb 10, 2014

Unix as IDE. Man

man -k someterm
apropos someterm

info -k printf
info coreutils printf

Dec 30, 2013

Unix as IDE. History

Execute last command again:
sudo !!
echo !! > new_script.sh
!! | grep Linux

Execute last command started with ls:
!ls

Arguments:
ls !^  # first arg of prev cmd
ls !$  # last arg of prev cmd
ls !*  # all args of prev cmd
ls !ls:2  # second arg of prev ls cmd

Execute command with given history number:
!2039

Hide command from history (use space before cmd):
 ls ~/eagle

Aug 30, 2013

Explain Shell

http://explainshell.com/

This site contains 29761 parsed manpages from sections 1 and 8 found in Ubuntu's manpage repository. A lot of heuristics were used to extract the arguments of each program, and there are errors here and there, especially in manpages that have a non-standard layout.

It is written in Python and uses a bit of NLTK (to find the interesting parts of the manpage), a little d3.js (for the connecting lines graphic) and Flask. It is served with uwsgi and nginx. I will open source the code in the near future, when I have time to clean it up a bit.


Sep 6, 2012

Ubuntu terminal shortcuts

CTRL + S - freezes the screen and stops any display on the screen from continuing (equivalent to a no-scroll key) (sometimes takes a moment to work)
CTRL + Q - un-freezes the screen and lets screen display continue
CTRL + \ - same as CTRL - C but stronger (used when terminal doesn't respond)
CTRL + L - clear display

Movement
line: CTRL+ A / CTRL + E
character: CTRL + B / CTRL + F

Search
start: CTRL+ R
cancel: CTRL+ G

Edit
Copy / Paste
CTRL + SHIFT + C / CTRL + SHIFT + V
Change Case
capitalize word: ALT + C
lowercase / uppercase word: ALT + L / ALT + U
Transpose
characters: CTRL+ T
words: ESC + T
Undo
CTRL + _
ALT + R - Undo all changes made to this line

Insert
Line break (\n): CTRL+ V + Return

Delete
character: CTRL + H / CTRL + D
word: CTRL+W / ALT + D
line: CTRL + U / CTRL + K

Auto Completion
command + Tab + Tab
show all possible completions: ALT + ?
insert all possible completions: ALT + *
attempt to complete filename: ALT + \
yank last argument of previous command: ALT + .
repeats the last argument of the previous command: command !$

Clear a mistyped invisible password on a terminal
CTRL + U

http://www.gnu.org/software/bash/manual/bashref.html#Bindable-Readline-Commands

stty -a
http://linux.die.net/man/1/stty

reset

Feb 20, 2012

Online Python Tutor, IDE & Debugging Tool

http://people.csail.mit.edu/pgbovine/python/ - learn Python by writing code and visualizing execution
ideone.com - online
repl.it - online, with source code

Jan 11, 2012

How do you reload a Django model module using the interactive interpreter

from django.db.models.loading import AppCache
cache = AppCache()

for app in cache.get_apps():
    __import__(app.__name__)
    reload(app)

from django.utils.datastructures import SortedDict
cache.app_store = SortedDict()
cache.app_models = SortedDict()
cache.app_errors = {}
cache.handled = {}
cache.loaded = False