This is part of oh-my-laptop.
- ag
- autojump
- editorconfig
- global
- graphviz
- htop
- httpie
- imagemagick
- jq
- md5sha1sum
- pstree
- ranger
- rlwrap
- texinfo
- tokei
- tig
- tldr
- tmux
- wget
A lot of my time spent “writing” code is actually spent reading code. And a decent chunk of my time spent reading code is actually spent searching code. Lately I’ve started working with a larger codebase. Both grep and ack take a non-negligible amount of time to search it. Both are slow, but for different reasons. Grep is fast, but doesn’t ignore files. Ack is very good at ignoring files, but it’s written in Perl instead of C. What I really want is something that’s fast and ignores files.
You can not go back to ack after the first you try ag. There’re lots of third-party ag integration for various editors, check betterthanack.
autojump is a cd
replacement command that learns, it provides an easy and
faster way to navigate your filesystem from the command line. It works by
maintaining a database of the directories you use the most from the command
line.
Brief usage:
j foo
: jump to a directory that containsfoo
jc bar
: jump to a child directoryjc music
orjco music
: open file manager to directories (instead of jumping)
We live in a world with multiple editors or IDEs, and often we need collaboration with others. EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems.
Check github for detailed installation instructions.
GNU GLOBAL is a source code tagging system that works the same way across diverse environments, such as Emacs editor, Vi editor, Less viewer, Bash shell, various web browsers, etc.
You can locate various objects, such as functions, macros, structs, classes, in
your source files and move there easily. It is useful for hacking a large
projects which contain many sub-directories, many #ifdef
and many main()
functions. It is similar to ctags or etags, but is different from them in the
following two points:
- independence of any editor
- capability to treat definition and reference
Graphviz is open source graph visualization software that takes descriptions of graphs in a simple text language and make diagrams in useful formats.
htop is an interactive process viewer for Linux(and ported to Mac OS X). It is a text-mode application and requires ncurses library.
It’s a better replacement for the traditional builtin top program.
Type h
from within htop
to get instant help.
HTTPie a command line HTTP client with an intuitive UI, JSON support, syntax highlighting, wget-like downloads, plugins, and more. It has a huge collection of features with sensible defaults.
Consider httpie as a modern curl.
imagemagick provides a collection of command line tools to manipulate images.
jq is like sed
for JSON data - you can use it to slice and filter and map and
transform structured data with the same ease that sed
, awk
, grep
and
friends let you play with text.
md5sha1sum package provides the missing md5sum
, sha1sum
command for Mac OS
X.
pstree is a small program that shows a list of process as a tree.
ranger is a CLI file manager with Vi key bindings. Just as htop, ranger depends ncurses library. It provides a minimalistic and nice CLI interface with VI key bindings for fast file and directory navigation. It can also guess which program you want to use when open particular files.
Try it and I’m sure you will fall in love with it. Check its screenshots for some intuition.
rlwrap is a ‘readline wrapper’, a small utility that uses the GNU readline library to allow the editing of keyboard input for any command. You have rlwrap, then you have the great, pervasive readline’s history, search, shortcuts at your fingertips for any CLI programs.
Here’s some tutorials from its home page:
If
$ <command> <args>
doesn’t let you use arrow keys to edit input, or if you just want decent input history and completion, try:
$ rlwrap [-options] <command> <args>
You then can edit <command>
’s input and recall the input history using the
arrow keys. Input history is remembered accross invocations, separately for
different <command>
. Typing !<prefix><TAB>
will recall the last input line
starting with <prefix>
, CTRL-R
will search the input history. With the
-r
and -f
options you can specify the list of words which rlwrap will use
as possible completions, taking them from a file (-f
option) or from
<command>
’s standard in/output. rlwrap monitors <command>
’s terminal settings,
so that it can do the right thing when command asks for single keypresses or
for a password. Commands that already use readline will always ask for (and
get) single keypresses, which makes rlwrapping them rather pointless. However,
if one uses the -a
option, rlwrap will use its own line editing and
history. Unforunately, in this case, rlwrap cannot detect whether <command>
asks for a password. This can be remedied by giving the password prompt
(excluding trailing space and possibly the first few letters) as an argument to
the -a
option.
Run netcat with command-line editing:
rlwrap nc localhost 80
Run lprolog and use library1 and library2 to build a completion word list:
rlwrap -f library1 -f library2 lprolog
Run smbclient (which already uses readline), add all input and output to completion list, complete local filenames, avoid showing (and storing) passwords:
rlwrap -cr -aPassword: smbclient '\\PEANUT\C'
Besides man pages, GNU texinfo is another popular documentation system, and it is the official documentation format for the GNU project.
Some packages may need texinfo to faciliate the build process. So we add it here.
tokei is a line of code counter which is written by rust. It runs really fast.
tig is a text-mode interface for git.
tldr is a collection of simplified and community-driven man pages.
tmux is a terminal multiplexer.
By multiplexer, it means you can create windows, panels in a single terminal windows. No need for traditional vertical or horizontal splitting features from terminal emulators. You can switch between windows, panels without touching the mouse, and you can create, attach, detach sessions at any time. IMHO, tmux is a killer app for CLI gurus.
There’s a wonderful book, <tmux: Productive Mouse-Free Development> by Brian
P.Hogan. oh-my-laptop steals some code snippets from this book and replace the
prefix key ctrl-b
with ctrl-l
. Note that tmux’s key bindings is case
sensitive, so when weird things happened, check your CAPSLOCK first.
Last but now least, you’d better install latest version tmux to avoid some weird bugs. On ubuntu, you can do like this.
Key bindings:
ctrl-l |
: split window verticallyctrl-l -
: split window horizontallyctrl-l c
: create a new windowctrl-l q
: show pane switch indicatorctrl-l z
: zoom in/out a pane
GNU Wget is a free software package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols.
Mac OS X didn’t has it by default, so we add it here.