# Stripping Paths from Files in TAR Archives

There is no way to get tar to ignore directory paths of files that it is archiving. So, for example, if you have a large number of files scattered about in subdirectories, there is no way to tell tar to archive all the files while ignoring their subdirectories, such that when unpacking the archive you extract all the files to the same location. You can, however, tell tar to strip a fixed number of elements from the full (relative) path to the file when extracting using the “--strip-components” option.

# Editing Remote Files With Your Local Vim Using the SCP Protocol

I love Vim! It is so easy enough to edit a remote file with my local Vim through the Secure Copy protocol: $vi scp://user@remote.host.com/projects/foo/bar.py However, I often find myself wishing that bash completion was available to expand/complete paths on the remote system. Furthermore, when editing files outside of my home directory hierarchy, I have to remember to add an extra slash after the host name, e.g.:$ vi scp://user@remote.host.com//var/www/html/index.htm A solution is to write a custom wrapper function that takes scp-style remote file paths, converts them into Vim-style remote file paths, and then invokes Vim on them.

# Easily Create Clean Compressed Tarballs of Your Git Repository

Ideally, you could refer the whole world — or at least, the significant portion thereof that want your code — to your (public mirror) Git repository. But unfortunately, the whole world does not (yet) use Git (“I know it was you Fredo, I know it was you, and it breaks my heart.“). Sad. Sooooo sad. But true. So the only recourse is for you to send these tortured souls an archived snapshot of your code via e-mail.

# Boosting Interactive Bash Efficiency Through History Search Completion Editing

Most of us know about using the bang operator (!) to recall an entry from our bash history: $! # repeat last command$ !22 # repeat command 22 You can use “!:” followed by a number to substitute in arguments from previous commands. So, for example, to run the command “dosomething” on the first argument of the previous command: \$ dosomething !:1 The fc command is also very useful, opening up the default editor to let you edit previous commands.