Commands by basvdburg (1)

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Rename files in batch

Advanced python tracing
Trace python statement execution and syscalls invoked during that simultaneously

Tell local Debian machine to install packages used by remote Debian machine
(also works on Ubuntu) Copies the 'install,' 'hold,' 'deinstall' and 'purge' states of packages on the remote machine to be matched on the local machine. Note: if packages were installed on the local machine that were never installed on the remote machine, they will not be deinstalled by this operation.

shows history of logins on the server
perfect on a crashed system where you can't use commands like last. for investigation purposes wtmp file can be copied over to a different server and read with utmpdump

Easy Persistent SSH Connections Using Screen
Use as: $ s host1 Will ssh to remote host upon first invocation. Then use C-a d to detatch. Running "s host1" again will resume the shell session on the remote host. Only useful in LAN environment. You'd want to start the screen on the remote host over a WAN. Adapted from Hack 34 in Linux Server Hacks 2nd Addition.

find external links in all html files in a directory list
Just a handy way to get all the unique links from inside all the html files inside a directory. Can be handy on scripts etc.

purge installed but unused linux headers, image, or modules
will purge: only installed apps: /^ii/!d avoiding current kernel stuff: /'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d using app names: s/^[^ ]* [^ ]* \([^ ]*\).*/\1/ avoiding stuff without a version number: /[0-9]/!d

Alias to securely run X from tty and close that tty afterwards.
There are different ways to run X, I prefer to run it without xdm/gdm. The problem is you can't lock X because one can press Ctrl+Alt+F1, press Ctrl+Z and kill you X locking process. Of course you can disable Ctrl+Alt* or Ctrl+Alt+Backspace keys, but it's inconvinient if you really need to switch into console.

Install pip with Proxy
Installs pip packages defining a proxy

Output a list of svn repository entities to xml file
I use this to pull the last commit date for everything in my repo, so I can tell the client which files haven't been touched or updated since the repo was created. Another way to do it is to use svn log, but that does not pull the "kind" attribute. It does, however, give you the commit message. Both are very useful.


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: