yield the dog

Command Line Gems

| Comments

As a long time command line lover, I have gathered a lot of little tools that help me throughout the day (and night). This list represents an unordered and probably incomplete inventory of my command line swiss army knife.

  • ssh-copy-id
    This is one of my favorites and seems to be rather unknown. ssh-copy-id helps you to distribute your public keys on remote servers. No more scp-ing, ssh-ing and chmod-ing and wondering what you have forgotten when passwordless ssh does not want to work. If you live on a Mac you have to brew install ssh-copy-id.

  • htop
    htop greatly improves the old top command with easy sorting and scrolling abilities and a much nicer UI

  • iftop
    iftop displays bandwidth usage on an interface. E.g. sudo iftop -i eth0

  • oh-my-zsh
    Oh-my-zsh lets you easily customize your ZSH. If you do not use ZSH, change your life with chsh -s /bin/zsh

  • ack
    ack is a tool like grep, optimized for programmers, see betterthangrep for more information.

  • awk
    The AWK utility is an interpreted programming language typically used as a data extraction and reporting tool.

  • kill -9
    Send KILL signal to process

  • ctrl+r Lots of command line users do not know the reverse search with CTRL r. Even more do not know that you can hit it more than once if the first match is not the one you were looking for.

  • !!
    repeat the last command. This is especially useful if you forgot to sudo.

  • ssh -f user@host -L LOCAL_PORT:localhost:REMOTE_PORT -N –g
    create an ssh tunnel between host:REMOTE_PORT and localhost:LOCAL_PORT. especially useful, if the remote-port of the server is not accessible on the web (and if you want to secure the traffic, of course). The -f switch tells ssh to go into background mode, -N to not execute a command on the remote, and -g to allow remote hosts to connect to local forwarded ports. For a detailed explanation see ssh tunneling made easy

  • sox
    the Swiss Army knife of sound processing programs. handle various sound formats, apply effects (chorus, delay, etc), adjust volume, tempo, noise-reduction and many more features. plus, if combined with a little ruby one-liner, you can do fun stuff like this: tweet

  • disown -
    disown a process and let it run after you locked out of a session

  • lsof
    list open file handles

  • man ascii
    list ASCII table in octal, decimal and hexadecimal

  • alt . , $!, $*
    Get the last argument of the last command with alt . or $!. alt . can be pressed multiple times to skip through the history. If you want to get all arguments from the last command you can use $*.

  • python -m SimpleHTTPServer 8080 - serves current dir
    creates a simple http server

  • strace
    strace is a powerful debugging utility for Linux and some other Unix-like systems, to monitor the system calls used by a program

  • mplayer
    command line media player with a great feature set and minimal footprint

  • units — man units
    convert units

  • Zcat, Zless, Zgrep, Zdiff
    you do not have to extract an archive of a log if you want to take a short look, just use zlessand zgrep

  • kill - pause and continue
    you do not have to always kill a process and restart it, kill can pause and start processes, too:
    kill -STOP PID #to stop
    kill -CONT PID #to continue

  • ipcalc
    perform simple manipulation of IP addresses

  • watch
    watch – execute a program periodically, showing output fullscreen
    e.g.: watch -d -n 1 "netstat -an | grep :8080"

  • multitail
    if one tail -f is not enough

  • z
    tracks your most used directories, based on ‘frecency’ and lets you jump by specifying a fragment.

  • tmux
    A terminal multiplexer. get it (cause screen is dead)!

  • ffmpeg
    The swiss army knife of video processing, video recording on the command line. The abilities of ffmpeg reach from capturing single images from a web cam (combine that with a GIT post commit hook and you have your self made lolcommits) over transcoding video files to recording screencasts (at least under X).

UPDATE

fixed the mixup between ack and awk.

Comments