Commands by TetsuyO (5)

  • Finds files modified today since 00:00, removes ugly dotslash characters in front of every filename, and sorts them. *EDITED* with the advices coming from flatcap (thanks!)

    find -maxdepth 1 -type f -newermt "00:00" -printf "%f\n" | sort
    TetsuyO · 2013-03-23 12:50:01 4
  • This oneliner gets all the 'modified' files in your git repository, and opens all of them in vim. Very handy when you're starting to work in the morning and you simply want to review your modified files before committing them. Maybe there are better ways to do that (and maybe integrated in vim and/or git, who knows), but I found quicker to do this oneliner.

    vim `git status | grep modified | awk '{print $3}'`
    TetsuyO · 2012-11-19 09:48:46 2
  • Substitute that 724349691704 with an UPC of a CD you have at hand, and (hopefully) this oneliner should return the $Artist - $Title, querying Yes, I know, all that head/tail/grep crap can be improved with a single sed command, feel free to send "patches" :D Enjoy! Show Sample Output

    wget -O foobar &> /dev/null ; grep \/release\/ foobar | head -2 | tail -1 | sed -e 's/^<div>.*>\(.*\)<\/a><\/div>/\1/' ; rm foobar
    TetsuyO · 2011-01-30 23:34:54 0
  • This is an example of the usage of pdfnup (you can find it in the 'pdfjam' package). With this command you can save ink/toner and paper (and thus trees!) when you print a pdf. This tools are very configurable, and you can make also 2x2, 3x2, 2x3 layouts, and more (the limit is your fantasy and the resolution of the printer :-) You must have installed pdfjam, pdflatex, and the LaTeX pdfpages package in your box. Show Sample Output

    pdfnup --nup 2x1 --frame true --landscape --outfile output.pdf input.pdf
    TetsuyO · 2010-12-21 14:20:06 0
  • Quick and dirty version. I made a version that checks if a manpage exists (but it's not a oneliner). You must have ps2pdf and of course Ghostscript installed in your box. Enhancements appreciated :-)

    man -t manpage | ps2pdf - filename.pdf
    TetsuyO · 2010-12-19 22:40:18 5

What's this? 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

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Get an authorization code from Google
This is a basis for other Google API commands.

Export log to html file
Logtool is a nice tool that can export log file to various format, but its strength lies in the capacity of colorize logs. This command take a log as input and colorize it, then export it to an html file for a more confortable view. Logtool is part of logtool package.Tested on Debian.

Swap a file or dir with quick resotre
This lets you replace a file or directory and quickly revert if something goes wrong. For example, the current version of a website's files are in public_html. Put a new version of the site in public_html~ and execute the command. The names are swapped. If anything goes wrong, execute it again (up arrow or !!).

Perl one-liner to determine number of days since the Unix epoch
There are some environments that use this value for password and account expiration. It's helpful to be able to quickly determine the number of days since the Unix epoch (dse) when working directly with the configuration files as an administrator.

show how many regex you use in your vim today
i want to count how many regex code i have used in vim in a long time so i make a directory in svn host and post record to this directory of course i dont want to post manually so i worte a script to do that and this is the core thing to do

Simple Gumblar check command

Decrypt MD5
Decrypt MD5 , replace 1cb251ec0d568de6a929b520c4aed8d1 with the MD5 string you want to decrypt

mirrors directory to a ftp server

scp file from hostb to hostc while logged into hosta
While at the command line of of hosta, scp a file from remote hostb to remote hostc. This saves the step of logging into hostb and then issuing the scp command to hostc.

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.


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: